r185985 - objc migrator: More refinment of property

Fariborz Jahanian fjahanian at apple.com
Tue Jul 9 17:20:11 PDT 2013


Author: fjahanian
Date: Tue Jul  9 19:20:11 2013
New Revision: 185985

URL: http://llvm.org/viewvc/llvm-project?rev=185985&view=rev
Log:
objc migrator: More refinment of property
attributes in migration. Specialli use of
'copy' attribute for retainable object types.


Modified:
    cfe/trunk/lib/Edit/RewriteObjCFoundationAPI.cpp
    cfe/trunk/test/ARCMT/objcmt-property.m.result

Modified: cfe/trunk/lib/Edit/RewriteObjCFoundationAPI.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Edit/RewriteObjCFoundationAPI.cpp?rev=185985&r1=185984&r2=185985&view=diff
==============================================================================
--- cfe/trunk/lib/Edit/RewriteObjCFoundationAPI.cpp (original)
+++ cfe/trunk/lib/Edit/RewriteObjCFoundationAPI.cpp Tue Jul  9 19:20:11 2013
@@ -362,16 +362,16 @@ bool edit::rewriteToObjCProperty(const O
   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());

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=185985&r1=185984&r2=185985&view=diff
==============================================================================
--- cfe/trunk/test/ARCMT/objcmt-property.m.result (original)
+++ cfe/trunk/test/ARCMT/objcmt-property.m.result Tue Jul  9 19:20:11 2013
@@ -12,7 +12,7 @@
 
 @property(weak) NSString *__weak WeakProp;
 
- at property(strong) NSString * StrongProp;
+ at property(copy) NSString * StrongProp;
 
 
 - (NSString *) UnavailProp  __attribute__((unavailable));
@@ -42,8 +42,8 @@
 
 
 
- at property(strong) NSArray * names2;
- at property(strong) NSArray * names3;
- at property(strong) NSArray *__strong names4;
- at property(strong) NSArray * names1;
+ at property(copy) NSArray * names2;
+ at property(copy) NSArray * names3;
+ at property(copy) NSArray *__strong names4;
+ at property(copy) NSArray * names1;
 @end





More information about the cfe-commits mailing list