diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-11-28 00:23:12 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-11-28 00:23:12 +0000 |
commit | 6d7d16d45c1d601483e46a77bd2fa1d199219721 (patch) | |
tree | d95a8e77fac2d31785d7ceb9cb1957767aa5a384 /lib/ARCMigrate/TransProperties.cpp | |
parent | 3fb91f6abd15b117dbd2c930f626fa87fe7a3b10 (diff) |
[arcmt] Don't add __weak if there is already a GC __weak and make sure to clear
__weak from a readonly property.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145210 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ARCMigrate/TransProperties.cpp')
-rw-r--r-- | lib/ARCMigrate/TransProperties.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/lib/ARCMigrate/TransProperties.cpp b/lib/ARCMigrate/TransProperties.cpp index 0686dd3c2e..8136b31d81 100644 --- a/lib/ARCMigrate/TransProperties.cpp +++ b/lib/ARCMigrate/TransProperties.cpp @@ -237,9 +237,12 @@ private: canUseWeak = false; for (PropsTy::iterator I = props.begin(), E = props.end(); I != E; ++I) { - if (isUserDeclared(I->IvarD)) - Pass.TA.insert(I->IvarD->getLocation(), - canUseWeak ? "__weak " : "__unsafe_unretained "); + if (isUserDeclared(I->IvarD)) { + if (I->IvarD && + I->IvarD->getType().getObjCLifetime() != Qualifiers::OCL_Weak) + Pass.TA.insert(I->IvarD->getLocation(), + canUseWeak ? "__weak " : "__unsafe_unretained "); + } if (I->ImplD) Pass.TA.clearDiagnostic(diag::err_arc_assign_property_ownership, I->ImplD->getLocation()); @@ -257,9 +260,12 @@ private: canUseWeak = false; for (PropsTy::iterator I = props.begin(), E = props.end(); I != E; ++I) { - if (isUserDeclared(I->IvarD)) - Pass.TA.insert(I->IvarD->getLocation(), - canUseWeak ? "__weak " : "__unsafe_unretained "); + if (isUserDeclared(I->IvarD)) { + if (I->IvarD && + I->IvarD->getType().getObjCLifetime() != Qualifiers::OCL_Weak) + Pass.TA.insert(I->IvarD->getLocation(), + canUseWeak ? "__weak " : "__unsafe_unretained "); + } if (I->ImplD) { Pass.TA.clearDiagnostic(diag::err_arc_assign_property_ownership, I->ImplD->getLocation()); |