r195368 - ObjectiveC migrator. delegate property must be
Fariborz Jahanian
fjahanian at apple.com
Thu Nov 21 09:49:34 PST 2013
Author: fjahanian
Date: Thu Nov 21 11:49:34 2013
New Revision: 195368
URL: http://llvm.org/viewvc/llvm-project?rev=195368&view=rev
Log:
ObjectiveC migrator. delegate property must be
inferred as 'assign', not 'assign' and 'strong'.
// rdar://15509831
Modified:
cfe/trunk/lib/ARCMigrate/ObjCMT.cpp
cfe/trunk/test/ARCMT/objcmt-property.m
cfe/trunk/test/ARCMT/objcmt-property.m.result
Modified: cfe/trunk/lib/ARCMigrate/ObjCMT.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ARCMigrate/ObjCMT.cpp?rev=195368&r1=195367&r2=195368&view=diff
==============================================================================
--- cfe/trunk/lib/ARCMigrate/ObjCMT.cpp (original)
+++ cfe/trunk/lib/ARCMigrate/ObjCMT.cpp Thu Nov 21 11:49:34 2013
@@ -343,12 +343,9 @@ static void rewriteToObjCProperty(const
PropertyString += PropertyNameString;
}
// Property with no setter may be suggested as a 'readonly' property.
- if (!Setter) {
+ if (!Setter)
append_attr(PropertyString, "readonly", LParenAdded);
- QualType ResType = Context.getCanonicalType(Getter->getResultType());
- if (const char *MemoryManagementAttr = PropertyMemoryAttribute(Context, ResType))
- append_attr(PropertyString, MemoryManagementAttr, LParenAdded);
- }
+
// Short circuit 'delegate' properties that contain the name "delegate" or
// "dataSource", or have exact name "target" to have 'assign' attribute.
@@ -358,8 +355,11 @@ static void rewriteToObjCProperty(const
QualType QT = Getter->getResultType();
if (!QT->isRealType())
append_attr(PropertyString, "assign", LParenAdded);
- }
- else if (Setter) {
+ } else if (!Setter) {
+ QualType ResType = Context.getCanonicalType(Getter->getResultType());
+ if (const char *MemoryManagementAttr = PropertyMemoryAttribute(Context, ResType))
+ append_attr(PropertyString, MemoryManagementAttr, LParenAdded);
+ } else {
const ParmVarDecl *argDecl = *Setter->param_begin();
QualType ArgType = Context.getCanonicalType(argDecl->getType());
if (const char *MemoryManagementAttr = PropertyMemoryAttribute(Context, ArgType))
Modified: cfe/trunk/test/ARCMT/objcmt-property.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ARCMT/objcmt-property.m?rev=195368&r1=195367&r2=195368&view=diff
==============================================================================
--- cfe/trunk/test/ARCMT/objcmt-property.m (original)
+++ cfe/trunk/test/ARCMT/objcmt-property.m Thu Nov 21 11:49:34 2013
@@ -70,6 +70,9 @@ typedef char BOOL;
- (id) dataSource;
+// rdar://15509831
+- (id)delegate;
+
- (id)xxxdelegateYYY;
- (void)setXxxdelegateYYY:(id)delegate;
Modified: cfe/trunk/test/ARCMT/objcmt-property.m.result
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ARCMT/objcmt-property.m.result?rev=195368&r1=195367&r2=195368&view=diff
==============================================================================
--- cfe/trunk/test/ARCMT/objcmt-property.m.result (original)
+++ cfe/trunk/test/ARCMT/objcmt-property.m.result Thu Nov 21 11:49:34 2013
@@ -61,6 +61,9 @@ typedef char BOOL;
@property (nonatomic, assign) id dataSource;
+// rdar://15509831
+ at property (nonatomic, readonly, assign) id delegate;
+
@property (nonatomic, assign) id xxxdelegateYYY;
More information about the cfe-commits
mailing list