Skip to content

Commit cabc545

Browse files
committed
[AST] InitAccessors: Implement @storageRestrictions attribute printing
1 parent 8af81a3 commit cabc545

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

lib/AST/Attr.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1485,6 +1485,32 @@ bool DeclAttribute::printImpl(ASTPrinter &Printer, const PrintOptions &Options,
14851485
break;
14861486
}
14871487

1488+
case DAK_StorageRestrictions: {
1489+
auto *attr = cast<StorageRestrictionsAttr>(this);
1490+
Printer.printAttrName("@storageRestrictions");
1491+
Printer << "(";
1492+
1493+
auto initializes = attr->getInitializesNames();
1494+
auto accesses = attr->getAccessesNames();
1495+
1496+
bool needsComma = !initializes.empty() && !accesses.empty();
1497+
1498+
if (!initializes.empty()) {
1499+
Printer << "initializes: ";
1500+
interleave(initializes, Printer, ", ");
1501+
}
1502+
1503+
if (needsComma)
1504+
Printer << ", ";
1505+
1506+
if (!accesses.empty()) {
1507+
Printer << "accesses: ";
1508+
interleave(accesses, Printer, ", ");
1509+
}
1510+
Printer << ")";
1511+
break;
1512+
}
1513+
14881514
case DAK_Count:
14891515
llvm_unreachable("exceed declaration attribute kinds");
14901516

0 commit comments

Comments
 (0)