[cfe-commits] r135003 - in /cfe/trunk: lib/ARCMigrate/Transforms.cpp test/ARCMT/assign-prop-with-arc-runtime.m test/ARCMT/assign-prop-with-arc-runtime.m.result
Argyrios Kyrtzidis
akyrtzi at gmail.com
Tue Jul 12 15:16:26 PDT 2011
Author: akirtzidis
Date: Tue Jul 12 17:16:25 2011
New Revision: 135003
URL: http://llvm.org/viewvc/llvm-project?rev=135003&view=rev
Log:
[arcmt] Also avoid 'weak' for forward references to objc classes.
Modified:
cfe/trunk/lib/ARCMigrate/Transforms.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/Transforms.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ARCMigrate/Transforms.cpp?rev=135003&r1=135002&r2=135003&view=diff
==============================================================================
--- cfe/trunk/lib/ARCMigrate/Transforms.cpp (original)
+++ cfe/trunk/lib/ARCMigrate/Transforms.cpp Tue Jul 12 17:16:25 2011
@@ -75,6 +75,8 @@
ObjCInterfaceDecl *Class = ObjT->getInterfaceDecl();
if (!Class || Class->getName() == "NSObject")
return false; // id/NSObject is not safe for weak.
+ if (Class->isForwardDecl())
+ return false; // forward classes are not verifiable, therefore not safe.
if (Class->isArcWeakrefUnavailable())
return false;
if (isClassInWeakBlacklist(Class))
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=135003&r1=135002&r2=135003&view=diff
==============================================================================
--- cfe/trunk/test/ARCMT/assign-prop-with-arc-runtime.m (original)
+++ cfe/trunk/test/ARCMT/assign-prop-with-arc-runtime.m Tue Jul 12 17:16:25 2011
@@ -9,9 +9,10 @@
@end
@class _NSCachedAttributedString;
-
typedef _NSCachedAttributedString *BadClassForWeak;
+ at class Forw;
+
@interface Foo : NSObject {
Foo *x, *w, *q1, *q2;
Foo *z1, *__unsafe_unretained z2;
@@ -19,6 +20,7 @@
BadClassForWeak bcw;
id not_safe1;
NSObject *not_safe2;
+ Forw *not_safe3;
}
@property (readonly,assign) Foo *x;
@property (assign) Foo *w;
@@ -28,8 +30,9 @@
@property (assign) BadClassForWeak bcw;
@property (assign) id not_safe1;
@property (assign) NSObject *not_safe2;
+ at property (assign) Forw *not_safe3;
@end
@implementation Foo
- at synthesize x,w,q1,q2,z1,z2,oo,bcw,not_safe1,not_safe2;
+ at synthesize x,w,q1,q2,z1,z2,oo,bcw,not_safe1,not_safe2,not_safe3;
@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=135003&r1=135002&r2=135003&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 Tue Jul 12 17:16:25 2011
@@ -9,9 +9,10 @@
@end
@class _NSCachedAttributedString;
-
typedef _NSCachedAttributedString *BadClassForWeak;
+ at class Forw;
+
@interface Foo : NSObject {
Foo *__weak x, *__weak w, *__weak q1, *__weak q2;
Foo *__unsafe_unretained z1, *__unsafe_unretained z2;
@@ -19,6 +20,7 @@
BadClassForWeak __unsafe_unretained bcw;
id __unsafe_unretained not_safe1;
NSObject *__unsafe_unretained not_safe2;
+ Forw *__unsafe_unretained not_safe3;
}
@property (readonly,weak) Foo *x;
@property (weak) Foo *w;
@@ -28,8 +30,9 @@
@property (assign) BadClassForWeak bcw;
@property (assign) id not_safe1;
@property (assign) NSObject *not_safe2;
+ at property (assign) Forw *not_safe3;
@end
@implementation Foo
- at synthesize x,w,q1,q2,z1,z2,oo,bcw,not_safe1,not_safe2;
+ at synthesize x,w,q1,q2,z1,z2,oo,bcw,not_safe1,not_safe2,not_safe3;
@end
More information about the cfe-commits
mailing list