Nico Weber | 9f4f5f1 | 2013-04-03 17:36:11 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -verify -fsyntax-only -Wno-objc-root-class %s |
| 2 | |
| 3 | __attribute__((deprecated)) @class B; // expected-error {{prefix attribute must be followed by an interface or protocol}} |
| 4 | |
| 5 | __attribute__((deprecated)) @interface A @end |
| 6 | __attribute__((deprecated)) @protocol P0; |
| 7 | __attribute__((deprecated)) @protocol P1 |
| 8 | @end |
| 9 | |
| 10 | #define EXP __attribute__((visibility("default"))) |
| 11 | class EXP C {}; |
| 12 | EXP class C2 {}; // expected-warning {{attribute 'visibility' is ignored, place it after "class" to apply attribute to type declaration}} |
| 13 | |
Nico Weber | e145bfd | 2013-04-04 00:15:10 +0000 | [diff] [blame] | 14 | @interface EXP I @end // expected-error {{postfix attributes are not allowed on Objective-C directives, place them in front of '@interface'}} |
Nico Weber | 9f4f5f1 | 2013-04-03 17:36:11 +0000 | [diff] [blame] | 15 | EXP @interface I2 @end |
| 16 | |
Nico Weber | e145bfd | 2013-04-04 00:15:10 +0000 | [diff] [blame] | 17 | @implementation EXP I @end // expected-error-re {{postfix attributes are not allowed on Objective-C directives$}} |
Nico Weber | 9f4f5f1 | 2013-04-03 17:36:11 +0000 | [diff] [blame] | 18 | // FIXME: Prefix attribute recovery skips until ';' |
Nico Weber | e145bfd | 2013-04-04 00:15:10 +0000 | [diff] [blame] | 19 | EXP @implementation I2 @end; // expected-error {{prefix attribute must be followed by an interface or protocol}} |
Nico Weber | 9f4f5f1 | 2013-04-03 17:36:11 +0000 | [diff] [blame] | 20 | |
Nico Weber | e145bfd | 2013-04-04 00:15:10 +0000 | [diff] [blame] | 21 | @class EXP OC; // expected-error-re {{postfix attributes are not allowed on Objective-C directives$}} |
Nico Weber | 9f4f5f1 | 2013-04-03 17:36:11 +0000 | [diff] [blame] | 22 | EXP @class OC2; // expected-error {{prefix attribute must be followed by an interface or protocol}} |
| 23 | |
Nico Weber | e145bfd | 2013-04-04 00:15:10 +0000 | [diff] [blame] | 24 | @protocol EXP P @end // expected-error {{postfix attributes are not allowed on Objective-C directives, place them in front of '@protocol'}} |
Nico Weber | 9f4f5f1 | 2013-04-03 17:36:11 +0000 | [diff] [blame] | 25 | EXP @protocol P2 @end |