|
29 | 29 | #include "swift/AST/Types.h" |
30 | 30 | #include "swift/Basic/Defer.h" |
31 | 31 | #include "swift/Basic/QuotedString.h" |
| 32 | +#include "swift/Strings.h" |
32 | 33 | #include "llvm/ADT/SmallString.h" |
33 | 34 | #include "llvm/ADT/StringSwitch.h" |
34 | 35 | #include "llvm/Support/ErrorHandling.h" |
@@ -126,7 +127,7 @@ DeclAttrKind DeclAttribute::getAttrKindFromString(StringRef Str) { |
126 | 127 | #define DECL_ATTR(X, CLASS, ...) .Case(#X, DAK_##CLASS) |
127 | 128 | #define DECL_ATTR_ALIAS(X, CLASS) .Case(#X, DAK_##CLASS) |
128 | 129 | #include "swift/AST/Attr.def" |
129 | | - .Case("_spi_available", DAK_Available) |
| 130 | + .Case(SPI_AVAILABLE_ATTRNAME, DAK_Available) |
130 | 131 | .Default(DAK_Count); |
131 | 132 | } |
132 | 133 |
|
@@ -982,7 +983,12 @@ bool DeclAttribute::printImpl(ASTPrinter &Printer, const PrintOptions &Options, |
982 | 983 | Printer << ", unavailable)"; |
983 | 984 | break; |
984 | 985 | } |
985 | | - Printer.printAttrName(Attr->IsSPI ? "@_spi_available": "@available"); |
| 986 | + if (Attr->IsSPI) { |
| 987 | + std::string atSPI = (llvm::Twine("@") + SPI_AVAILABLE_ATTRNAME).str(); |
| 988 | + Printer.printAttrName(atSPI); |
| 989 | + } else { |
| 990 | + Printer.printAttrName("@available"); |
| 991 | + } |
986 | 992 | Printer << "("; |
987 | 993 | printAvailableAttr(Attr, Printer, Options); |
988 | 994 | Printer << ")"; |
|
0 commit comments