]> granicus.if.org Git - clang/commitdiff
[arcmt] Map property decls to their GC attributes.
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Mon, 7 Nov 2011 18:40:32 +0000 (18:40 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Mon, 7 Nov 2011 18:40:32 +0000 (18:40 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143978 91177308-0d34-0410-b5e6-96231b3b80d8

lib/ARCMigrate/TransGCAttrs.cpp
lib/ARCMigrate/TransProperties.cpp
lib/ARCMigrate/Transforms.h

index 94eb8781dfef24af1787eb5278a4df2d5cc86274..70157aba3d63654e3f39a92e4a204deb99e53acf 100644 (file)
@@ -108,6 +108,10 @@ public:
     Attr.ModifiedType = TL.getModifiedLoc().getType();
     Attr.Dcl = D;
     Attr.FullyMigratable = FullyMigratable;
+
+    if (ObjCPropertyDecl *PD = dyn_cast_or_null<ObjCPropertyDecl>(D))
+      MigrateCtx.PropGCAttrs[PD] = MigrateCtx.GCAttrs.size() - 1;
+
     return true;
   }
 
index 1512e4e96d38840433b305cec6709365f09c0b12..f9f642ffc8992c744c7161d5eda32fd92993e75f 100644 (file)
@@ -127,7 +127,7 @@ public:
       PropsTy &props = I->second;
       if (!getPropertyType(props)->isObjCRetainableType())
         continue;
-      if (hasIvarWithExplicitOwnership(props))
+      if (hasIvarWithExplicitARCOwnership(props))
         continue;
       
       Transaction Trans(Pass.TA);
@@ -457,7 +457,10 @@ private:
     return false;
   }
 
-  bool hasIvarWithExplicitOwnership(PropsTy &props) const {
+  bool hasIvarWithExplicitARCOwnership(PropsTy &props) const {
+    if (Pass.isGCMigration())
+      return false;
+
     for (PropsTy::iterator I = props.begin(), E = props.end(); I != E; ++I) {
       if (isUserDeclared(I->IvarD)) {
         if (isa<AttributedType>(I->IvarD->getType()))
index 7960a7df2e2a5e20c488d5c062863807500a7b94..89716ad61da4ffecd8f911cfc6e254ab04e06d84 100644 (file)
@@ -94,9 +94,11 @@ public:
     bool FullyMigratable;
   };
   std::vector<GCAttrOccurrence> GCAttrs;
-
   llvm::DenseSet<unsigned> AttrSet;
 
+  /// \brief Map of property decl to the index in the GCAttrs vector.
+  llvm::DenseMap<ObjCPropertyDecl *, unsigned> PropGCAttrs;
+
   explicit MigrationContext(MigrationPass &pass) : Pass(pass) {}
   ~MigrationContext();