r197102 - Objective-C migrator: when inferring 'readonly' property of an

Fariborz Jahanian fjahanian at apple.com
Wed Dec 11 17:02:01 PST 2013


Author: fjahanian
Date: Wed Dec 11 19:02:00 2013
New Revision: 197102

URL: http://llvm.org/viewvc/llvm-project?rev=197102&view=rev
Log:
Objective-C migrator: when inferring 'readonly' property of an
Objective-C object conforming to 'NSCopying' protocol, infer
a 'copy' property, instead of 'strong'. // rdar://15525937

Modified:
    cfe/trunk/lib/ARCMigrate/ObjCMT.cpp
    cfe/trunk/test/ARCMT/objcmt-atomic-property.m.result
    cfe/trunk/test/ARCMT/objcmt-ns-nonatomic-iosonly.m.result
    cfe/trunk/test/ARCMT/objcmt-property.m.result

Modified: cfe/trunk/lib/ARCMigrate/ObjCMT.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ARCMigrate/ObjCMT.cpp?rev=197102&r1=197101&r2=197102&view=diff
==============================================================================
--- cfe/trunk/lib/ARCMigrate/ObjCMT.cpp (original)
+++ cfe/trunk/lib/ARCMigrate/ObjCMT.cpp Wed Dec 11 19:02:00 2013
@@ -324,7 +324,9 @@ void MigrateBlockOrFunctionPointerTypeVa
 static const char *PropertyMemoryAttribute(ASTContext &Context, QualType ArgType) {
   Qualifiers::ObjCLifetime propertyLifetime = ArgType.getObjCLifetime();
   bool RetainableObject = ArgType->isObjCRetainableType();
-  if (RetainableObject && propertyLifetime == Qualifiers::OCL_Strong) {
+  if (RetainableObject &&
+      (propertyLifetime == Qualifiers::OCL_Strong
+       || propertyLifetime == Qualifiers::OCL_None)) {
     if (const ObjCObjectPointerType *ObjPtrTy =
         ArgType->getAs<ObjCObjectPointerType>()) {
       ObjCInterfaceDecl *IDecl = ObjPtrTy->getObjectType()->getInterface();

Modified: cfe/trunk/test/ARCMT/objcmt-atomic-property.m.result
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ARCMT/objcmt-atomic-property.m.result?rev=197102&r1=197101&r2=197102&view=diff
==============================================================================
--- cfe/trunk/test/ARCMT/objcmt-atomic-property.m.result (original)
+++ cfe/trunk/test/ARCMT/objcmt-atomic-property.m.result Wed Dec 11 19:02:00 2013
@@ -87,7 +87,7 @@ typedef char BOOL;
 
 @property (getter=getStringValue, strong) NSString *stringValue;
 @property (getter=getCounterValue, readonly) BOOL counterValue;
- at property (getter=getns_dixtionary, readonly, strong) NSDictionary *ns_dixtionary;
+ at property (getter=getns_dixtionary, readonly, copy) NSDictionary *ns_dixtionary;
 
 - (BOOL)is3bar; // watch out
 - (NSString *)get3foo; // watch out

Modified: cfe/trunk/test/ARCMT/objcmt-ns-nonatomic-iosonly.m.result
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ARCMT/objcmt-ns-nonatomic-iosonly.m.result?rev=197102&r1=197101&r2=197102&view=diff
==============================================================================
--- cfe/trunk/test/ARCMT/objcmt-ns-nonatomic-iosonly.m.result (original)
+++ cfe/trunk/test/ARCMT/objcmt-ns-nonatomic-iosonly.m.result Wed Dec 11 19:02:00 2013
@@ -94,7 +94,7 @@ typedef char BOOL;
 
 @property (NS_NONATOMIC_IOSONLY, getter=getStringValue, strong) NSString *stringValue;
 @property (NS_NONATOMIC_IOSONLY, getter=getCounterValue, readonly) BOOL counterValue;
- at property (NS_NONATOMIC_IOSONLY, getter=getns_dixtionary, readonly, strong) NSDictionary *ns_dixtionary;
+ at property (NS_NONATOMIC_IOSONLY, getter=getns_dixtionary, readonly, copy) NSDictionary *ns_dixtionary;
 
 - (BOOL)is3bar; // watch out
 - (NSString *)get3foo; // watch out

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=197102&r1=197101&r2=197102&view=diff
==============================================================================
--- cfe/trunk/test/ARCMT/objcmt-property.m.result (original)
+++ cfe/trunk/test/ARCMT/objcmt-property.m.result Wed Dec 11 19:02:00 2013
@@ -90,7 +90,7 @@ typedef char BOOL;
 
 @property (nonatomic, getter=getStringValue, strong) NSString *stringValue;
 @property (nonatomic, getter=getCounterValue, readonly) BOOL counterValue;
- at property (nonatomic, getter=getns_dixtionary, readonly, strong) NSDictionary *ns_dixtionary;
+ at property (nonatomic, getter=getns_dixtionary, readonly, copy) NSDictionary *ns_dixtionary;
 
 - (BOOL)is3bar; // watch out
 - (NSString *)get3foo; // watch out





More information about the cfe-commits mailing list