r190881 - ObjectiveC migrator: Don't infer a property from isXXX method
Fariborz Jahanian
fjahanian at apple.com
Tue Sep 17 12:38:56 PDT 2013
Author: fjahanian
Date: Tue Sep 17 14:38:55 2013
New Revision: 190881
URL: http://llvm.org/viewvc/llvm-project?rev=190881&view=rev
Log:
ObjectiveC migrator: Don't infer a property from isXXX method
of retainable object (readonly or otherwise).
Modified:
cfe/trunk/lib/ARCMigrate/ObjCMT.cpp
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=190881&r1=190880&r2=190881&view=diff
==============================================================================
--- cfe/trunk/lib/ARCMigrate/ObjCMT.cpp (original)
+++ cfe/trunk/lib/ARCMigrate/ObjCMT.cpp Tue Sep 17 14:38:55 2013
@@ -741,8 +741,11 @@ bool ObjCMigrateASTConsumer::migrateProp
// try a different naming convention for getter: isXxxxx
StringRef getterNameString = getterName->getName();
bool IsPrefix = getterNameString.startswith("is");
- if ((IsPrefix && !GRT->isObjCRetainableType()) ||
- getterNameString.startswith("get")) {
+ // Note that we don't want to change an isXXX method of retainable object
+ // type to property (readonly or otherwise).
+ if (IsPrefix && GRT->isObjCRetainableType())
+ return false;
+ if (IsPrefix || getterNameString.startswith("get")) {
LengthOfPrefix = (IsPrefix ? 2 : 3);
const char *CGetterName = getterNameString.data() + LengthOfPrefix;
// Make sure that first character after "is" or "get" prefix can
@@ -759,6 +762,7 @@ bool ObjCMigrateASTConsumer::migrateProp
}
}
}
+
if (SetterMethod) {
// Is this a valid setter, matching the target getter?
QualType SRT = SetterMethod->getResultType();
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=190881&r1=190880&r2=190881&view=diff
==============================================================================
--- cfe/trunk/test/ARCMT/objcmt-property.m.result (original)
+++ cfe/trunk/test/ARCMT/objcmt-property.m.result Tue Sep 17 14:38:55 2013
@@ -86,7 +86,7 @@ typedef char BOOL;
@property(nonatomic, getter=isContinuous) BOOL continuous;
- at property(nonatomic, readonly) id isAnObject;
+- (id) isAnObject;
- (void)setAnObject : (id) object;
@property(nonatomic, getter=isinValid, readonly) BOOL inValid;
@@ -138,7 +138,7 @@ typedef char BOOL;
@property(nonatomic, getter=isContinuous) BOOL continuous;
- at property(nonatomic, readonly) id isAnObject;
+- (id) isAnObject;
- (void)setAnObject : (id) object;
@property(nonatomic, getter=isinValid, readonly) BOOL inValid;
More information about the cfe-commits
mailing list