| 1 |
// RUN: %clang_cc1 -verify %s \ |
| 2 |
// RUN: -fblocks -fobjc-exceptions -fexceptions -fsyntax-only \ |
| 3 |
// RUN: -Wno-unused-value -Wno-unused-getter-return-value |
| 4 |
|
| 5 |
#if !__has_extension(statement_attributes_with_gnu_syntax) |
| 6 |
#error "We should have statement attributes with GNU syntax support" |
| 7 |
#endif |
| 8 |
|
| 9 |
@interface Base |
| 10 |
@end |
| 11 |
|
| 12 |
@interface Test : Base |
| 13 |
@property(getter=hasFoobar) int foobar; |
| 14 |
- (void)foo; |
| 15 |
- (void)bar; |
| 16 |
@end |
| 17 |
|
| 18 |
Test *getTest(void); |
| 19 |
|
| 20 |
@implementation Test |
| 21 |
- (void)foo __attribute__((nomerge)) { |
| 22 |
// expected-error@-1 {{'nomerge' attribute only applies to functions, statements and variables}} |
| 23 |
} |
| 24 |
|
| 25 |
- (void)bar { |
| 26 |
__attribute__(()) [self foo]; |
| 27 |
// expected-error@-1 {{missing '[' at start of message send expression}} |
| 28 |
// expected-error@-2 {{expected ']'}} |
| 29 |
// expected-error@-3 {{expected identifier or '('}} |
| 30 |
// expected-note@-4 {{to match this '['}} |
| 31 |
__attribute__((nomerge)) [self foo]; |
| 32 |
// expected-warning@-1 {{'nomerge' attribute is ignored because there exists no call expression inside the statement}} |
| 33 |
__attribute__((nomerge)) [getTest() foo]; |
| 34 |
|
| 35 |
__attribute__(()) ^{}; |
| 36 |
// expected-error@-1 {{expected identifier or '('}} |
| 37 |
__attribute__((nomerge)) ^{}; |
| 38 |
// expected-warning@-1 {{'nomerge' attribute is ignored because there exists no call expression inside the statement}} |
| 39 |
__attribute__((nomerge)) ^{ [self foo]; }(); |
| 40 |
|
| 41 |
__attribute__(()) @try { |
| 42 |
[self foo]; |
| 43 |
} @finally { |
| 44 |
} |
| 45 |
|
| 46 |
__attribute__((nomerge)) @try { |
| 47 |
[getTest() foo]; |
| 48 |
} @finally { |
| 49 |
} |
| 50 |
|
| 51 |
__attribute__((nomerge)) (__bridge void *)self; |
| 52 |
// expected-warning@-1 {{'nomerge' attribute is ignored because there exists no call expression inside the statement}} |
| 53 |
|
| 54 |
__attribute__((nomerge)) self.hasFoobar; |
| 55 |
// expected-warning@-1 {{'nomerge' attribute is ignored because there exists no call expression inside the statement}} |
| 56 |
} |
| 57 |
@end |