Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -verify -fsyntax-only %s |
Daniel Dunbar | 3568249 | 2008-09-26 04:12:28 +0000 | [diff] [blame] | 2 | |
| 3 | @class NSString; |
| 4 | |
| 5 | @interface A |
| 6 | -t1 __attribute__((noreturn)); |
| 7 | - (NSString *)stringByAppendingFormat:(NSString *)format, ... __attribute__((format(__NSString__, 1, 2))); |
Daniel Dunbar | d3f2c10 | 2008-10-19 02:04:16 +0000 | [diff] [blame] | 8 | -(void) m0 __attribute__((noreturn)); |
| 9 | -(void) m1 __attribute__((unused)); |
Daniel Dunbar | 3568249 | 2008-09-26 04:12:28 +0000 | [diff] [blame] | 10 | @end |
Fariborz Jahanian | 5d36ac2 | 2009-05-12 21:36:23 +0000 | [diff] [blame] | 11 | |
| 12 | |
| 13 | @interface INTF |
| 14 | - (int) foo1: (int)arg1 __attribute__((deprecated)); |
| 15 | |
Fariborz Jahanian | ec23678 | 2011-12-06 00:02:41 +0000 | [diff] [blame] | 16 | - (int) foo: (int)arg1; // expected-note {{method declared here}} |
Fariborz Jahanian | 5d36ac2 | 2009-05-12 21:36:23 +0000 | [diff] [blame] | 17 | |
Fariborz Jahanian | ec23678 | 2011-12-06 00:02:41 +0000 | [diff] [blame] | 18 | - (int) foo2: (int)arg1 __attribute__((deprecated)) __attribute__((unavailable)); // expected-note {{method declared here}} |
Fariborz Jahanian | 7fda400 | 2011-10-22 01:21:15 +0000 | [diff] [blame] | 19 | - (int) foo3: (int)arg1 __attribute__((deprecated)) __attribute__((unavailable)) __attribute__((ns_consumes_self)); |
Fariborz Jahanian | 5d36ac2 | 2009-05-12 21:36:23 +0000 | [diff] [blame] | 20 | @end |
| 21 | |
| 22 | @implementation INTF |
Fariborz Jahanian | ec23678 | 2011-12-06 00:02:41 +0000 | [diff] [blame] | 23 | - (int) foo: (int)arg1 __attribute__((deprecated)){ // expected-warning {{attributes on method implementation and its declaration must match}} |
Fariborz Jahanian | 5d36ac2 | 2009-05-12 21:36:23 +0000 | [diff] [blame] | 24 | return 10; |
| 25 | } |
| 26 | - (int) foo1: (int)arg1 { |
| 27 | return 10; |
| 28 | } |
Fariborz Jahanian | ec23678 | 2011-12-06 00:02:41 +0000 | [diff] [blame] | 29 | - (int) foo2: (int)arg1 __attribute__((deprecated)) { // expected-warning {{attributes on method implementation and its declaration must match}} |
Fariborz Jahanian | 5d36ac2 | 2009-05-12 21:36:23 +0000 | [diff] [blame] | 30 | return 10; |
| 31 | } |
Fariborz Jahanian | 7fda400 | 2011-10-22 01:21:15 +0000 | [diff] [blame] | 32 | - (int) foo3: (int)arg1 __attribute__((deprecated)) __attribute__((unavailable)) __attribute__((ns_consumes_self)) {return 0; } |
| 33 | - (void) dep __attribute__((deprecated)) { } // OK private methodn |
Fariborz Jahanian | 5d36ac2 | 2009-05-12 21:36:23 +0000 | [diff] [blame] | 34 | @end |
| 35 | |
Fariborz Jahanian | ec23678 | 2011-12-06 00:02:41 +0000 | [diff] [blame] | 36 | |
| 37 | // rdar://10529259 |
| 38 | #define IBAction void)__attribute__((ibaction) |
| 39 | |
| 40 | @interface Foo |
| 41 | - (void)doSomething1:(id)sender; |
| 42 | - (void)doSomething2:(id)sender; // expected-note {{method declared here}} |
| 43 | @end |
| 44 | |
| 45 | @implementation Foo |
| 46 | - (void)doSomething1:(id)sender{} |
| 47 | - (void)doSomething2:(id)sender{} |
| 48 | @end |
| 49 | |
| 50 | @interface Bar : Foo |
| 51 | - (IBAction)doSomething1:(id)sender; |
| 52 | @end |
| 53 | @implementation Bar |
| 54 | - (IBAction)doSomething1:(id)sender {} |
| 55 | - (IBAction)doSomething2:(id)sender {} // expected-warning {{attributes on method implementation and its declaration must match}} |
| 56 | - (IBAction)doSomething3:(id)sender {} |
| 57 | @end |