r188013 - ObjectiveC migrator: tighten rule about when to

Fariborz Jahanian fjahanian at apple.com
Thu Aug 8 14:20:01 PDT 2013


Author: fjahanian
Date: Thu Aug  8 16:20:01 2013
New Revision: 188013

URL: http://llvm.org/viewvc/llvm-project?rev=188013&view=rev
Log:
ObjectiveC migrator: tighten rule about when to
migrate to @property with getter name starting with
'is'.

Modified:
    cfe/trunk/lib/ARCMigrate/ObjCMT.cpp
    cfe/trunk/test/ARCMT/objcmt-property.m
    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=188013&r1=188012&r2=188013&view=diff
==============================================================================
--- cfe/trunk/lib/ARCMigrate/ObjCMT.cpp (original)
+++ cfe/trunk/lib/ARCMigrate/ObjCMT.cpp Thu Aug  8 16:20:01 2013
@@ -318,10 +318,10 @@ void ObjCMigrateASTConsumer::migrateObjC
     if (!SetterMethod) {
       // try a different naming convention for getter: isXxxxx
       StringRef getterNameString = getterName->getName();
-      if (getterNameString.startswith("is")) {
+      if (getterNameString.startswith("is") && !GRT->isObjCRetainableType()) {
         GetterHasIsPrefix = true;
         const char *CGetterName = getterNameString.data() + 2;
-        if (CGetterName[0]) {
+        if (CGetterName[0] && isUppercase(CGetterName[0])) {
           getterName = &Ctx.Idents.get(CGetterName);
           SetterSelector =
             SelectorTable::constructSetterSelector(PP.getIdentifierTable(),

Modified: cfe/trunk/test/ARCMT/objcmt-property.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ARCMT/objcmt-property.m?rev=188013&r1=188012&r2=188013&view=diff
==============================================================================
--- cfe/trunk/test/ARCMT/objcmt-property.m (original)
+++ cfe/trunk/test/ARCMT/objcmt-property.m Thu Aug  8 16:20:01 2013
@@ -85,6 +85,6 @@ typedef char BOOL;
 - (id) isAnObject;
 - (void)setAnObject : (id) object;
 
-- (id)isxdelegateYYY;
-- (void)setXdelegateYYY:(id)delegate;
+- (BOOL) isinValid;
+- (void) setInValid : (BOOL) arg;
 @end

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=188013&r1=188012&r2=188013&view=diff
==============================================================================
--- cfe/trunk/test/ARCMT/objcmt-property.m.result (original)
+++ cfe/trunk/test/ARCMT/objcmt-property.m.result Thu Aug  8 16:20:01 2013
@@ -82,9 +82,9 @@ typedef char BOOL;
 @property(getter=isContinuous) BOOL continuous;
 
 
- at property(getter=isAnObject, retain) id anObject;
-
-
- at property(getter=isxdelegateYYY, unsafe_unretained) id xdelegateYYY;
+- (id) isAnObject;
+- (void)setAnObject : (id) object;
 
+- (BOOL) isinValid;
+- (void) setInValid : (BOOL) arg;
 @end





More information about the cfe-commits mailing list