[Clang][AST] Print attributes of Obj-C interfaces

When pretty printing an Objective-C interface declaration, Clang
previously didn't print any attributes that are applied to the
declaration.
This commit is contained in:
Egor Zhdan 2024-03-11 18:47:30 +00:00 committed by GitHub
parent b4e0890458
commit a8eb2f0dab
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 0 deletions

View File

@ -1517,6 +1517,11 @@ void DeclPrinter::VisitObjCInterfaceDecl(ObjCInterfaceDecl *OID) {
return;
}
bool eolnOut = false;
if (OID->hasAttrs()) {
prettyPrintAttributes(OID);
Out << "\n";
}
Out << "@interface " << I;
if (auto TypeParams = OID->getTypeParamListAsWritten()) {

View File

@ -21,6 +21,10 @@
- (void)methodWithArg:(int)x andAnotherOne:(int)y { }
@end
__attribute__((availability(macosx,introduced=10.1.0,deprecated=10.2)))
@interface InterfaceWithAttribute
@end
// CHECK: @protocol P
// CHECK: - (void)MethP __attribute__((availability(macos, introduced=10.1.0, deprecated=10.2)));
// CHECK: @end
@ -45,6 +49,10 @@
// CHECK: @end
// CHECK: __attribute__((availability(macos, introduced=10.1.0, deprecated=10.2)))
// CHECK: @interface InterfaceWithAttribute
// CHECK: @end
@class C1;
struct __attribute__((objc_bridge_related(C1,,))) S1;