diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-11-08 23:09:34 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-11-08 23:09:34 +0000 |
commit | 8b08eb34565a644d3345b1bfee3542a8f4a6c300 (patch) | |
tree | 264b769b93a22a3c6ba307c5bcf638d1d4b251e4 /lib/ARCMigrate | |
parent | a5493f885095bd63d525a7035ad1c224de3ae5f2 (diff) |
[arcmt] Take into account that all properties are strong-by-default now and fix the test.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144146 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ARCMigrate')
-rw-r--r-- | lib/ARCMigrate/TransProperties.cpp | 49 |
1 files changed, 7 insertions, 42 deletions
diff --git a/lib/ARCMigrate/TransProperties.cpp b/lib/ARCMigrate/TransProperties.cpp index f9c0206134..0686dd3c2e 100644 --- a/lib/ARCMigrate/TransProperties.cpp +++ b/lib/ARCMigrate/TransProperties.cpp @@ -50,11 +50,9 @@ class PropertiesRewriter { enum PropActionKind { PropAction_None, - PropAction_RetainToStrong, PropAction_RetainRemoved, PropAction_AssignRemoved, PropAction_AssignRewritten, - PropAction_MaybeAddStrong, PropAction_MaybeAddWeakOrUnsafe }; @@ -163,9 +161,6 @@ private: switch (kind) { case PropAction_None: return; - case PropAction_RetainToStrong: - rewriteAttribute("retain", "strong", atLoc); - return; case PropAction_RetainRemoved: removeAttribute("retain", atLoc); return; @@ -173,8 +168,6 @@ private: return removeAssignForDefaultStrong(props, atLoc); case PropAction_AssignRewritten: return rewriteAssign(props, atLoc); - case PropAction_MaybeAddStrong: - return maybeAddStrongAttr(props, atLoc); case PropAction_MaybeAddWeakOrUnsafe: return maybeAddWeakOrUnsafeUnretainedAttr(props, atLoc); } @@ -199,11 +192,8 @@ private: return; if (propAttrs & ObjCPropertyDecl::OBJC_PR_retain) { - if (propAttrs & ObjCPropertyDecl::OBJC_PR_readonly) - return doPropAction(PropAction_RetainToStrong, props, atLoc); - else - // strong is the default. - return doPropAction(PropAction_RetainRemoved, props, atLoc); + // strong is the default. + return doPropAction(PropAction_RetainRemoved, props, atLoc); } bool HasIvarAssignedAPlusOneObject = hasIvarAssignedAPlusOneObject(props); @@ -258,17 +248,13 @@ private: void maybeAddWeakOrUnsafeUnretainedAttr(PropsTy &props, SourceLocation atLoc) const { - ObjCPropertyDecl::PropertyAttributeKind propAttrs = getPropertyAttrs(props); - bool canUseWeak = canApplyWeak(Pass.Ctx, getPropertyType(props), /*AllowOnUnknownClass=*/Pass.isGCMigration()); - if (!(propAttrs & ObjCPropertyDecl::OBJC_PR_readonly) || - !hasAllIvarsBacked(props)) { - bool addedAttr = addAttribute(canUseWeak ? "weak" : "unsafe_unretained", - atLoc); - if (!addedAttr) - canUseWeak = false; - } + + bool addedAttr = addAttribute(canUseWeak ? "weak" : "unsafe_unretained", + atLoc); + if (!addedAttr) + canUseWeak = false; for (PropsTy::iterator I = props.begin(), E = props.end(); I != E; ++I) { if (isUserDeclared(I->IvarD)) @@ -284,27 +270,6 @@ private: } } - void maybeAddStrongAttr(PropsTy &props, SourceLocation atLoc) const { - ObjCPropertyDecl::PropertyAttributeKind propAttrs = getPropertyAttrs(props); - - if (!(propAttrs & ObjCPropertyDecl::OBJC_PR_readonly)) - return; // 'strong' by default. - - if (!hasAllIvarsBacked(props)) { - addAttribute("strong", atLoc); - } - - for (PropsTy::iterator I = props.begin(), E = props.end(); I != E; ++I) { - if (I->ImplD) { - Pass.TA.clearDiagnostic(diag::err_arc_assign_property_ownership, - I->ImplD->getLocation()); - Pass.TA.clearDiagnostic( - diag::err_arc_objc_property_default_assign_on_object, - I->ImplD->getLocation()); - } - } - } - bool removeAttribute(StringRef fromAttr, SourceLocation atLoc) const { return rewriteAttribute(fromAttr, StringRef(), atLoc); } |