1 // RUN: %clang_cc1 -fblocks -fsyntax-only -fobjc-arc -x objective-c %s.result 2 // RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fblocks -fsyntax-only -x objective-c %s > %t 3 // RUN: diff %t %s.result 4 5 #include "Common.h" 6 7 id IhaveSideEffect(); 8 9 @interface Foo : NSObject { 10 id bar; 11 } 12 @property (strong) id bar; 13 -(id)test:(id)obj; 14 -(id)something; 15 @end 16 17 #define Something_Macro(key, comment) \ 18 [[Foo new] something] 19 20 @implementation Foo 21 22 @synthesize bar; 23 24 -(id)something {} 25 26 -(id)test:(id)obj { 27 id x = self.bar; 28 self.bar = obj; 29 30 Something_Macro(@"foo", "@bar"); 31 32 IhaveSideEffect(); 33 34 [self something]; 35 36 [self something]; 37 38 IhaveSideEffect(); 39 // do stuff with x; 40 return self; 41 } 42 43 - (id)test1 { 44 id x=0; 45 return (((x))); 46 } 47 @end 48 49 id foo (Foo *p) { 50 p = p; 51 return (p); 52 } 53 54 void block_tests(Foo *p) { 55 id (^B)() = ^() { 56 if (p) { 57 id (^IB)() = ^() { 58 id bar = p; 59 return bar; 60 }; 61 IB(); 62 } 63 return p; 64 }; 65 } 66