diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2014-05-21 00:24:20 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2014-05-21 00:24:20 +0000 |
commit | c02a0dbe41c0d910ef8f16f40a60d5dc49cf984d (patch) | |
tree | ca88772d00e74d5d0d57689700b559b2fe5ed356 /clang/lib/ARCMigrate | |
parent | dc3e9c75fe78d186e4bb88d0d28cceba4fb9c8b5 (diff) | |
download | bcm5719-llvm-c02a0dbe41c0d910ef8f16f40a60d5dc49cf984d.tar.gz bcm5719-llvm-c02a0dbe41c0d910ef8f16f40a60d5dc49cf984d.zip |
[objcmt] Make sure we don't edit the return type to add 'instancetype' if the return type is already that.
rdar://16961577
llvm-svn: 209264
Diffstat (limited to 'clang/lib/ARCMigrate')
-rw-r--r-- | clang/lib/ARCMigrate/ObjCMT.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/clang/lib/ARCMigrate/ObjCMT.cpp b/clang/lib/ARCMigrate/ObjCMT.cpp index 81cb9da262b..a52c32f08fa 100644 --- a/clang/lib/ARCMigrate/ObjCMT.cpp +++ b/clang/lib/ARCMigrate/ObjCMT.cpp @@ -830,8 +830,12 @@ bool ObjCMigrateASTConsumer::migrateNSEnumDecl(ASTContext &Ctx, return Res; } -static void ReplaceWithInstancetype(const ObjCMigrateASTConsumer &ASTC, +static void ReplaceWithInstancetype(ASTContext &Ctx, + const ObjCMigrateASTConsumer &ASTC, ObjCMethodDecl *OM) { + if (OM->getReturnType() == Ctx.getObjCInstanceType()) + return; // already has instancetype. + SourceRange R; std::string ClassString; if (TypeSourceInfo *TSInfo = OM->getReturnTypeSourceInfo()) { @@ -893,7 +897,7 @@ void ObjCMigrateASTConsumer::migrateMethodInstanceType(ASTContext &Ctx, return; case OIT_Init: if (OM->getReturnType()->isObjCIdType()) - ReplaceWithInstancetype(*this, OM); + ReplaceWithInstancetype(Ctx, *this, OM); return; case OIT_ReturnsSelf: migrateFactoryMethod(Ctx, CDecl, OM, OIT_ReturnsSelf); @@ -914,7 +918,7 @@ void ObjCMigrateASTConsumer::migrateMethodInstanceType(ASTContext &Ctx, migrateFactoryMethod(Ctx, CDecl, OM); return; } - ReplaceWithInstancetype(*this, OM); + ReplaceWithInstancetype(Ctx, *this, OM); } static bool TypeIsInnerPointer(QualType T) { @@ -1224,7 +1228,7 @@ void ObjCMigrateASTConsumer::migrateFactoryMethod(ASTContext &Ctx, if (OIT_Family == OIT_ReturnsSelf) ReplaceWithClasstype(*this, OM); else - ReplaceWithInstancetype(*this, OM); + ReplaceWithInstancetype(Ctx, *this, OM); } static bool IsVoidStarType(QualType Ty) { |