[cfe-commits] r137252 - in /cfe/trunk: lib/ARCMigrate/TransProperties.cpp test/ARCMT/assign-prop-with-arc-runtime.m test/ARCMT/assign-prop-with-arc-runtime.m.result
Argyrios Kyrtzidis
akyrtzi at gmail.com
Wed Aug 10 14:46:48 PDT 2011
Author: akirtzidis
Date: Wed Aug 10 16:46:48 2011
New Revision: 137252
URL: http://llvm.org/viewvc/llvm-project?rev=137252&view=rev
Log:
[arcmt] When checking whether properties needs to be strong or not, take into account
that assigning result of -retain means it should be strong. rdar://9931757.
Modified:
cfe/trunk/lib/ARCMigrate/TransProperties.cpp
cfe/trunk/test/ARCMT/assign-prop-with-arc-runtime.m
cfe/trunk/test/ARCMT/assign-prop-with-arc-runtime.m.result
Modified: cfe/trunk/lib/ARCMigrate/TransProperties.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ARCMigrate/TransProperties.cpp?rev=137252&r1=137251&r2=137252&view=diff
==============================================================================
--- cfe/trunk/lib/ARCMigrate/TransProperties.cpp (original)
+++ cfe/trunk/lib/ARCMigrate/TransProperties.cpp Wed Aug 10 16:46:48 2011
@@ -330,6 +330,11 @@
if (RE->getDecl() != Ivar)
return true;
+ if (ObjCMessageExpr *
+ ME = dyn_cast<ObjCMessageExpr>(E->getRHS()->IgnoreParenCasts()))
+ if (ME->getMethodFamily() == OMF_retain)
+ return false;
+
ImplicitCastExpr *implCE = dyn_cast<ImplicitCastExpr>(E->getRHS());
while (implCE && implCE->getCastKind() == CK_BitCast)
implCE = dyn_cast<ImplicitCastExpr>(implCE->getSubExpr());
Modified: cfe/trunk/test/ARCMT/assign-prop-with-arc-runtime.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ARCMT/assign-prop-with-arc-runtime.m?rev=137252&r1=137251&r2=137252&view=diff
==============================================================================
--- cfe/trunk/test/ARCMT/assign-prop-with-arc-runtime.m (original)
+++ cfe/trunk/test/ARCMT/assign-prop-with-arc-runtime.m Wed Aug 10 16:46:48 2011
@@ -32,20 +32,20 @@
@property Forw *not_safe3;
@property (readonly) Foo *assign_plus1;
@property (readonly) Foo *assign_plus2;
+ at property (readonly) Foo *assign_plus3;
@property (assign) Foo *no_user_ivar1;
@property (readonly) Foo *no_user_ivar2;
-
--(void)test;
@end
@implementation Foo
@synthesize x,w,q1,q2,oo,bcw,not_safe1,not_safe2,not_safe3;
@synthesize no_user_ivar1, no_user_ivar2;
- at synthesize assign_plus1, assign_plus2;
+ at synthesize assign_plus1, assign_plus2, assign_plus3;
--(void)test {
+-(void)test:(Foo *)parm {
assign_plus1 = [[Foo alloc] init];
assign_plus2 = [Foo new];
+ assign_plus3 = [parm retain];
}
@end
Modified: cfe/trunk/test/ARCMT/assign-prop-with-arc-runtime.m.result
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ARCMT/assign-prop-with-arc-runtime.m.result?rev=137252&r1=137251&r2=137252&view=diff
==============================================================================
--- cfe/trunk/test/ARCMT/assign-prop-with-arc-runtime.m.result (original)
+++ cfe/trunk/test/ARCMT/assign-prop-with-arc-runtime.m.result Wed Aug 10 16:46:48 2011
@@ -32,20 +32,20 @@
@property (unsafe_unretained) Forw *not_safe3;
@property (readonly) Foo *assign_plus1;
@property (strong, readonly) Foo *assign_plus2;
+ at property (strong, readonly) Foo *assign_plus3;
@property (weak) Foo *no_user_ivar1;
@property (weak, readonly) Foo *no_user_ivar2;
-
--(void)test;
@end
@implementation Foo
@synthesize x,w,q1,q2,oo,bcw,not_safe1,not_safe2,not_safe3;
@synthesize no_user_ivar1, no_user_ivar2;
- at synthesize assign_plus1, assign_plus2;
+ at synthesize assign_plus1, assign_plus2, assign_plus3;
--(void)test {
+-(void)test:(Foo *)parm {
assign_plus1 = [[Foo alloc] init];
assign_plus2 = [Foo new];
+ assign_plus3 = parm;
}
@end
More information about the cfe-commits
mailing list