xref: /llvm-project/clang/test/Parser/attributes.mm (revision c5a0583400b71f81faf9dedfaab094720c2ef823)
104e213b6SNico Weber// RUN: %clang_cc1 -verify -fsyntax-only -Wno-objc-root-class %s
204e213b6SNico Weber
3*c5a05834SErik Pilkington// FIXME: Why isn't this supported? Seems useful for availability attributes at
4*c5a05834SErik Pilkington// the very least.
5*c5a05834SErik Pilkington__attribute__((deprecated)) @class B; // expected-error {{prefix attribute must be followed by an interface, protocol, or implementation}}
604e213b6SNico Weber
704e213b6SNico Weber__attribute__((deprecated)) @interface A @end
804e213b6SNico Weber__attribute__((deprecated)) @protocol P0;
904e213b6SNico Weber__attribute__((deprecated)) @protocol P1
1004e213b6SNico Weber@end
1104e213b6SNico Weber
1204e213b6SNico Weber#define EXP __attribute__((visibility("default")))
1304e213b6SNico Weberclass EXP C {};
1404e213b6SNico WeberEXP class C2 {}; // expected-warning {{attribute 'visibility' is ignored, place it after "class" to apply attribute to type declaration}}
1504e213b6SNico Weber
1669a7914fSNico Weber@interface EXP I @end // expected-error {{postfix attributes are not allowed on Objective-C directives, place them in front of '@interface'}}
1704e213b6SNico WeberEXP @interface I2 @end
1804e213b6SNico Weber
196ed72516SAlp Toker@implementation EXP I @end // expected-error-re {{postfix attributes are not allowed on Objective-C directives{{$}}}}
20*c5a05834SErik PilkingtonEXP @implementation I2 @end
2104e213b6SNico Weber
226ed72516SAlp Toker@class EXP OC; // expected-error-re {{postfix attributes are not allowed on Objective-C directives{{$}}}}
23*c5a05834SErik PilkingtonEXP @class OC2; // expected-error {{prefix attribute must be followed by an interface, protocol, or implementation}}
2404e213b6SNico Weber
2569a7914fSNico Weber@protocol EXP P @end // expected-error {{postfix attributes are not allowed on Objective-C directives, place them in front of '@protocol'}}
2604e213b6SNico WeberEXP @protocol P2 @end
27