1// RUN: %clang_cc1 -fobjc-nonfragile-abi -fobjc-exceptions -fblocks -fsyntax-only -fobjc-arc -x objective-c %s.result 2// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fobjc-exceptions -fblocks -fobjc-nonfragile-abi -fsyntax-only -x objective-c %s > %t 3// RUN: diff %t %s.result 4 5#define nil 0 6 7typedef int BOOL; 8 9id 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 (strong) 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 self.bar = obj; 34 // do stuff with x; 35 36 IhaveSideEffect(); 37 38 x = 0; 39 40 @try { 41 } @finally { 42 x = nil; 43 } 44} 45 46@end 47 48void func(Foo *p) { 49} 50 51@interface Baz { 52 id <NSObject> _foo; 53} 54@end 55 56@implementation Baz 57- dealloc { 58 return 0; 59} 60@end 61 62void block_test(Foo *p) { 63 id (^B)() = ^() { 64 if (p) { 65 id (^IB)() = ^() { 66 id bar = p; 67 return bar; 68 }; 69 IB(); 70 } 71 return p; 72 }; 73} 74 75#define RELEASE_MACRO(x) [x release] 76#define RELEASE_MACRO2(x) RELEASE_MACRO(x) 77 78void test2(id p) { 79} 80