diff options
Diffstat (limited to 'lib/ARCMigrate/TransGCAttrs.cpp')
-rw-r--r-- | lib/ARCMigrate/TransGCAttrs.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/ARCMigrate/TransGCAttrs.cpp b/lib/ARCMigrate/TransGCAttrs.cpp index 607e5a0f3d..1c645ace89 100644 --- a/lib/ARCMigrate/TransGCAttrs.cpp +++ b/lib/ARCMigrate/TransGCAttrs.cpp @@ -261,9 +261,12 @@ static void checkAllAtProps(MigrationContext &MigrateCtx, SmallVector<std::pair<AttributedTypeLoc, ObjCPropertyDecl *>, 4> ATLs; bool hasWeak = false, hasStrong = false; + ObjCPropertyDecl::PropertyAttributeKind + Attrs = ObjCPropertyDecl::OBJC_PR_noattr; for (IndivPropsTy::iterator PI = IndProps.begin(), PE = IndProps.end(); PI != PE; ++PI) { ObjCPropertyDecl *PD = *PI; + Attrs = PD->getPropertyAttributesAsWritten(); TypeSourceInfo *TInfo = PD->getTypeSourceInfo(); if (!TInfo) return; @@ -300,9 +303,10 @@ static void checkAllAtProps(MigrationContext &MigrateCtx, else toAttr = "unsafe_unretained"; } - if (!MigrateCtx.rewritePropertyAttribute("assign", toAttr, AtLoc)) { - return; - } + if (Attrs & ObjCPropertyDecl::OBJC_PR_assign) + MigrateCtx.rewritePropertyAttribute("assign", toAttr, AtLoc); + else + MigrateCtx.addPropertyAttribute(toAttr, AtLoc); } for (unsigned i = 0, e = ATLs.size(); i != e; ++i) { |