@@ -1150,6 +1150,8 @@ void PrintAST::printAttributes(const Decl *D) {
11501150 if (Options.SkipAttributes )
11511151 return ;
11521152
1153+ auto attrs = D->getSemanticAttrs ();
1154+
11531155 // Save the current number of exclude attrs to restore once we're done.
11541156 unsigned originalExcludeAttrCount = Options.ExcludeAttrList .size ();
11551157
@@ -1205,7 +1207,7 @@ void PrintAST::printAttributes(const Decl *D) {
12051207 // If the declaration is implicitly @objc, print the attribute now.
12061208 if (auto VD = dyn_cast<ValueDecl>(D)) {
12071209 if (VD->isObjC () && !isa<EnumElementDecl>(VD) &&
1208- !VD-> getAttrs () .hasAttribute <ObjCAttr>()) {
1210+ !attrs .hasAttribute <ObjCAttr>()) {
12091211 Printer.printAttrName (" @objc" );
12101212 Printer << " " ;
12111213 }
@@ -1235,13 +1237,13 @@ void PrintAST::printAttributes(const Decl *D) {
12351237 Options.ExcludeAttrList .push_back (DAK_Borrowing);
12361238 }
12371239
1238- D-> getAttrs () .print (Printer, Options, D);
1240+ attrs .print (Printer, Options, D);
12391241
12401242 // Print the implicit 'final' attribute.
12411243 if (auto VD = dyn_cast<ValueDecl>(D)) {
12421244 auto VarD = dyn_cast<VarDecl>(D);
12431245 if (VD->isFinal () &&
1244- !VD-> getAttrs () .hasAttribute <FinalAttr>() &&
1246+ !attrs .hasAttribute <FinalAttr>() &&
12451247 // Don't print a redundant 'final' if printing a 'let' or 'static' decl.
12461248 !(VarD && VarD->isLet ()) &&
12471249 getCorrectStaticSpelling (D) != StaticSpellingKind::KeywordStatic &&
0 commit comments