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