1 // RUN: %clang_cc1 -fobjc-nonfragile-abi -fblocks -fsyntax-only -fobjc-arc -x objective-c %s.result 2 // RUN: cp %s %t 3 // RUN: %clang_cc1 -arcmt-modify -triple x86_64-apple-macosx10.6 -fobjc-nonfragile-abi -x objective-c %t 4 // RUN: diff %t %s.result 5 // RUN: rm %t 6 7 typedef int BOOL; 8 9 id IhaveSideEffect(); 10 11 @protocol NSObject 12 - (BOOL)isEqual:(id)object; 13 - (id)retain; 14 - (oneway void)release; 15 @end 16 17 @interface NSObject <NSObject> {} 18 @end 19 20 @interface Foo : NSObject { 21 id bar; 22 } 23 @property (retain) id bar; 24 -(void)test:(id)obj; 25 @end 26 27 @implementation Foo 28 29 @synthesize bar; 30 31 -(void)test:(id)obj { 32 id x = self.bar; 33 [x retain]; 34 self.bar = obj; 35 // do stuff with x; 36 [x release]; 37 38 [IhaveSideEffect() release]; 39 40 [x release], x = 0; 41 } 42 43 @end 44 45 void func(Foo *p) { 46 [p release]; 47 (([p release])); 48 } 49 50 @interface Baz { 51 id <NSObject> _foo; 52 } 53 @end 54 55 @implementation Baz 56 - dealloc { 57 [_foo release]; 58 return 0; 59 } 60 @end 61 62 #define RELEASE_MACRO(x) [x release] 63 #define RELEASE_MACRO2(x) RELEASE_MACRO(x) 64 65 void test2(id p) { 66 RELEASE_MACRO(p); 67 RELEASE_MACRO2(p); 68 } 69