diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-11-07 18:40:32 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-11-07 18:40:32 +0000 |
commit | bf8455c56cc5e328c31a2b56f5587cd0873ba0ae (patch) | |
tree | a44350cb04a276a1debaf548f60af76cca5c6e96 /lib/ARCMigrate | |
parent | 11cbe2a7fb565678fca456f6bc2d4648ced3adb3 (diff) |
[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
Diffstat (limited to 'lib/ARCMigrate')
-rw-r--r-- | lib/ARCMigrate/TransGCAttrs.cpp | 4 | ||||
-rw-r--r-- | lib/ARCMigrate/TransProperties.cpp | 7 | ||||
-rw-r--r-- | lib/ARCMigrate/Transforms.h | 4 |
3 files changed, 12 insertions, 3 deletions
diff --git a/lib/ARCMigrate/TransGCAttrs.cpp b/lib/ARCMigrate/TransGCAttrs.cpp index 94eb8781df..70157aba3d 100644 --- a/lib/ARCMigrate/TransGCAttrs.cpp +++ b/lib/ARCMigrate/TransGCAttrs.cpp @@ -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; } diff --git a/lib/ARCMigrate/TransProperties.cpp b/lib/ARCMigrate/TransProperties.cpp index 1512e4e96d..f9f642ffc8 100644 --- a/lib/ARCMigrate/TransProperties.cpp +++ b/lib/ARCMigrate/TransProperties.cpp @@ -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())) diff --git a/lib/ARCMigrate/Transforms.h b/lib/ARCMigrate/Transforms.h index 7960a7df2e..89716ad61d 100644 --- a/lib/ARCMigrate/Transforms.h +++ b/lib/ARCMigrate/Transforms.h @@ -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(); |