1 // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -fobjc-arc -fobjc-runtime-has-weak -x objective-c %s.result 2 // RUN: arcmt-test --args -triple x86_64-apple-macosx10.7 -fsyntax-only %s > %t 3 // RUN: diff %t %s.result 4 // DISABLE: mingw32 5 6 #include "Common.h" 7 8 __attribute__((objc_arc_weak_reference_unavailable)) 9 @interface WeakOptOut 10 @end 11 12 @class _NSCachedAttributedString; 13 typedef _NSCachedAttributedString *BadClassForWeak; 14 15 @class Forw; 16 17 @interface Foo : NSObject { 18 Foo *__weak x, *__weak w, *__weak q1, *__weak q2; 19 WeakOptOut *__unsafe_unretained oo; 20 BadClassForWeak __unsafe_unretained bcw; 21 id __unsafe_unretained not_safe1; 22 NSObject *__unsafe_unretained not_safe2; 23 Forw *__unsafe_unretained not_safe3; 24 Foo *assign_plus1; 25 } 26 @property (weak, readonly) Foo *x; 27 @property (weak) Foo *w; 28 @property (weak) Foo *q1, *q2; 29 @property (unsafe_unretained) WeakOptOut *oo; 30 @property (unsafe_unretained) BadClassForWeak bcw; 31 @property (unsafe_unretained) id not_safe1; 32 @property (unsafe_unretained) NSObject *not_safe2; 33 @property (unsafe_unretained) Forw *not_safe3; 34 @property (readonly) Foo *assign_plus1; 35 @property (readonly) Foo *assign_plus2; 36 @property (readonly) Foo *assign_plus3; 37 38 @property (weak) Foo *no_user_ivar1; 39 @property (weak, readonly) Foo *no_user_ivar2; 40 41 @property (strong) id def1; 42 @property (atomic,strong) id def2; 43 @property (strong,atomic) id def3; 44 45 @end 46 47 @implementation Foo 48 @synthesize x,w,q1,q2,oo,bcw,not_safe1,not_safe2,not_safe3; 49 @synthesize no_user_ivar1, no_user_ivar2; 50 @synthesize assign_plus1, assign_plus2, assign_plus3; 51 @synthesize def1, def2, def3; 52 53 -(void)test:(Foo *)parm { 54 assign_plus1 = [[Foo alloc] init]; 55 assign_plus2 = [Foo new]; 56 assign_plus3 = parm; 57 } 58 @end 59 60 @interface TestExt 61 @property (strong,readonly) TestExt *x1; 62 @property (weak, readonly) TestExt *x2; 63 @end 64 65 @interface TestExt() 66 @property (strong,readwrite) TestExt *x1; 67 @property (weak, readwrite) TestExt *x2; 68 @property (strong) TestExt *x3; 69 @end 70 71 @implementation TestExt 72 @synthesize x1, x2, x3; 73 @end 74