diff options
| author | Fariborz Jahanian <fjahanian@apple.com> | 2013-11-21 17:49:34 +0000 |
|---|---|---|
| committer | Fariborz Jahanian <fjahanian@apple.com> | 2013-11-21 17:49:34 +0000 |
| commit | d9aef7883dae29c1b1ac2d5ad00372d72ece65ae (patch) | |
| tree | 9c2894b1100a395c3a251a291209478549c35a47 | |
| parent | cf4143b55e881519b06295e6954778d00f949c43 (diff) | |
| download | bcm5719-llvm-d9aef7883dae29c1b1ac2d5ad00372d72ece65ae.tar.gz bcm5719-llvm-d9aef7883dae29c1b1ac2d5ad00372d72ece65ae.zip | |
ObjectiveC migrator. delegate property must be
inferred as 'assign', not 'assign' and 'strong'.
// rdar://15509831
llvm-svn: 195368
| -rw-r--r-- | clang/lib/ARCMigrate/ObjCMT.cpp | 14 | ||||
| -rw-r--r-- | clang/test/ARCMT/objcmt-property.m | 3 | ||||
| -rw-r--r-- | clang/test/ARCMT/objcmt-property.m.result | 3 |
3 files changed, 13 insertions, 7 deletions
diff --git a/clang/lib/ARCMigrate/ObjCMT.cpp b/clang/lib/ARCMigrate/ObjCMT.cpp index f35e981d94e..ac423c2f268 100644 --- a/clang/lib/ARCMigrate/ObjCMT.cpp +++ b/clang/lib/ARCMigrate/ObjCMT.cpp @@ -343,12 +343,9 @@ static void rewriteToObjCProperty(const ObjCMethodDecl *Getter, 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 ObjCMethodDecl *Getter, 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)) diff --git a/clang/test/ARCMT/objcmt-property.m b/clang/test/ARCMT/objcmt-property.m index 3b77aadb892..61739efe0ab 100644 --- a/clang/test/ARCMT/objcmt-property.m +++ b/clang/test/ARCMT/objcmt-property.m @@ -70,6 +70,9 @@ typedef char BOOL; - (id) dataSource; +// rdar://15509831 +- (id)delegate; + - (id)xxxdelegateYYY; - (void)setXxxdelegateYYY:(id)delegate; diff --git a/clang/test/ARCMT/objcmt-property.m.result b/clang/test/ARCMT/objcmt-property.m.result index 1a82cb20525..eb2f5fea908 100644 --- a/clang/test/ARCMT/objcmt-property.m.result +++ b/clang/test/ARCMT/objcmt-property.m.result @@ -61,6 +61,9 @@ typedef char BOOL; @property (nonatomic, assign) id dataSource; +// rdar://15509831 +@property (nonatomic, readonly, assign) id delegate; + @property (nonatomic, assign) id xxxdelegateYYY; |

