xref: /aosp_15_r20/external/clang/test/Parser/attributes.mm (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li// RUN: %clang_cc1 -verify -fsyntax-only -Wno-objc-root-class %s
2*67e74705SXin Li
3*67e74705SXin Li__attribute__((deprecated)) @class B; // expected-error {{prefix attribute must be followed by an interface or protocol}}
4*67e74705SXin Li
5*67e74705SXin Li__attribute__((deprecated)) @interface A @end
6*67e74705SXin Li__attribute__((deprecated)) @protocol P0;
7*67e74705SXin Li__attribute__((deprecated)) @protocol P1
8*67e74705SXin Li@end
9*67e74705SXin Li
10*67e74705SXin Li#define EXP __attribute__((visibility("default")))
11*67e74705SXin Liclass EXP C {};
12*67e74705SXin LiEXP class C2 {}; // expected-warning {{attribute 'visibility' is ignored, place it after "class" to apply attribute to type declaration}}
13*67e74705SXin Li
14*67e74705SXin Li@interface EXP I @end // expected-error {{postfix attributes are not allowed on Objective-C directives, place them in front of '@interface'}}
15*67e74705SXin LiEXP @interface I2 @end
16*67e74705SXin Li
17*67e74705SXin Li@implementation EXP I @end // expected-error-re {{postfix attributes are not allowed on Objective-C directives{{$}}}}
18*67e74705SXin Li// FIXME: Prefix attribute recovery skips until ';'
19*67e74705SXin LiEXP @implementation I2 @end; // expected-error {{prefix attribute must be followed by an interface or protocol}}
20*67e74705SXin Li
21*67e74705SXin Li@class EXP OC; // expected-error-re {{postfix attributes are not allowed on Objective-C directives{{$}}}}
22*67e74705SXin LiEXP @class OC2; // expected-error {{prefix attribute must be followed by an interface or protocol}}
23*67e74705SXin Li
24*67e74705SXin Li@protocol EXP P @end // expected-error {{postfix attributes are not allowed on Objective-C directives, place them in front of '@protocol'}}
25*67e74705SXin LiEXP @protocol P2 @end
26