Fariborz Jahanian | a2e5deb | 2014-07-16 19:44:34 +0000 | [diff] [blame] | 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> { |
Aaron Ballman | adf66b6 | 2017-11-26 20:01:12 +0000 | [diff] [blame] | 18 | __attribute__((objc_runtime_name("MySecretNamespace.Message"))) // expected-error {{'objc_runtime_name' attribute only applies to Objective-C interfaces and Objective-C protocols}} |
Fariborz Jahanian | a2e5deb | 2014-07-16 19:44:34 +0000 | [diff] [blame] | 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 or protocol}}}} |
| 23 | |
Aaron Ballman | adf66b6 | 2017-11-26 20:01:12 +0000 | [diff] [blame] | 24 | - (int) getMyProperty __attribute__((objc_runtime_name("MySecretNamespace.Message"))); // expected-error {{'objc_runtime_name' attribute only applies to}} |
Fariborz Jahanian | a2e5deb | 2014-07-16 19:44:34 +0000 | [diff] [blame] | 25 | |
Aaron Ballman | adf66b6 | 2017-11-26 20:01:12 +0000 | [diff] [blame] | 26 | - (void) setMyProperty : (int) arg __attribute__((objc_runtime_name("MySecretNamespace.Message"))); // expected-error {{'objc_runtime_name' attribute only applies to}} |
Fariborz Jahanian | a2e5deb | 2014-07-16 19:44:34 +0000 | [diff] [blame] | 27 | |
| 28 | @end |
| 29 | |
| 30 | __attribute__((objc_runtime_name("MySecretNamespace.ForwardClass"))) |
| 31 | @class ForwardClass; // expected-error {{prefix attribute must be followed by an interface or protocol}} |
| 32 | |
| 33 | __attribute__((objc_runtime_name("MySecretNamespace.ForwardProtocol"))) |
| 34 | @protocol ForwardProtocol; |
| 35 | |
| 36 | __attribute__((objc_runtime_name("MySecretNamespace.Message"))) |
| 37 | @implementation Message // expected-error {{prefix attribute must be followed by an interface or protocol}} |
| 38 | __attribute__((objc_runtime_name("MySecretNamespace.Message"))) |
| 39 | - (id) MyMethod { |
| 40 | return MyIVAR; |
| 41 | } |
| 42 | @end |