blob: 1b0a900da81d79c9fbf07d5ab0984ebbd03ef9ce [file] [log] [blame]
Stephen Hines651f13c2014-04-23 16:59:28 -07001// RUN: %clang_cc1 -triple i386-unknown-unknown -verify -fsyntax-only -Wno-objc-root-class %s
Daniel Dunbar35682492008-09-26 04:12:28 +00002
3@class NSString;
4
5@interface A
6-t1 __attribute__((noreturn));
7- (NSString *)stringByAppendingFormat:(NSString *)format, ... __attribute__((format(__NSString__, 1, 2)));
Daniel Dunbard3f2c102008-10-19 02:04:16 +00008-(void) m0 __attribute__((noreturn));
9-(void) m1 __attribute__((unused));
Stephen Hines651f13c2014-04-23 16:59:28 -070010-(void) m2 __attribute__((stdcall));
11-(void) m3 __attribute__((optnone));
Daniel Dunbar35682492008-09-26 04:12:28 +000012@end
Fariborz Jahanian5d36ac22009-05-12 21:36:23 +000013
14
15@interface INTF
16- (int) foo1: (int)arg1 __attribute__((deprecated));
17
Stephen Hines651f13c2014-04-23 16:59:28 -070018- (int) foo: (int)arg1;
Fariborz Jahanian5d36ac22009-05-12 21:36:23 +000019
Stephen Hines651f13c2014-04-23 16:59:28 -070020- (int) foo2: (int)arg1 __attribute__((deprecated)) __attribute__((unavailable));
Fariborz Jahanian7fda4002011-10-22 01:21:15 +000021- (int) foo3: (int)arg1 __attribute__((deprecated)) __attribute__((unavailable)) __attribute__((ns_consumes_self));
Fariborz Jahanian5d36ac22009-05-12 21:36:23 +000022@end
23
24@implementation INTF
Stephen Hines651f13c2014-04-23 16:59:28 -070025- (int) foo: (int)arg1 __attribute__((deprecated)){
Fariborz Jahanian5d36ac22009-05-12 21:36:23 +000026 return 10;
27}
28- (int) foo1: (int)arg1 {
29 return 10;
30}
Stephen Hines651f13c2014-04-23 16:59:28 -070031- (int) foo2: (int)arg1 __attribute__((deprecated)) {
Fariborz Jahanian5d36ac22009-05-12 21:36:23 +000032 return 10;
33}
Fariborz Jahanian7fda4002011-10-22 01:21:15 +000034- (int) foo3: (int)arg1 __attribute__((deprecated)) __attribute__((unavailable)) __attribute__((ns_consumes_self)) {return 0; }
35- (void) dep __attribute__((deprecated)) { } // OK private methodn
Fariborz Jahanian5d36ac22009-05-12 21:36:23 +000036@end
37
Fariborz Jahanianec236782011-12-06 00:02:41 +000038
39// rdar://10529259
40#define IBAction void)__attribute__((ibaction)
41
42@interface Foo
43- (void)doSomething1:(id)sender;
Stephen Hines651f13c2014-04-23 16:59:28 -070044- (void)doSomething2:(id)sender;
Fariborz Jahanianec236782011-12-06 00:02:41 +000045@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 Hines651f13c2014-04-23 16:59:28 -070057- (IBAction)doSomething2:(id)sender {}
Fariborz Jahanianec236782011-12-06 00:02:41 +000058- (IBAction)doSomething3:(id)sender {}
59@end
Fariborz Jahanian129a60b2012-08-24 23:50:13 +000060
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 Hines651f13c2014-04-23 16:59:28 -070068- (id) method3: (int)arg1 __attribute__((aligned(16))) __attribute__((deprecated)) __attribute__((unavailable));
Fariborz Jahanian129a60b2012-08-24 23:50:13 +000069- (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 Hines651f13c2014-04-23 16:59:28 -070082- (id) method3: (int)arg1 __attribute__((deprecated)) __attribute__((unavailable)) {
Fariborz Jahanian129a60b2012-08-24 23:50:13 +000083 return self;
84}
85- (id) method4: (int)arg1 __attribute__((aligned(16))) __attribute__((deprecated)) __attribute__((unavailable)) {
86 return self;
87}
88@end
Stephen Hines651f13c2014-04-23 16:59:28 -070089
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