]> granicus.if.org Git - clang/commitdiff
[arcmt] GC migrator: don't try to remove redundant __strong, it does
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Sat, 25 Feb 2012 01:57:42 +0000 (01:57 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Sat, 25 Feb 2012 01:57:42 +0000 (01:57 +0000)
more harm than good.

Fixes rdar://10522805&10521433

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151424 91177308-0d34-0410-b5e6-96231b3b80d8

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

index fa62b3620808c1e83bb110a8d9fd0900f4645c61..de710abb5d5e28acbcfb54df675c833b1dfc2330 100644 (file)
@@ -183,30 +183,6 @@ public:
 
 } // 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 @@ void GCAttrsTraverser::traverseTU(MigrationContext &MigrateCtx) {
   GCAttrsCollector(MigrateCtx, AllProps).TraverseDecl(
                                   MigrateCtx.Pass.Ctx.getTranslationUnitDecl());
 
-  clearRedundantStrongs(MigrateCtx);
   errorForGCAttrsOnNonObjC(MigrateCtx);
   checkAllProps(MigrateCtx, AllProps);
   checkWeakGCAttrs(MigrateCtx);
index ab9d6a4ae5c659b000737942d7ece2f0d721a3ed..f0699927eda5f9f76e62df2361eeaf6d462f2f15 100644 (file)
@@ -12,9 +12,7 @@ void test1(CFTypeRef *cft) {
   id x = NSMakeCollectable(cft);
 }
 
-@interface I1 {
-  __strong I1 *myivar;
-}
+@interface I1
 @end
 
 @implementation I1
index 983a5b174271a32c9779020c46d59acd1c13bb9f..f55ca38070e9e6aa218bfb8705b4dcded3bc76bc 100644 (file)
@@ -12,9 +12,7 @@ void test1(CFTypeRef *cft) {
   id x = CFBridgingRelease(cft);
 }
 
-@interface I1 {
-   I1 *myivar;
-}
+@interface I1
 @end
 
 @implementation I1
index d9739376f2d62cf36f1ca69272fa62eb295daa52..14e8602446c3e3e4f8f1d3ce3c4da3b2f46c40ae 100644 (file)
@@ -12,9 +12,7 @@ void test1(CFTypeRef *cft) {
   id x = NSMakeCollectable(cft);
 }
 
-@interface I1 {
-  __strong I1 *myivar;
-}
+@interface I1
 @end
 
 @implementation I1
index 38aabc32ae32137873d302f74d248b74a7095268..ea14873ec35334e0f0f7813ded4cd200125f6dc0 100644 (file)
@@ -12,9 +12,7 @@ void test1(CFTypeRef *cft) {
   id x = CFBridgingRelease(cft);
 }
 
-@interface I1 {
-   I1 *myivar;
-}
+@interface I1
 @end
 
 @implementation I1
index f241e430085347ad2e461c6d839728e3528ba512..eebbaf6854d98fd4a5bc9c5d27860f0c27d66d9e 100644 (file)
@@ -12,9 +12,7 @@ void test1(CFTypeRef *cft) {
   id x = NSMakeCollectable(cft);
 }
 
-@interface I1 {
-  __strong I1 *myivar;
-}
+@interface I1
 @end
 
 @implementation I1
@@ -90,3 +88,8 @@ __attribute__((objc_arc_weak_reference_unavailable))
 @implementation rdar10532449
 @synthesize assign_prop, strong_readonly_prop, weak_prop;
 @end
+
+void test2(id p, __strong I1 *ap[]) {
+  for (__strong I1 *specRule in p) {
+  }
+}
index f9e954af5a8152dab71ff9cdc69c70ff28399ab5..c2c523f77e990df1a4e19b25990b0fab7dbe025f 100644 (file)
@@ -12,9 +12,7 @@ void test1(CFTypeRef *cft) {
   id x = CFBridgingRelease(cft);
 }
 
-@interface I1 {
-   I1 *myivar;
-}
+@interface I1
 @end
 
 @implementation I1
@@ -85,3 +83,8 @@ __attribute__((objc_arc_weak_reference_unavailable))
 @implementation rdar10532449
 @synthesize assign_prop, strong_readonly_prop, weak_prop;
 @end
+
+void test2(id p, __strong I1 *ap[]) {
+  for (__strong I1 *specRule in p) {
+  }
+}