[arcmt] Map property decls to their GC attributes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143978 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/ARCMigrate/TransGCAttrs.cpp b/lib/ARCMigrate/TransGCAttrs.cpp
index 94eb878..70157ab 100644
--- a/lib/ARCMigrate/TransGCAttrs.cpp
+++ b/lib/ARCMigrate/TransGCAttrs.cpp
@@ -108,6 +108,10 @@
     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;
   }
 
diff --git a/lib/ARCMigrate/TransProperties.cpp b/lib/ARCMigrate/TransProperties.cpp
index 1512e4e..f9f642f 100644
--- a/lib/ARCMigrate/TransProperties.cpp
+++ b/lib/ARCMigrate/TransProperties.cpp
@@ -127,7 +127,7 @@
       PropsTy &props = I->second;
       if (!getPropertyType(props)->isObjCRetainableType())
         continue;
-      if (hasIvarWithExplicitOwnership(props))
+      if (hasIvarWithExplicitARCOwnership(props))
         continue;
       
       Transaction Trans(Pass.TA);
@@ -457,7 +457,10 @@
     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()))
diff --git a/lib/ARCMigrate/Transforms.h b/lib/ARCMigrate/Transforms.h
index 7960a7d..89716ad 100644
--- a/lib/ARCMigrate/Transforms.h
+++ b/lib/ARCMigrate/Transforms.h
@@ -94,9 +94,11 @@
     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();