xref: /aosp_15_r20/external/clang/test/CodeGenObjC/objc-asm-attribute-neg-test.m (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li// RUN: %clang_cc1  -fsyntax-only -verify -Wno-objc-root-class %s
2*67e74705SXin Li// rdar://16462586
3*67e74705SXin Li
4*67e74705SXin Li__attribute__((objc_runtime_name("MySecretNamespace.Protocol")))
5*67e74705SXin Li@protocol Protocol
6*67e74705SXin Li@end
7*67e74705SXin Li
8*67e74705SXin Li__attribute__((objc_runtime_name("MySecretNamespace.Message")))
9*67e74705SXin Li@interface Message <Protocol> {
10*67e74705SXin Li__attribute__((objc_runtime_name("MySecretNamespace.Message"))) // expected-error {{'objc_runtime_name' attribute only applies to interface or protocol declarations}}
11*67e74705SXin Li  id MyIVAR;
12*67e74705SXin Li}
13*67e74705SXin Li__attribute__((objc_runtime_name("MySecretNamespace.Message")))
14*67e74705SXin Li@property int MyProperty; // expected-error {{prefix attribute must be followed by an interface or protocol}}}}
15*67e74705SXin Li
16*67e74705SXin Li- (int) getMyProperty __attribute__((objc_runtime_name("MySecretNamespace.Message"))); // expected-error {{'objc_runtime_name' attribute only applies to interface or protocol declarations}}
17*67e74705SXin Li
18*67e74705SXin Li- (void) setMyProperty : (int) arg __attribute__((objc_runtime_name("MySecretNamespace.Message"))); // expected-error {{'objc_runtime_name' attribute only applies to interface or protocol declarations}}
19*67e74705SXin Li
20*67e74705SXin Li@end
21*67e74705SXin Li
22*67e74705SXin Li__attribute__((objc_runtime_name("MySecretNamespace.ForwardClass")))
23*67e74705SXin Li@class ForwardClass; // expected-error {{prefix attribute must be followed by an interface or protocol}}
24*67e74705SXin Li
25*67e74705SXin Li__attribute__((objc_runtime_name("MySecretNamespace.ForwardProtocol")))
26*67e74705SXin Li@protocol ForwardProtocol;
27*67e74705SXin Li
28*67e74705SXin Li__attribute__((objc_runtime_name("MySecretNamespace.Message")))
29*67e74705SXin Li@implementation Message // expected-error {{prefix attribute must be followed by an interface or protocol}}
30*67e74705SXin Li__attribute__((objc_runtime_name("MySecretNamespace.Message")))
31*67e74705SXin Li- (id) MyMethod {
32*67e74705SXin Li  return MyIVAR;
33*67e74705SXin Li}
34*67e74705SXin Li@end
35