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