[cfe-commits] r151424 - in /cfe/trunk: lib/ARCMigrate/TransGCAttrs.cpp test/ARCMT/GC-no-arc-runtime.m test/ARCMT/GC-no-arc-runtime.m.result test/ARCMT/GC-no-finalize-removal.m test/ARCMT/GC-no-finalize-removal.m.result test/ARCMT/GC.m test/ARCMT/GC.m.result

Argyrios Kyrtzidis akyrtzi at gmail.com
Fri Feb 24 17:57:43 PST 2012


Author: akirtzidis
Date: Fri Feb 24 19:57:42 2012
New Revision: 151424

URL: http://llvm.org/viewvc/llvm-project?rev=151424&view=rev
Log:
[arcmt] GC migrator: don't try to remove redundant __strong, it does
more harm than good.

Fixes rdar://10522805&10521433

Modified:
    cfe/trunk/lib/ARCMigrate/TransGCAttrs.cpp
    cfe/trunk/test/ARCMT/GC-no-arc-runtime.m
    cfe/trunk/test/ARCMT/GC-no-arc-runtime.m.result
    cfe/trunk/test/ARCMT/GC-no-finalize-removal.m
    cfe/trunk/test/ARCMT/GC-no-finalize-removal.m.result
    cfe/trunk/test/ARCMT/GC.m
    cfe/trunk/test/ARCMT/GC.m.result

Modified: cfe/trunk/lib/ARCMigrate/TransGCAttrs.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ARCMigrate/TransGCAttrs.cpp?rev=151424&r1=151423&r2=151424&view=diff
==============================================================================
--- cfe/trunk/lib/ARCMigrate/TransGCAttrs.cpp (original)
+++ cfe/trunk/lib/ARCMigrate/TransGCAttrs.cpp Fri Feb 24 19:57:42 2012
@@ -183,30 +183,6 @@
 
 } // anonymous namespace
 
-static void clearRedundantStrongs(MigrationContext &MigrateCtx) {
-  TransformActions &TA = MigrateCtx.Pass.TA;
-
-  for (unsigned i = 0, e = MigrateCtx.GCAttrs.size(); i != e; ++i) {
-    MigrationContext::GCAttrOccurrence &Attr = MigrateCtx.GCAttrs[i];
-    if (Attr.Kind == MigrationContext::GCAttrOccurrence::Strong &&
-        Attr.FullyMigratable && Attr.Dcl) {
-      TypeSourceInfo *TInfo = 0;
-      if (DeclaratorDecl *DD = dyn_cast<DeclaratorDecl>(Attr.Dcl))
-        TInfo = DD->getTypeSourceInfo();
-      else if (ObjCPropertyDecl *PD = dyn_cast<ObjCPropertyDecl>(Attr.Dcl))
-        TInfo = PD->getTypeSourceInfo();
-      if (!TInfo)
-        continue;
-
-      if (TInfo->getType().getObjCLifetime() == Qualifiers::OCL_Strong) {
-        Transaction Trans(TA);
-        TA.remove(Attr.Loc);
-        MigrateCtx.RemovedAttrSet.insert(Attr.Loc.getRawEncoding());
-      }
-    }
-  }
-}
-
 static void errorForGCAttrsOnNonObjC(MigrationContext &MigrateCtx) {
   TransformActions &TA = MigrateCtx.Pass.TA;
 
@@ -354,7 +330,6 @@
   GCAttrsCollector(MigrateCtx, AllProps).TraverseDecl(
                                   MigrateCtx.Pass.Ctx.getTranslationUnitDecl());
 
-  clearRedundantStrongs(MigrateCtx);
   errorForGCAttrsOnNonObjC(MigrateCtx);
   checkAllProps(MigrateCtx, AllProps);
   checkWeakGCAttrs(MigrateCtx);

Modified: cfe/trunk/test/ARCMT/GC-no-arc-runtime.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ARCMT/GC-no-arc-runtime.m?rev=151424&r1=151423&r2=151424&view=diff
==============================================================================
--- cfe/trunk/test/ARCMT/GC-no-arc-runtime.m (original)
+++ cfe/trunk/test/ARCMT/GC-no-arc-runtime.m Fri Feb 24 19:57:42 2012
@@ -12,9 +12,7 @@
   id x = NSMakeCollectable(cft);
 }
 
- at interface I1 {
-  __strong I1 *myivar;
-}
+ at interface I1
 @end
 
 @implementation I1

Modified: cfe/trunk/test/ARCMT/GC-no-arc-runtime.m.result
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ARCMT/GC-no-arc-runtime.m.result?rev=151424&r1=151423&r2=151424&view=diff
==============================================================================
--- cfe/trunk/test/ARCMT/GC-no-arc-runtime.m.result (original)
+++ cfe/trunk/test/ARCMT/GC-no-arc-runtime.m.result Fri Feb 24 19:57:42 2012
@@ -12,9 +12,7 @@
   id x = CFBridgingRelease(cft);
 }
 
- at interface I1 {
-   I1 *myivar;
-}
+ at interface I1
 @end
 
 @implementation I1

Modified: cfe/trunk/test/ARCMT/GC-no-finalize-removal.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ARCMT/GC-no-finalize-removal.m?rev=151424&r1=151423&r2=151424&view=diff
==============================================================================
--- cfe/trunk/test/ARCMT/GC-no-finalize-removal.m (original)
+++ cfe/trunk/test/ARCMT/GC-no-finalize-removal.m Fri Feb 24 19:57:42 2012
@@ -12,9 +12,7 @@
   id x = NSMakeCollectable(cft);
 }
 
- at interface I1 {
-  __strong I1 *myivar;
-}
+ at interface I1
 @end
 
 @implementation I1

Modified: cfe/trunk/test/ARCMT/GC-no-finalize-removal.m.result
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ARCMT/GC-no-finalize-removal.m.result?rev=151424&r1=151423&r2=151424&view=diff
==============================================================================
--- cfe/trunk/test/ARCMT/GC-no-finalize-removal.m.result (original)
+++ cfe/trunk/test/ARCMT/GC-no-finalize-removal.m.result Fri Feb 24 19:57:42 2012
@@ -12,9 +12,7 @@
   id x = CFBridgingRelease(cft);
 }
 
- at interface I1 {
-   I1 *myivar;
-}
+ at interface I1
 @end
 
 @implementation I1

Modified: cfe/trunk/test/ARCMT/GC.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ARCMT/GC.m?rev=151424&r1=151423&r2=151424&view=diff
==============================================================================
--- cfe/trunk/test/ARCMT/GC.m (original)
+++ cfe/trunk/test/ARCMT/GC.m Fri Feb 24 19:57:42 2012
@@ -12,9 +12,7 @@
   id x = NSMakeCollectable(cft);
 }
 
- at interface I1 {
-  __strong I1 *myivar;
-}
+ at interface I1
 @end
 
 @implementation I1
@@ -90,3 +88,8 @@
 @implementation rdar10532449
 @synthesize assign_prop, strong_readonly_prop, weak_prop;
 @end
+
+void test2(id p, __strong I1 *ap[]) {
+  for (__strong I1 *specRule in p) {
+  }
+}

Modified: cfe/trunk/test/ARCMT/GC.m.result
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ARCMT/GC.m.result?rev=151424&r1=151423&r2=151424&view=diff
==============================================================================
--- cfe/trunk/test/ARCMT/GC.m.result (original)
+++ cfe/trunk/test/ARCMT/GC.m.result Fri Feb 24 19:57:42 2012
@@ -12,9 +12,7 @@
   id x = CFBridgingRelease(cft);
 }
 
- at interface I1 {
-   I1 *myivar;
-}
+ at interface I1
 @end
 
 @implementation I1
@@ -85,3 +83,8 @@
 @implementation rdar10532449
 @synthesize assign_prop, strong_readonly_prop, weak_prop;
 @end
+
+void test2(id p, __strong I1 *ap[]) {
+  for (__strong I1 *specRule in p) {
+  }
+}





More information about the cfe-commits mailing list