Home | History | Annotate | Download | only in SemaObjC
      1 // RUN: %clang_cc1 -triple i386-unknown-unknown -verify -fsyntax-only -Wno-objc-root-class %s
      2 
      3 @class NSString;
      4 
      5 @interface A
      6 -t1 __attribute__((noreturn));
      7 - (NSString *)stringByAppendingFormat:(NSString *)format, ... __attribute__((format(__NSString__, 1, 2)));
      8 -(void) m0 __attribute__((noreturn));
      9 -(void) m1 __attribute__((unused));
     10 -(void) m2 __attribute__((stdcall));
     11 -(void) m3 __attribute__((optnone));
     12 @end
     13 
     14 
     15 @interface INTF
     16 - (int) foo1: (int)arg1 __attribute__((deprecated));
     17 
     18 - (int) foo: (int)arg1;
     19 
     20 - (int) foo2: (int)arg1 __attribute__((deprecated)) __attribute__((unavailable));
     21 - (int) foo3: (int)arg1 __attribute__((deprecated)) __attribute__((unavailable)) __attribute__((ns_consumes_self));
     22 @end
     23 
     24 @implementation INTF
     25 - (int) foo: (int)arg1  __attribute__((deprecated)){
     26         return 10;
     27 }
     28 - (int) foo1: (int)arg1 {
     29         return 10;
     30 }
     31 - (int) foo2: (int)arg1 __attribute__((deprecated)) {
     32         return 10;
     33 }
     34 - (int) foo3: (int)arg1 __attribute__((deprecated)) __attribute__((unavailable)) __attribute__((ns_consumes_self)) {return 0; }
     35 - (void) dep __attribute__((deprecated)) { } // OK private methodn
     36 @end
     37 
     38 
     39 // rdar://10529259
     40 #define IBAction void)__attribute__((ibaction)
     41 
     42 @interface Foo 
     43 - (void)doSomething1:(id)sender;
     44 - (void)doSomething2:(id)sender;
     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 {}
     57 - (IBAction)doSomething2:(id)sender {}
     58 - (IBAction)doSomething3:(id)sender {}
     59 @end
     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)));
     68 - (id) method3: (int)arg1 __attribute__((aligned(16)))  __attribute__((deprecated)) __attribute__((unavailable));
     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 }
     82 - (id) method3: (int)arg1 __attribute__((deprecated)) __attribute__((unavailable)) {
     83         return self;
     84 }
     85 - (id) method4: (int)arg1 __attribute__((aligned(16))) __attribute__((deprecated)) __attribute__((unavailable)) {
     86   return self;
     87 }
     88 @end
     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
    102