for (unsigned i = 0, e = AllProps.size(); i != e; ++i) {
ObjCPropertyDecl *PD = AllProps[i];
if (PD->getPropertyAttributesAsWritten() &
- ObjCPropertyDecl::OBJC_PR_assign) {
+ (ObjCPropertyDecl::OBJC_PR_assign |
+ ObjCPropertyDecl::OBJC_PR_readonly)) {
SourceLocation AtLoc = PD->getAtLoc();
if (AtLoc.isInvalid())
continue;
canUseWeak = false;
for (PropsTy::iterator I = props.begin(), E = props.end(); I != E; ++I) {
- if (isUserDeclared(I->IvarD))
- Pass.TA.insert(I->IvarD->getLocation(),
- canUseWeak ? "__weak " : "__unsafe_unretained ");
+ if (isUserDeclared(I->IvarD)) {
+ if (I->IvarD &&
+ I->IvarD->getType().getObjCLifetime() != Qualifiers::OCL_Weak)
+ Pass.TA.insert(I->IvarD->getLocation(),
+ canUseWeak ? "__weak " : "__unsafe_unretained ");
+ }
if (I->ImplD)
Pass.TA.clearDiagnostic(diag::err_arc_assign_property_ownership,
I->ImplD->getLocation());
canUseWeak = false;
for (PropsTy::iterator I = props.begin(), E = props.end(); I != E; ++I) {
- if (isUserDeclared(I->IvarD))
- Pass.TA.insert(I->IvarD->getLocation(),
- canUseWeak ? "__weak " : "__unsafe_unretained ");
+ if (isUserDeclared(I->IvarD)) {
+ if (I->IvarD &&
+ I->IvarD->getType().getObjCLifetime() != Qualifiers::OCL_Weak)
+ Pass.TA.insert(I->IvarD->getLocation(),
+ canUseWeak ? "__weak " : "__unsafe_unretained ");
+ }
if (I->ImplD) {
Pass.TA.clearDiagnostic(diag::err_arc_assign_property_ownership,
I->ImplD->getLocation());
@interface I4Impl {
I4Impl *pds2;
I4Impl *pds3;
+ __weak I4Impl *pw3;
+ __weak I4Impl *pw4;
}
@property (assign) I4Impl *__weak pw1, *__weak pw2;
@property (assign) I4Impl *__strong ps;
@property (assign) I4Impl * pds2;
@property (readwrite) I4Impl * pds3;
@property (readonly) I4Impl * pds4;
+@property (readonly) __weak I4Impl *pw3;
+@property (assign) __weak I4Impl *pw4;
@end
@implementation I4Impl
-@synthesize pw1, pw2, ps, pds, pds2, pds3, pds4;
+@synthesize pw1, pw2, pw3, pw4, ps, pds, pds2, pds3, pds4;
-(void)test1:(CFTypeRef *)cft {
id x = NSMakeCollectable(cft);
@interface I4Impl {
I4Impl *pds2;
I4Impl *pds3;
+ __weak I4Impl *pw3;
+ __weak I4Impl *pw4;
}
@property (weak) I4Impl * pw1, * pw2;
@property I4Impl * ps;
@property I4Impl * pds2;
@property (readwrite) I4Impl * pds3;
@property (readonly) I4Impl * pds4;
+@property (weak, readonly) I4Impl *pw3;
+@property (weak) I4Impl *pw4;
@end
@implementation I4Impl
-@synthesize pw1, pw2, ps, pds, pds2, pds3, pds4;
+@synthesize pw1, pw2, pw3, pw4, ps, pds, pds2, pds3, pds4;
-(void)test1:(CFTypeRef *)cft {
id x = CFBridgingRelease(cft);