Skip to content

Commit f9b904f

Browse files
committed
Implement printing of @safe(unchecked) attribute
1 parent 1c4442f commit f9b904f

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

lib/AST/Attr.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1598,6 +1598,18 @@ bool DeclAttribute::printImpl(ASTPrinter &Printer, const PrintOptions &Options,
15981598
break;
15991599
}
16001600

1601+
case DeclAttrKind::Safe: {
1602+
auto *attr = cast<SafeAttr>(this);
1603+
Printer.printAttrName("@safe");
1604+
Printer << "(unchecked";
1605+
if (!attr->message.empty()) {
1606+
Printer << ", message: ";
1607+
Printer.printEscapedStringLiteral(attr->message);
1608+
}
1609+
Printer << ")";
1610+
break;
1611+
}
1612+
16011613
#define SIMPLE_DECL_ATTR(X, CLASS, ...) case DeclAttrKind::CLASS:
16021614
#include "swift/AST/DeclAttr.def"
16031615
llvm_unreachable("handled above");

0 commit comments

Comments
 (0)