Skip to content

Commit 141a611

Browse files
committed
AST: Remove AvailableAttr::platformString().
1 parent c2e8e30 commit 141a611

File tree

2 files changed

+7
-13
lines changed

2 files changed

+7
-13
lines changed

include/swift/AST/Attr.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -817,11 +817,6 @@ class AvailableAttr : public DeclAttribute {
817817
/// platform.
818818
bool hasPlatform() const { return getPlatform() != PlatformKind::none; }
819819

820-
/// Returns the string for the platform of the attribute.
821-
StringRef platformString() const {
822-
return swift::platformString(getPlatform());
823-
}
824-
825820
/// Returns the human-readable string for the platform of the attribute.
826821
StringRef prettyPlatformString() const {
827822
return swift::prettyPlatformString(getPlatform());

lib/AST/Attr.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1172,21 +1172,20 @@ bool DeclAttribute::printImpl(ASTPrinter &Printer, const PrintOptions &Options,
11721172
}
11731173

11741174
case DeclAttrKind::Available: {
1175-
auto Attr = cast<AvailableAttr>(this);
1176-
auto SemanticAttr = D->getSemanticAvailableAttr(Attr);
1177-
if (!SemanticAttr)
1175+
auto Attr = D->getSemanticAvailableAttr(cast<AvailableAttr>(this));
1176+
if (!Attr)
11781177
return false;
11791178

11801179
if (Options.printPublicInterface() && Attr->isSPI()) {
1181-
assert(Attr->hasPlatform());
1182-
assert(Attr->Introduced.has_value());
1180+
assert(Attr->isPlatformSpecific());
1181+
assert(Attr->getIntroduced().has_value());
11831182
Printer.printAttrName("@available");
11841183
Printer << "(";
1185-
Printer << Attr->platformString();
1184+
Printer << Attr->getDomain().getNameForAttributePrinting();
11861185
Printer << ", unavailable)";
11871186
break;
11881187
}
1189-
if (Attr->isForEmbedded()) {
1188+
if (Attr->getParsedAttr()->isForEmbedded()) {
11901189
std::string atUnavailableInEmbedded =
11911190
(llvm::Twine("@") + UNAVAILABLE_IN_EMBEDDED_ATTRNAME).str();
11921191
Printer.printAttrName(atUnavailableInEmbedded);
@@ -1200,7 +1199,7 @@ bool DeclAttribute::printImpl(ASTPrinter &Printer, const PrintOptions &Options,
12001199
Printer.printAttrName("@available");
12011200
}
12021201
Printer << "(";
1203-
printAvailableAttr(D, *SemanticAttr, Printer, Options);
1202+
printAvailableAttr(D, *Attr, Printer, Options);
12041203
Printer << ")";
12051204
break;
12061205
}

0 commit comments

Comments
 (0)