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
diff --git a/lib/Edit/RewriteObjCFoundationAPI.cpp b/lib/Edit/RewriteObjCFoundationAPI.cpp
index 05abbed..e257a0b 100644
--- a/lib/Edit/RewriteObjCFoundationAPI.cpp
+++ b/lib/Edit/RewriteObjCFoundationAPI.cpp
@@ -362,16 +362,16 @@
   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());