Stephen Hines | 651f13c | 2014-04-23 16:59:28 -0700 | [diff] [blame] | 1 | // RUN: %clang_cc1 -triple i386-unknown-unknown -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)); |
Stephen Hines | 651f13c | 2014-04-23 16:59:28 -0700 | [diff] [blame] | 10 | -(void) m2 __attribute__((stdcall)); |
| 11 | -(void) m3 __attribute__((optnone)); |
Daniel Dunbar | 3568249 | 2008-09-26 04:12:28 +0000 | [diff] [blame] | 12 | @end |
Fariborz Jahanian | 5d36ac2 | 2009-05-12 21:36:23 +0000 | [diff] [blame] | 13 | |
| 14 | |
| 15 | @interface INTF |
| 16 | - (int) foo1: (int)arg1 __attribute__((deprecated)); |
| 17 | |
Stephen Hines | 651f13c | 2014-04-23 16:59:28 -0700 | [diff] [blame] | 18 | - (int) foo: (int)arg1; |
Fariborz Jahanian | 5d36ac2 | 2009-05-12 21:36:23 +0000 | [diff] [blame] | 19 | |
Stephen Hines | 651f13c | 2014-04-23 16:59:28 -0700 | [diff] [blame] | 20 | - (int) foo2: (int)arg1 __attribute__((deprecated)) __attribute__((unavailable)); |
Fariborz Jahanian | 7fda400 | 2011-10-22 01:21:15 +0000 | [diff] [blame] | 21 | - (int) foo3: (int)arg1 __attribute__((deprecated)) __attribute__((unavailable)) __attribute__((ns_consumes_self)); |
Fariborz Jahanian | 5d36ac2 | 2009-05-12 21:36:23 +0000 | [diff] [blame] | 22 | @end |
| 23 | |
| 24 | @implementation INTF |
Stephen Hines | 651f13c | 2014-04-23 16:59:28 -0700 | [diff] [blame] | 25 | - (int) foo: (int)arg1 __attribute__((deprecated)){ |
Fariborz Jahanian | 5d36ac2 | 2009-05-12 21:36:23 +0000 | [diff] [blame] | 26 | return 10; |
| 27 | } |
| 28 | - (int) foo1: (int)arg1 { |
| 29 | return 10; |
| 30 | } |
Stephen Hines | 651f13c | 2014-04-23 16:59:28 -0700 | [diff] [blame] | 31 | - (int) foo2: (int)arg1 __attribute__((deprecated)) { |
Fariborz Jahanian | 5d36ac2 | 2009-05-12 21:36:23 +0000 | [diff] [blame] | 32 | return 10; |
| 33 | } |
Fariborz Jahanian | 7fda400 | 2011-10-22 01:21:15 +0000 | [diff] [blame] | 34 | - (int) foo3: (int)arg1 __attribute__((deprecated)) __attribute__((unavailable)) __attribute__((ns_consumes_self)) {return 0; } |
| 35 | - (void) dep __attribute__((deprecated)) { } // OK private methodn |
Fariborz Jahanian | 5d36ac2 | 2009-05-12 21:36:23 +0000 | [diff] [blame] | 36 | @end |
| 37 | |
Fariborz Jahanian | ec23678 | 2011-12-06 00:02:41 +0000 | [diff] [blame] | 38 | |
| 39 | // rdar://10529259 |
| 40 | #define IBAction void)__attribute__((ibaction) |
| 41 | |
| 42 | @interface Foo |
| 43 | - (void)doSomething1:(id)sender; |
Stephen Hines | 651f13c | 2014-04-23 16:59:28 -0700 | [diff] [blame] | 44 | - (void)doSomething2:(id)sender; |
Fariborz Jahanian | ec23678 | 2011-12-06 00:02:41 +0000 | [diff] [blame] | 45 | @end |
| 46 | |
| 47 | @implementation Foo |
| 48 | - (void)doSomething1:(id)sender{} |
| 49 | - (void)doSomething2:(id)sender{} |
| 50 | @end |
| 51 | |
| 52 | @interface Bar : Foo |
| 53 | - (IBAction)doSomething1:(id)sender; |
| 54 | @end |
| 55 | @implementation Bar |
| 56 | - (IBAction)doSomething1:(id)sender {} |
Stephen Hines | 651f13c | 2014-04-23 16:59:28 -0700 | [diff] [blame] | 57 | - (IBAction)doSomething2:(id)sender {} |
Fariborz Jahanian | ec23678 | 2011-12-06 00:02:41 +0000 | [diff] [blame] | 58 | - (IBAction)doSomething3:(id)sender {} |
| 59 | @end |
Fariborz Jahanian | 129a60b | 2012-08-24 23:50:13 +0000 | [diff] [blame] | 60 | |
| 61 | // rdar://11593375 |
| 62 | @interface NSObject @end |
| 63 | |
| 64 | @interface Test : NSObject |
| 65 | -(id)method __attribute__((deprecated)); |
| 66 | -(id)method1; |
| 67 | -(id)method2 __attribute__((aligned(16))); |
Stephen Hines | 651f13c | 2014-04-23 16:59:28 -0700 | [diff] [blame] | 68 | - (id) method3: (int)arg1 __attribute__((aligned(16))) __attribute__((deprecated)) __attribute__((unavailable)); |
Fariborz Jahanian | 129a60b | 2012-08-24 23:50:13 +0000 | [diff] [blame] | 69 | - (id) method4: (int)arg1 __attribute__((aligned(16))) __attribute__((deprecated)) __attribute__((unavailable)); |
| 70 | @end |
| 71 | |
| 72 | @implementation Test |
| 73 | -(id)method __attribute__((aligned(16))) __attribute__((aligned(16))) __attribute__((deprecated)) { |
| 74 | return self; |
| 75 | } |
| 76 | -(id)method1 __attribute__((aligned(16))) { |
| 77 | return self; |
| 78 | } |
| 79 | -(id)method2 { |
| 80 | return self; |
| 81 | } |
Stephen Hines | 651f13c | 2014-04-23 16:59:28 -0700 | [diff] [blame] | 82 | - (id) method3: (int)arg1 __attribute__((deprecated)) __attribute__((unavailable)) { |
Fariborz Jahanian | 129a60b | 2012-08-24 23:50:13 +0000 | [diff] [blame] | 83 | return self; |
| 84 | } |
| 85 | - (id) method4: (int)arg1 __attribute__((aligned(16))) __attribute__((deprecated)) __attribute__((unavailable)) { |
| 86 | return self; |
| 87 | } |
| 88 | @end |
Stephen Hines | 651f13c | 2014-04-23 16:59:28 -0700 | [diff] [blame] | 89 | |
| 90 | __attribute__((cdecl)) // expected-warning {{'cdecl' attribute only applies to functions and methods}} |
| 91 | @interface Complain |
| 92 | @end |
| 93 | |
| 94 | // rdar://15450637 |
| 95 | @interface rdar15450637 : NSObject |
| 96 | @property int p __attribute__((section("__TEXT,foo"))); |
| 97 | |
| 98 | - (id) IMethod :(int) count, ... __attribute__((section("__TEXT,foo"))); |
| 99 | |
| 100 | + (void) CMethod : (id) Obj __attribute__((section("__TEXT,fee"))); |
| 101 | @end |