@@ -1150,6 +1150,8 @@ void PrintAST::printAttributes(const Decl *D) {
1150
1150
if (Options.SkipAttributes )
1151
1151
return ;
1152
1152
1153
+ auto attrs = D->getSemanticAttrs ();
1154
+
1153
1155
// Save the current number of exclude attrs to restore once we're done.
1154
1156
unsigned originalExcludeAttrCount = Options.ExcludeAttrList .size ();
1155
1157
@@ -1205,7 +1207,7 @@ void PrintAST::printAttributes(const Decl *D) {
1205
1207
// If the declaration is implicitly @objc, print the attribute now.
1206
1208
if (auto VD = dyn_cast<ValueDecl>(D)) {
1207
1209
if (VD->isObjC () && !isa<EnumElementDecl>(VD) &&
1208
- !VD-> getAttrs () .hasAttribute <ObjCAttr>()) {
1210
+ !attrs .hasAttribute <ObjCAttr>()) {
1209
1211
Printer.printAttrName (" @objc" );
1210
1212
Printer << " " ;
1211
1213
}
@@ -1235,13 +1237,13 @@ void PrintAST::printAttributes(const Decl *D) {
1235
1237
Options.ExcludeAttrList .push_back (DAK_Borrowing);
1236
1238
}
1237
1239
1238
- D-> getAttrs () .print (Printer, Options, D);
1240
+ attrs .print (Printer, Options, D);
1239
1241
1240
1242
// Print the implicit 'final' attribute.
1241
1243
if (auto VD = dyn_cast<ValueDecl>(D)) {
1242
1244
auto VarD = dyn_cast<VarDecl>(D);
1243
1245
if (VD->isFinal () &&
1244
- !VD-> getAttrs () .hasAttribute <FinalAttr>() &&
1246
+ !attrs .hasAttribute <FinalAttr>() &&
1245
1247
// Don't print a redundant 'final' if printing a 'let' or 'static' decl.
1246
1248
!(VarD && VarD->isLet ()) &&
1247
1249
getCorrectStaticSpelling (D) != StaticSpellingKind::KeywordStatic &&
0 commit comments