diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2013-07-10 00:20:11 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2013-07-10 00:20:11 +0000 |
commit | e16a4755989ae3e4cf15c8b1ed265a546bf1b8bd (patch) | |
tree | 31c4a6bf89404f70da99d7af0397f282492d5c52 | |
parent | a967935303e6b36dcc0490073e47fdd5a5eff93e (diff) | |
download | clang-e16a4755989ae3e4cf15c8b1ed265a546bf1b8bd.tar.gz |
objc migrator: More refinment of property
attributes in migration. Specialli use of
'copy' attribute for retainable object types.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185985 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Edit/RewriteObjCFoundationAPI.cpp | 18 | ||||
-rw-r--r-- | test/ARCMT/objcmt-property.m.result | 10 |
2 files changed, 14 insertions, 14 deletions
diff --git a/lib/Edit/RewriteObjCFoundationAPI.cpp b/lib/Edit/RewriteObjCFoundationAPI.cpp index 05abbed14c..e257a0b6f1 100644 --- a/lib/Edit/RewriteObjCFoundationAPI.cpp +++ b/lib/Edit/RewriteObjCFoundationAPI.cpp @@ -362,16 +362,16 @@ bool edit::rewriteToObjCProperty(const ObjCMethodDecl *Getter, const ParmVarDecl *argDecl = *Setter->param_begin(); QualType ArgType = argDecl->getType(); Qualifiers::ObjCLifetime propertyLifetime = ArgType.getObjCLifetime(); - if (propertyLifetime != Qualifiers::OCL_None) { - PropertyString += "("; - if (propertyLifetime == Qualifiers::OCL_Strong) - PropertyString += "strong"; - else if (propertyLifetime == Qualifiers::OCL_Weak) - PropertyString += "weak"; - else - PropertyString += "unsafe_unretained"; - PropertyString += ")"; + + if (ArgType->isObjCRetainableType() && + propertyLifetime == Qualifiers::OCL_Strong) { + PropertyString += "(copy)"; } + else if (propertyLifetime == Qualifiers::OCL_Weak) + PropertyString += "(weak)"; + else + PropertyString += "(unsafe_unretained)"; + QualType PropQT = Getter->getResultType(); PropertyString += " "; PropertyString += PropQT.getAsString(NS.getASTContext().getPrintingPolicy()); diff --git a/test/ARCMT/objcmt-property.m.result b/test/ARCMT/objcmt-property.m.result index 49162a4691..11912d950a 100644 --- a/test/ARCMT/objcmt-property.m.result +++ b/test/ARCMT/objcmt-property.m.result @@ -12,7 +12,7 @@ @property(weak) NSString *__weak WeakProp; -@property(strong) NSString * StrongProp; +@property(copy) NSString * StrongProp; - (NSString *) UnavailProp __attribute__((unavailable)); @@ -42,8 +42,8 @@ -@property(strong) NSArray * names2; -@property(strong) NSArray * names3; -@property(strong) NSArray *__strong names4; -@property(strong) NSArray * names1; +@property(copy) NSArray * names2; +@property(copy) NSArray * names3; +@property(copy) NSArray *__strong names4; +@property(copy) NSArray * names1; @end |