]> granicus.if.org Git - clang/commitdiff
objc migrator: More refinment of property
authorFariborz Jahanian <fjahanian@apple.com>
Wed, 10 Jul 2013 00:20:11 +0000 (00:20 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Wed, 10 Jul 2013 00:20:11 +0000 (00:20 +0000)
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

lib/Edit/RewriteObjCFoundationAPI.cpp
test/ARCMT/objcmt-property.m.result

index 05abbed14c3d75ec03d18ad8ede0c94c416ae2ea..e257a0b6f1c0d42b7431e31f842fd68a0c8296ad 100644 (file)
@@ -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());
index 49162a4691465a0192f44c5aa01a91531b477999..11912d950a28cf7c36aa79e368ab992aa6b683ce 100644 (file)
@@ -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