ObjectiveC migrator: tighten rule about when to
migrate to @property with getter name starting with
'is'.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188013 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/ARCMigrate/ObjCMT.cpp b/lib/ARCMigrate/ObjCMT.cpp
index 931f6ed..14d5cf6 100644
--- a/lib/ARCMigrate/ObjCMT.cpp
+++ b/lib/ARCMigrate/ObjCMT.cpp
@@ -318,10 +318,10 @@
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(),
diff --git a/test/ARCMT/objcmt-property.m b/test/ARCMT/objcmt-property.m
index 8453999..9a8bfa5 100644
--- a/test/ARCMT/objcmt-property.m
+++ b/test/ARCMT/objcmt-property.m
@@ -85,6 +85,6 @@
- (id) isAnObject;
- (void)setAnObject : (id) object;
-- (id)isxdelegateYYY;
-- (void)setXdelegateYYY:(id)delegate;
+- (BOOL) isinValid;
+- (void) setInValid : (BOOL) arg;
@end
diff --git a/test/ARCMT/objcmt-property.m.result b/test/ARCMT/objcmt-property.m.result
index 1cd771a..dcdf0da 100644
--- a/test/ARCMT/objcmt-property.m.result
+++ b/test/ARCMT/objcmt-property.m.result
@@ -82,9 +82,9 @@
@property(getter=isContinuous) BOOL continuous;
-@property(getter=isAnObject, retain) id anObject;
+- (id) isAnObject;
+- (void)setAnObject : (id) object;
-
-@property(getter=isxdelegateYYY, unsafe_unretained) id xdelegateYYY;
-
+- (BOOL) isinValid;
+- (void) setInValid : (BOOL) arg;
@end