Skip to content

Commit e7936ff

Browse files
committed
moduleinterface: add basic module interface support
1 parent 59896a1 commit e7936ff

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

lib/AST/Attr.cpp

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,9 @@ static bool isShortAvailable(const DeclAttribute *DA) {
371371
if (!AvailAttr)
372372
return false;
373373

374+
if (AvailAttr->IsSPI)
375+
return false;
376+
374377
if (!AvailAttr->Introduced.hasValue())
375378
return false;
376379

@@ -969,9 +972,18 @@ bool DeclAttribute::printImpl(ASTPrinter &Printer, const PrintOptions &Options,
969972
}
970973

971974
case DAK_Available: {
972-
Printer.printAttrName("@available");
973-
Printer << "(";
974975
auto Attr = cast<AvailableAttr>(this);
976+
if (!Options.PrintSPIs && Attr->IsSPI) {
977+
assert(Attr->hasPlatform());
978+
assert(Attr->Introduced.hasValue());
979+
Printer.printAttrName("@available");
980+
Printer << "(";
981+
Printer << Attr->platformString();
982+
Printer << ", unavailable)";
983+
break;
984+
}
985+
Printer.printAttrName(Attr->IsSPI ? "@_spi_available": "@available");
986+
Printer << "(";
975987
printAvailableAttr(Attr, Printer, Options);
976988
Printer << ")";
977989
break;

0 commit comments

Comments
 (0)