1// RUN: %clang_cc1  -fsyntax-only -verify -Wno-objc-root-class %s
2// rdar://16462586
3
4__attribute__((objc_runtime_name)) // expected-error {{'objc_runtime_name' attribute takes one argument}}
5@interface BInterface
6@end
7
8__attribute__((objc_runtime_name(123))) // expected-error {{'objc_runtime_name' attribute requires a string}}
9@protocol BProtocol1
10@end
11
12__attribute__((objc_runtime_name("MySecretNamespace.Protocol")))
13@protocol Protocol
14@end
15
16__attribute__((objc_runtime_name("MySecretNamespace.Message")))
17@interface Message <Protocol> {
18__attribute__((objc_runtime_name("MySecretNamespace.Message"))) // expected-error {{'objc_runtime_name' attribute only applies to Objective-C interfaces and Objective-C protocols}}
19  id MyIVAR;
20}
21__attribute__((objc_runtime_name("MySecretNamespace.Message")))
22@property int MyProperty; // expected-error {{prefix attribute must be followed by an interface, protocol, or implementation}}}}
23
24- (int) getMyProperty __attribute__((objc_runtime_name("MySecretNamespace.Message"))); // expected-error {{'objc_runtime_name' attribute only applies to}}
25
26- (void) setMyProperty : (int) arg __attribute__((objc_runtime_name("MySecretNamespace.Message"))); // expected-error {{'objc_runtime_name' attribute only applies to}}
27
28@end
29
30__attribute__((objc_runtime_name("MySecretNamespace.ForwardClass")))
31@class ForwardClass; // expected-error {{prefix attribute must be followed by an interface, protocol, or implementation}}
32
33__attribute__((objc_runtime_name("MySecretNamespace.ForwardProtocol")))
34@protocol ForwardProtocol;
35
36@implementation Message
37// expected-error@+1 {{'objc_runtime_name' attribute only applies to Objective-C interfaces and Objective-C protocols}}
38- (id) MyMethod __attribute__((objc_runtime_name("MySecretNamespace.Message"))) {
39  return MyIVAR;
40}
41
42-(int)getMyProperty { return 0; }
43-(void)setMyProperty:(int)arg {}
44@end
45
46@interface NoImpl @end
47
48// expected-error@+1 {{'objc_runtime_name' attribute only applies to Objective-C interfaces and Objective-C protocols}}
49__attribute__((objc_runtime_name("MySecretNamespace.Message")))
50@implementation NoImpl @end
51