Patrick Beard | b2f6820 | 2012-04-06 18:12:22 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -verify -fsyntax-only -Wno-objc-root-class %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 | |
Ted Kremenek | 3306ec1 | 2012-02-27 22:55:11 +0000 | [diff] [blame] | 16 | - (int) foo: (int)arg1; // expected-note {{method 'foo:' declared here}} |
Fariborz Jahanian | 5d36ac2 | 2009-05-12 21:36:23 +0000 | [diff] [blame] | 17 | |
Ted Kremenek | 3306ec1 | 2012-02-27 22:55:11 +0000 | [diff] [blame] | 18 | - (int) foo2: (int)arg1 __attribute__((deprecated)) __attribute__((unavailable)); // expected-note {{method 'foo2:' 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; |
Ted Kremenek | 3306ec1 | 2012-02-27 22:55:11 +0000 | [diff] [blame] | 42 | - (void)doSomething2:(id)sender; // expected-note {{method 'doSomething2:' declared here}} |
Fariborz Jahanian | ec23678 | 2011-12-06 00:02:41 +0000 | [diff] [blame] | 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 |
Fariborz Jahanian | 129a60b | 2012-08-24 23:50:13 +0000 | [diff] [blame] | 58 | |
| 59 | // rdar://11593375 |
| 60 | @interface NSObject @end |
| 61 | |
| 62 | @interface Test : NSObject |
| 63 | -(id)method __attribute__((deprecated)); |
| 64 | -(id)method1; |
| 65 | -(id)method2 __attribute__((aligned(16))); |
| 66 | - (id) method3: (int)arg1 __attribute__((aligned(16))) __attribute__((deprecated)) __attribute__((unavailable)); // expected-note {{method 'method3:' declared here}} |
| 67 | - (id) method4: (int)arg1 __attribute__((aligned(16))) __attribute__((deprecated)) __attribute__((unavailable)); |
| 68 | @end |
| 69 | |
| 70 | @implementation Test |
| 71 | -(id)method __attribute__((aligned(16))) __attribute__((aligned(16))) __attribute__((deprecated)) { |
| 72 | return self; |
| 73 | } |
| 74 | -(id)method1 __attribute__((aligned(16))) { |
| 75 | return self; |
| 76 | } |
| 77 | -(id)method2 { |
| 78 | return self; |
| 79 | } |
| 80 | - (id) method3: (int)arg1 __attribute__((deprecated)) __attribute__((unavailable)) { // expected-warning {{attributes on method implementation and its declaration must match}} |
| 81 | return self; |
| 82 | } |
| 83 | - (id) method4: (int)arg1 __attribute__((aligned(16))) __attribute__((deprecated)) __attribute__((unavailable)) { |
| 84 | return self; |
| 85 | } |
| 86 | @end |