blob: c740ebb6fd6e35632cf733b97408226d61fd3869 [file] [log] [blame]
Aaron Ballman2950cbb2013-11-19 04:25:20 +00001// RUN: %clang_cc1 -triple i386-unknown-unknown -verify -fsyntax-only -Wno-objc-root-class %s
Daniel Dunbarc136e0c2008-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 Dunbar70e3eba2008-10-19 02:04:16 +00008-(void) m0 __attribute__((noreturn));
9-(void) m1 __attribute__((unused));
Aaron Ballmanb8f67f22013-11-19 04:08:34 +000010-(void) m2 __attribute__((stdcall));
Daniel Dunbarc136e0c2008-09-26 04:12:28 +000011@end
Fariborz Jahanian2bd617c2009-05-12 21:36:23 +000012
13
14@interface INTF
15- (int) foo1: (int)arg1 __attribute__((deprecated));
16
Fariborz Jahanian36129a92013-11-23 00:14:32 +000017- (int) foo: (int)arg1;
Fariborz Jahanian2bd617c2009-05-12 21:36:23 +000018
Fariborz Jahanian36129a92013-11-23 00:14:32 +000019- (int) foo2: (int)arg1 __attribute__((deprecated)) __attribute__((unavailable));
Fariborz Jahanian512a4cc92011-10-22 01:21:15 +000020- (int) foo3: (int)arg1 __attribute__((deprecated)) __attribute__((unavailable)) __attribute__((ns_consumes_self));
Fariborz Jahanian2bd617c2009-05-12 21:36:23 +000021@end
22
23@implementation INTF
Fariborz Jahanian36129a92013-11-23 00:14:32 +000024- (int) foo: (int)arg1 __attribute__((deprecated)){
Fariborz Jahanian2bd617c2009-05-12 21:36:23 +000025 return 10;
26}
27- (int) foo1: (int)arg1 {
28 return 10;
29}
Fariborz Jahanian36129a92013-11-23 00:14:32 +000030- (int) foo2: (int)arg1 __attribute__((deprecated)) {
Fariborz Jahanian2bd617c2009-05-12 21:36:23 +000031 return 10;
32}
Fariborz Jahanian512a4cc92011-10-22 01:21:15 +000033- (int) foo3: (int)arg1 __attribute__((deprecated)) __attribute__((unavailable)) __attribute__((ns_consumes_self)) {return 0; }
34- (void) dep __attribute__((deprecated)) { } // OK private methodn
Fariborz Jahanian2bd617c2009-05-12 21:36:23 +000035@end
36
Fariborz Jahanian56f326e2011-12-06 00:02:41 +000037
38// rdar://10529259
39#define IBAction void)__attribute__((ibaction)
40
41@interface Foo
42- (void)doSomething1:(id)sender;
Fariborz Jahanian36129a92013-11-23 00:14:32 +000043- (void)doSomething2:(id)sender;
Fariborz Jahanian56f326e2011-12-06 00:02:41 +000044@end
45
46@implementation Foo
47- (void)doSomething1:(id)sender{}
48- (void)doSomething2:(id)sender{}
49@end
50
51@interface Bar : Foo
52- (IBAction)doSomething1:(id)sender;
53@end
54@implementation Bar
55- (IBAction)doSomething1:(id)sender {}
Fariborz Jahanian36129a92013-11-23 00:14:32 +000056- (IBAction)doSomething2:(id)sender {}
Fariborz Jahanian56f326e2011-12-06 00:02:41 +000057- (IBAction)doSomething3:(id)sender {}
58@end
Fariborz Jahanian1cfbe7a2012-08-24 23:50:13 +000059
60// rdar://11593375
61@interface NSObject @end
62
63@interface Test : NSObject
64-(id)method __attribute__((deprecated));
65-(id)method1;
66-(id)method2 __attribute__((aligned(16)));
Fariborz Jahanian36129a92013-11-23 00:14:32 +000067- (id) method3: (int)arg1 __attribute__((aligned(16))) __attribute__((deprecated)) __attribute__((unavailable));
Fariborz Jahanian1cfbe7a2012-08-24 23:50:13 +000068- (id) method4: (int)arg1 __attribute__((aligned(16))) __attribute__((deprecated)) __attribute__((unavailable));
69@end
70
71@implementation Test
72-(id)method __attribute__((aligned(16))) __attribute__((aligned(16))) __attribute__((deprecated)) {
73 return self;
74}
75-(id)method1 __attribute__((aligned(16))) {
76 return self;
77}
78-(id)method2 {
79 return self;
80}
Fariborz Jahanian36129a92013-11-23 00:14:32 +000081- (id) method3: (int)arg1 __attribute__((deprecated)) __attribute__((unavailable)) {
Fariborz Jahanian1cfbe7a2012-08-24 23:50:13 +000082 return self;
83}
84- (id) method4: (int)arg1 __attribute__((aligned(16))) __attribute__((deprecated)) __attribute__((unavailable)) {
85 return self;
86}
87@end
Aaron Ballmanb8f67f22013-11-19 04:08:34 +000088
89__attribute__((cdecl)) // expected-warning {{'cdecl' attribute only applies to functions and methods}}
90@interface Complain
91@end
Fariborz Jahanian4b7946a2013-12-19 17:22:23 +000092
93// rdar://15450637
94@interface rdar15450637 : NSObject
95@property int p __attribute__((section("__TEXT,foo")));
96
97- (id) IMethod :(int) count, ... __attribute__((section("__TEXT,foo")));
98
99+ (void) CMethod : (id) Obj __attribute__((section("__TEXT,fee")));
100@end