summaryrefslogtreecommitdiffstats
path: root/clang/lib/ARCMigrate
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2013-10-17 23:13:13 +0000
committerFariborz Jahanian <fjahanian@apple.com>2013-10-17 23:13:13 +0000
commit403425bba8939ecbf217f3f9e6b1ceb6ad45f16b (patch)
tree2d4126f75573e75d4172cfb50ed6197b641ff3f6 /clang/lib/ARCMigrate
parent36ea1dd4fc5e193d0eb7f6bf69f15d3779b6da24 (diff)
downloadbcm5719-llvm-403425bba8939ecbf217f3f9e6b1ceb6ad45f16b.tar.gz
bcm5719-llvm-403425bba8939ecbf217f3f9e6b1ceb6ad45f16b.zip
ObjectiveC migrator. Minor clean up of my last patch.
No functional change. llvm-svn: 192933
Diffstat (limited to 'clang/lib/ARCMigrate')
-rw-r--r--clang/lib/ARCMigrate/ObjCMT.cpp34
1 files changed, 17 insertions, 17 deletions
diff --git a/clang/lib/ARCMigrate/ObjCMT.cpp b/clang/lib/ARCMigrate/ObjCMT.cpp
index 8356fb65921..382bab759af 100644
--- a/clang/lib/ARCMigrate/ObjCMT.cpp
+++ b/clang/lib/ARCMigrate/ObjCMT.cpp
@@ -575,7 +575,7 @@ static bool rewriteToNSEnumDecl(const EnumDecl *EnumDcl,
return false;
}
-static bool rewriteToNSMacroDecl(const EnumDecl *EnumDcl,
+static void rewriteToNSMacroDecl(const EnumDecl *EnumDcl,
const TypedefDecl *TypedefDcl,
const NSAPI &NS, edit::Commit &commit,
bool IsNSIntegerType) {
@@ -587,7 +587,6 @@ static bool rewriteToNSMacroDecl(const EnumDecl *EnumDcl,
commit.replace(R, ClassString);
SourceLocation TypedefLoc = TypedefDcl->getLocEnd();
commit.remove(SourceRange(TypedefLoc, TypedefLoc));
- return true;
}
static bool UseNSOptionsMacro(Preprocessor &PP, ASTContext &Ctx,
@@ -1527,26 +1526,27 @@ void ObjCMigrateASTConsumer::HandleTranslationUnit(ASTContext &Ctx) {
migrateNSEnumDecl(Ctx, ED, /*TypedefDecl */0);
}
else if (const TypedefDecl *TD = dyn_cast<TypedefDecl>(*D)) {
- if (ASTMigrateActions & FrontendOptions::ObjCMT_NsMacros) {
- DeclContext::decl_iterator N = D;
+ if (!(ASTMigrateActions & FrontendOptions::ObjCMT_NsMacros))
+ continue;
+ DeclContext::decl_iterator N = D;
+ if (++N == DEnd)
+ continue;
+ if (const EnumDecl *ED = dyn_cast<EnumDecl>(*N)) {
if (++N != DEnd)
- if (const EnumDecl *ED = dyn_cast<EnumDecl>(*N)) {
- if (++N != DEnd) {
- if (const TypedefDecl *TD1 = dyn_cast<TypedefDecl>(*N)) {
- if (migrateNSEnumDecl(Ctx, ED, TD1)) {
- ++D; ++D;
- CacheObjCNSIntegerTypedefed(TD);
- continue;
- }
- }
- }
- if (migrateNSEnumDecl(Ctx, ED, TD)) {
- ++D;
+ if (const TypedefDecl *TDF = dyn_cast<TypedefDecl>(*N)) {
+ // prefer typedef-follows-enum to enum-follows-typedef pattern.
+ if (migrateNSEnumDecl(Ctx, ED, TDF)) {
+ ++D; ++D;
+ CacheObjCNSIntegerTypedefed(TD);
continue;
}
}
- CacheObjCNSIntegerTypedefed(TD);
+ if (migrateNSEnumDecl(Ctx, ED, TD)) {
+ ++D;
+ continue;
+ }
}
+ CacheObjCNSIntegerTypedefed(TD);
}
else if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(*D)) {
if (ASTMigrateActions & FrontendOptions::ObjCMT_Annotation)
OpenPOWER on IntegriCloud