1*0a6a1f1dSLionel Sambuc// RUN: %clang_cc1 -triple i386-unknown-unknown -verify -fsyntax-only -Wno-objc-root-class %s 2f4a2713aSLionel Sambuc 3f4a2713aSLionel Sambuc@class NSString; 4f4a2713aSLionel Sambuc 5f4a2713aSLionel Sambuc@interface A 6f4a2713aSLionel Sambuc-t1 __attribute__((noreturn)); 7f4a2713aSLionel Sambuc- (NSString *)stringByAppendingFormat:(NSString *)format, ... __attribute__((format(__NSString__, 1, 2))); 8f4a2713aSLionel Sambuc-(void) m0 __attribute__((noreturn)); 9f4a2713aSLionel Sambuc-(void) m1 __attribute__((unused)); 10*0a6a1f1dSLionel Sambuc-(void) m2 __attribute__((stdcall)); 11*0a6a1f1dSLionel Sambuc-(void) m3 __attribute__((optnone)); 12f4a2713aSLionel Sambuc@end 13f4a2713aSLionel Sambuc 14f4a2713aSLionel Sambuc 15f4a2713aSLionel Sambuc@interface INTF 16f4a2713aSLionel Sambuc- (int) foo1: (int)arg1 __attribute__((deprecated)); 17f4a2713aSLionel Sambuc 18*0a6a1f1dSLionel Sambuc- (int) foo: (int)arg1; 19f4a2713aSLionel Sambuc 20*0a6a1f1dSLionel Sambuc- (int) foo2: (int)arg1 __attribute__((deprecated)) __attribute__((unavailable)); 21f4a2713aSLionel Sambuc- (int) foo3: (int)arg1 __attribute__((deprecated)) __attribute__((unavailable)) __attribute__((ns_consumes_self)); 22f4a2713aSLionel Sambuc@end 23f4a2713aSLionel Sambuc 24f4a2713aSLionel Sambuc@implementation INTF 25*0a6a1f1dSLionel Sambuc- (int) foo: (int)arg1 __attribute__((deprecated)){ 26f4a2713aSLionel Sambuc return 10; 27f4a2713aSLionel Sambuc} 28f4a2713aSLionel Sambuc- (int) foo1: (int)arg1 { 29f4a2713aSLionel Sambuc return 10; 30f4a2713aSLionel Sambuc} 31*0a6a1f1dSLionel Sambuc- (int) foo2: (int)arg1 __attribute__((deprecated)) { 32f4a2713aSLionel Sambuc return 10; 33f4a2713aSLionel Sambuc} 34f4a2713aSLionel Sambuc- (int) foo3: (int)arg1 __attribute__((deprecated)) __attribute__((unavailable)) __attribute__((ns_consumes_self)) {return 0; } 35f4a2713aSLionel Sambuc- (void) dep __attribute__((deprecated)) { } // OK private methodn 36f4a2713aSLionel Sambuc@end 37f4a2713aSLionel Sambuc 38f4a2713aSLionel Sambuc 39f4a2713aSLionel Sambuc// rdar://10529259 40f4a2713aSLionel Sambuc#define IBAction void)__attribute__((ibaction) 41f4a2713aSLionel Sambuc 42f4a2713aSLionel Sambuc@interface Foo 43f4a2713aSLionel Sambuc- (void)doSomething1:(id)sender; 44*0a6a1f1dSLionel Sambuc- (void)doSomething2:(id)sender; 45f4a2713aSLionel Sambuc@end 46f4a2713aSLionel Sambuc 47f4a2713aSLionel Sambuc@implementation Foo 48f4a2713aSLionel Sambuc- (void)doSomething1:(id)sender{} 49f4a2713aSLionel Sambuc- (void)doSomething2:(id)sender{} 50f4a2713aSLionel Sambuc@end 51f4a2713aSLionel Sambuc 52f4a2713aSLionel Sambuc@interface Bar : Foo 53f4a2713aSLionel Sambuc- (IBAction)doSomething1:(id)sender; 54f4a2713aSLionel Sambuc@end 55f4a2713aSLionel Sambuc@implementation Bar 56f4a2713aSLionel Sambuc- (IBAction)doSomething1:(id)sender {} 57*0a6a1f1dSLionel Sambuc- (IBAction)doSomething2:(id)sender {} 58f4a2713aSLionel Sambuc- (IBAction)doSomething3:(id)sender {} 59f4a2713aSLionel Sambuc@end 60f4a2713aSLionel Sambuc 61f4a2713aSLionel Sambuc// rdar://11593375 62f4a2713aSLionel Sambuc@interface NSObject @end 63f4a2713aSLionel Sambuc 64f4a2713aSLionel Sambuc@interface Test : NSObject 65f4a2713aSLionel Sambuc-(id)method __attribute__((deprecated)); 66f4a2713aSLionel Sambuc-(id)method1; 67f4a2713aSLionel Sambuc-(id)method2 __attribute__((aligned(16))); 68*0a6a1f1dSLionel Sambuc- (id) method3: (int)arg1 __attribute__((aligned(16))) __attribute__((deprecated)) __attribute__((unavailable)); 69f4a2713aSLionel Sambuc- (id) method4: (int)arg1 __attribute__((aligned(16))) __attribute__((deprecated)) __attribute__((unavailable)); 70f4a2713aSLionel Sambuc@end 71f4a2713aSLionel Sambuc 72f4a2713aSLionel Sambuc@implementation Test 73f4a2713aSLionel Sambuc-(id)method __attribute__((aligned(16))) __attribute__((aligned(16))) __attribute__((deprecated)) { 74f4a2713aSLionel Sambuc return self; 75f4a2713aSLionel Sambuc} 76f4a2713aSLionel Sambuc-(id)method1 __attribute__((aligned(16))) { 77f4a2713aSLionel Sambuc return self; 78f4a2713aSLionel Sambuc} 79f4a2713aSLionel Sambuc-(id)method2 { 80f4a2713aSLionel Sambuc return self; 81f4a2713aSLionel Sambuc} 82*0a6a1f1dSLionel Sambuc- (id) method3: (int)arg1 __attribute__((deprecated)) __attribute__((unavailable)) { 83f4a2713aSLionel Sambuc return self; 84f4a2713aSLionel Sambuc} 85f4a2713aSLionel Sambuc- (id) method4: (int)arg1 __attribute__((aligned(16))) __attribute__((deprecated)) __attribute__((unavailable)) { 86f4a2713aSLionel Sambuc return self; 87f4a2713aSLionel Sambuc} 88f4a2713aSLionel Sambuc@end 89*0a6a1f1dSLionel Sambuc 90*0a6a1f1dSLionel Sambuc__attribute__((cdecl)) // expected-warning {{'cdecl' attribute only applies to functions and methods}} 91*0a6a1f1dSLionel Sambuc@interface Complain 92*0a6a1f1dSLionel Sambuc@end 93*0a6a1f1dSLionel Sambuc 94*0a6a1f1dSLionel Sambuc// rdar://15450637 95*0a6a1f1dSLionel Sambuc@interface rdar15450637 : NSObject 96*0a6a1f1dSLionel Sambuc@property int p __attribute__((section("__TEXT,foo"))); 97*0a6a1f1dSLionel Sambuc 98*0a6a1f1dSLionel Sambuc- (id) IMethod :(int) count, ... __attribute__((section("__TEXT,foo"))); 99*0a6a1f1dSLionel Sambuc 100*0a6a1f1dSLionel Sambuc+ (void) CMethod : (id) Obj __attribute__((section("__TEXT,fee"))); 101*0a6a1f1dSLionel Sambuc@end 102