1 // RUN: %clang_cc1 -triple x86_64-apple-macosx10.6 -fsyntax-only -fobjc-runtime-has-weak -fobjc-arc -x objective-c %s.result 2 // RUN: arcmt-test --args -triple x86_64-apple-macosx10.6 -fsyntax-only -fobjc-gc-only -x objective-c %s > %t 3 // RUN: diff %t %s.result 4 // RUN: arcmt-test --args -triple x86_64-apple-macosx10.6 -fsyntax-only -fobjc-gc-only -x objective-c++ %s > %t 5 // RUN: diff %t %s.result 6 // DISABLE: mingw32 7 8 #include "Common.h" 9 #include "GC.h" 10 11 void test1(CFTypeRef *cft) { 12 id x = NSMakeCollectable(cft); 13 } 14 15 @interface I1 16 @end 17 18 @implementation I1 19 -(void)dealloc { 20 // dealloc 21 test1(0); 22 } 23 24 -(void)finalize { 25 // finalize 26 test1(0); 27 } 28 @end 29 30 @interface I2 31 @property (retain) id prop; 32 @end 33 34 @implementation I2 35 @synthesize prop; 36 37 -(void)finalize { 38 self.prop = 0; 39 // finalize 40 test1(0); 41 } 42 @end 43 44 __attribute__((objc_arc_weak_reference_unavailable)) 45 @interface QQ { 46 __weak id s; 47 __weak QQ *q; 48 } 49 @end 50 51 @interface I3 52 @property (assign) I3 *__weak pw1, *__weak pw2; 53 @property (assign) I3 *__strong ps; 54 @property (assign) I3 * pds; 55 @end 56 57 @interface I4Impl { 58 I4Impl *pds2; 59 } 60 @property (assign) I4Impl *__weak pw1, *__weak pw2; 61 @property (assign) I4Impl *__strong ps; 62 @property (assign) I4Impl * pds; 63 @property (assign) I4Impl * pds2; 64 @end 65 66 @implementation I4Impl 67 @synthesize pw1, pw2, ps, pds, pds2; 68 69 -(void)test1:(CFTypeRef *)cft { 70 id x = NSMakeCollectable(cft); 71 } 72 @end 73 74 @interface I5 { 75 __weak id prop; 76 } 77 @property (readonly) __weak id prop; 78 @end 79