1*67e74705SXin Li// RUN: %clang_cc1 -triple x86_64-apple-macosx10.7 -fsyntax-only -fobjc-runtime-has-weak -fobjc-arc -x objective-c %s.result 2*67e74705SXin Li// RUN: arcmt-test --args -triple x86_64-apple-macosx10.7 -fsyntax-only -fobjc-gc-only -x objective-c %s > %t 3*67e74705SXin Li// RUN: diff %t %s.result 4*67e74705SXin Li// RUN: arcmt-test --args -triple x86_64-apple-macosx10.7 -fsyntax-only -fobjc-gc-only -x objective-c++ %s > %t 5*67e74705SXin Li// RUN: diff %t %s.result 6*67e74705SXin Li 7*67e74705SXin Li#include "Common.h" 8*67e74705SXin Li#include "GC.h" 9*67e74705SXin Li 10*67e74705SXin Livoid test1(CFTypeRef *cft) { 11*67e74705SXin Li id x = NSMakeCollectable(cft); 12*67e74705SXin Li} 13*67e74705SXin Li 14*67e74705SXin Li@interface I1 15*67e74705SXin Li@end 16*67e74705SXin Li 17*67e74705SXin Li@implementation I1 18*67e74705SXin Li-(void)dealloc { 19*67e74705SXin Li // dealloc 20*67e74705SXin Li test1(0); 21*67e74705SXin Li} 22*67e74705SXin Li 23*67e74705SXin Li-(void)finalize { 24*67e74705SXin Li // finalize 25*67e74705SXin Li test1(0); 26*67e74705SXin Li} 27*67e74705SXin Li@end 28*67e74705SXin Li 29*67e74705SXin Li@interface I2 30*67e74705SXin Li@property (retain) id prop; 31*67e74705SXin Li@end 32*67e74705SXin Li 33*67e74705SXin Li@implementation I2 34*67e74705SXin Li@synthesize prop; 35*67e74705SXin Li 36*67e74705SXin Li-(void)finalize { 37*67e74705SXin Li self.prop = 0; 38*67e74705SXin Li // finalize 39*67e74705SXin Li test1(0); 40*67e74705SXin Li} 41*67e74705SXin Li@end 42*67e74705SXin Li 43*67e74705SXin Li__attribute__((objc_arc_weak_reference_unavailable)) 44*67e74705SXin Li@interface QQ { 45*67e74705SXin Li __weak id s; 46*67e74705SXin Li __weak QQ *q; 47*67e74705SXin Li} 48*67e74705SXin Li@end 49*67e74705SXin Li 50*67e74705SXin Li@interface I3 51*67e74705SXin Li@property (assign) I3 *__weak pw1, *__weak pw2; 52*67e74705SXin Li@property (assign) I3 *__strong ps; 53*67e74705SXin Li@property (assign) I3 * pds; 54*67e74705SXin Li@end 55*67e74705SXin Li 56*67e74705SXin Li@interface I4Impl { 57*67e74705SXin Li I4Impl *pds2; 58*67e74705SXin Li I4Impl *pds3; 59*67e74705SXin Li __weak I4Impl *pw3; 60*67e74705SXin Li __weak I4Impl *pw4; 61*67e74705SXin Li} 62*67e74705SXin Li@property (assign) I4Impl *__weak pw1, *__weak pw2; 63*67e74705SXin Li@property (assign) I4Impl *__strong ps; 64*67e74705SXin Li@property (assign) I4Impl * pds; 65*67e74705SXin Li@property (assign) I4Impl * pds2; 66*67e74705SXin Li@property (readwrite) I4Impl * pds3; 67*67e74705SXin Li@property (readonly) I4Impl * pds4; 68*67e74705SXin Li@property (readonly) __weak I4Impl *pw3; 69*67e74705SXin Li@property (assign) __weak I4Impl *pw4; 70*67e74705SXin Li@end 71*67e74705SXin Li 72*67e74705SXin Li@implementation I4Impl 73*67e74705SXin Li@synthesize pw1, pw2, pw3, pw4, ps, pds, pds2, pds3, pds4; 74*67e74705SXin Li 75*67e74705SXin Li-(void)test1:(CFTypeRef *)cft { 76*67e74705SXin Li id x = NSMakeCollectable(cft); 77*67e74705SXin Li} 78*67e74705SXin Li@end 79*67e74705SXin Li 80*67e74705SXin Li// rdar://10532449 81*67e74705SXin Li@interface rdar10532449 82*67e74705SXin Li@property (assign) id assign_prop; 83*67e74705SXin Li@property (assign, readonly) id __strong strong_readonly_prop; 84*67e74705SXin Li@property (assign) id __weak weak_prop; 85*67e74705SXin Li@end 86*67e74705SXin Li 87*67e74705SXin Li@implementation rdar10532449 88*67e74705SXin Li@synthesize assign_prop, strong_readonly_prop, weak_prop; 89*67e74705SXin Li@end 90*67e74705SXin Li 91*67e74705SXin Livoid test2(id p, __strong I1 *ap[]) { 92*67e74705SXin Li for (__strong I1 *specRule in p) { 93*67e74705SXin Li } 94*67e74705SXin Li} 95