[cfe-commits] r143978 - in /cfe/trunk/lib/ARCMigrate: TransGCAttrs.cpp TransProperties.cpp Transforms.h

Argyrios Kyrtzidis akyrtzi at gmail.com
Mon Nov 7 10:40:32 PST 2011


Author: akirtzidis
Date: Mon Nov  7 12:40:32 2011
New Revision: 143978

URL: http://llvm.org/viewvc/llvm-project?rev=143978&view=rev
Log:
[arcmt] Map property decls to their GC attributes.

Modified:
    cfe/trunk/lib/ARCMigrate/TransGCAttrs.cpp
    cfe/trunk/lib/ARCMigrate/TransProperties.cpp
    cfe/trunk/lib/ARCMigrate/Transforms.h

Modified: cfe/trunk/lib/ARCMigrate/TransGCAttrs.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ARCMigrate/TransGCAttrs.cpp?rev=143978&r1=143977&r2=143978&view=diff
==============================================================================
--- cfe/trunk/lib/ARCMigrate/TransGCAttrs.cpp (original)
+++ cfe/trunk/lib/ARCMigrate/TransGCAttrs.cpp Mon Nov  7 12:40:32 2011
@@ -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;
   }
 

Modified: cfe/trunk/lib/ARCMigrate/TransProperties.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ARCMigrate/TransProperties.cpp?rev=143978&r1=143977&r2=143978&view=diff
==============================================================================
--- cfe/trunk/lib/ARCMigrate/TransProperties.cpp (original)
+++ cfe/trunk/lib/ARCMigrate/TransProperties.cpp Mon Nov  7 12:40:32 2011
@@ -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()))

Modified: cfe/trunk/lib/ARCMigrate/Transforms.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ARCMigrate/Transforms.h?rev=143978&r1=143977&r2=143978&view=diff
==============================================================================
--- cfe/trunk/lib/ARCMigrate/Transforms.h (original)
+++ cfe/trunk/lib/ARCMigrate/Transforms.h Mon Nov  7 12:40:32 2011
@@ -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();
   





More information about the cfe-commits mailing list