blob: f7252af1f1b75afe83787bcdb41a8f274f0cd833 [file] [log] [blame]
Patrick Beardb2f68202012-04-06 18:12:22 +00001// RUN: %clang_cc1 -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));
Daniel Dunbar35682492008-09-26 04:12:28 +000010@end
Fariborz Jahanian5d36ac22009-05-12 21:36:23 +000011
12
13@interface INTF
14- (int) foo1: (int)arg1 __attribute__((deprecated));
15
Ted Kremenek3306ec12012-02-27 22:55:11 +000016- (int) foo: (int)arg1; // expected-note {{method 'foo:' declared here}}
Fariborz Jahanian5d36ac22009-05-12 21:36:23 +000017
Ted Kremenek3306ec12012-02-27 22:55:11 +000018- (int) foo2: (int)arg1 __attribute__((deprecated)) __attribute__((unavailable)); // expected-note {{method 'foo2:' declared here}}
Fariborz Jahanian7fda4002011-10-22 01:21:15 +000019- (int) foo3: (int)arg1 __attribute__((deprecated)) __attribute__((unavailable)) __attribute__((ns_consumes_self));
Fariborz Jahanian5d36ac22009-05-12 21:36:23 +000020@end
21
22@implementation INTF
Fariborz Jahanianec236782011-12-06 00:02:41 +000023- (int) foo: (int)arg1 __attribute__((deprecated)){ // expected-warning {{attributes on method implementation and its declaration must match}}
Fariborz Jahanian5d36ac22009-05-12 21:36:23 +000024 return 10;
25}
26- (int) foo1: (int)arg1 {
27 return 10;
28}
Fariborz Jahanianec236782011-12-06 00:02:41 +000029- (int) foo2: (int)arg1 __attribute__((deprecated)) { // expected-warning {{attributes on method implementation and its declaration must match}}
Fariborz Jahanian5d36ac22009-05-12 21:36:23 +000030 return 10;
31}
Fariborz Jahanian7fda4002011-10-22 01:21:15 +000032- (int) foo3: (int)arg1 __attribute__((deprecated)) __attribute__((unavailable)) __attribute__((ns_consumes_self)) {return 0; }
33- (void) dep __attribute__((deprecated)) { } // OK private methodn
Fariborz Jahanian5d36ac22009-05-12 21:36:23 +000034@end
35
Fariborz Jahanianec236782011-12-06 00:02:41 +000036
37// rdar://10529259
38#define IBAction void)__attribute__((ibaction)
39
40@interface Foo
41- (void)doSomething1:(id)sender;
Ted Kremenek3306ec12012-02-27 22:55:11 +000042- (void)doSomething2:(id)sender; // expected-note {{method 'doSomething2:' declared here}}
Fariborz Jahanianec236782011-12-06 00:02:41 +000043@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