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 | 0dd98a4c518eb93a7f5ddbd9b2f0ca76d99914e8 (patch) | |
tree | 331f16f096c57d453b13345108d32e9d095ff22b /clang/lib | |
parent | 8b626ba6debca8648eb2f6a3cc679cc12597c9c9 (diff) | |
download | bcm5719-llvm-0dd98a4c518eb93a7f5ddbd9b2f0ca76d99914e8.tar.gz bcm5719-llvm-0dd98a4c518eb93a7f5ddbd9b2f0ca76d99914e8.zip |
[arcmt] Map property decls to their GC attributes.
llvm-svn: 143978
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/ARCMigrate/TransGCAttrs.cpp | 4 | ||||
-rw-r--r-- | clang/lib/ARCMigrate/TransProperties.cpp | 7 | ||||
-rw-r--r-- | clang/lib/ARCMigrate/Transforms.h | 4 |
3 files changed, 12 insertions, 3 deletions
diff --git a/clang/lib/ARCMigrate/TransGCAttrs.cpp b/clang/lib/ARCMigrate/TransGCAttrs.cpp index 94eb8781dfe..70157aba3d6 100644 --- a/clang/lib/ARCMigrate/TransGCAttrs.cpp +++ b/clang/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/clang/lib/ARCMigrate/TransProperties.cpp b/clang/lib/ARCMigrate/TransProperties.cpp index 1512e4e96d3..f9f642ffc89 100644 --- a/clang/lib/ARCMigrate/TransProperties.cpp +++ b/clang/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/clang/lib/ARCMigrate/Transforms.h b/clang/lib/ARCMigrate/Transforms.h index 7960a7df2e2..89716ad61da 100644 --- a/clang/lib/ARCMigrate/Transforms.h +++ b/clang/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(); |