ObjectiveC migrator: Don't infer a property from isXXX method

of retainable object (readonly or otherwise).

llvm-svn: 190881
This commit is contained in:
Fariborz Jahanian 2013-09-17 19:38:55 +00:00
parent 85230d50f2
commit 4c3d9c5e24
2 changed files with 8 additions and 4 deletions

View File

@ -741,8 +741,11 @@ bool ObjCMigrateASTConsumer::migrateProperty(ASTContext &Ctx,
// 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::migrateProperty(ASTContext &Ctx,
}
}
}
if (SetterMethod) {
// Is this a valid setter, matching the target getter?
QualType SRT = SetterMethod->getResultType();

View File

@ -86,7 +86,7 @@ typedef char BOOL;
@property(nonatomic, getter=isContinuous) BOOL continuous;
@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;
@property(nonatomic, readonly) id isAnObject;
- (id) isAnObject;
- (void)setAnObject : (id) object;
@property(nonatomic, getter=isinValid, readonly) BOOL inValid;