ObjectiveC migrator. Minor clean up of my last patch.

No functional change.

llvm-svn: 192933
This commit is contained in:
Fariborz Jahanian 2013-10-17 23:13:13 +00:00
parent 36ea1dd4fc
commit 403425bba8
1 changed files with 17 additions and 17 deletions

View File

@ -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,19 +1526,21 @@ void ObjCMigrateASTConsumer::HandleTranslationUnit(ASTContext &Ctx) {
migrateNSEnumDecl(Ctx, ED, /*TypedefDecl */0);
}
else if (const TypedefDecl *TD = dyn_cast<TypedefDecl>(*D)) {
if (ASTMigrateActions & FrontendOptions::ObjCMT_NsMacros) {
if (!(ASTMigrateActions & FrontendOptions::ObjCMT_NsMacros))
continue;
DeclContext::decl_iterator N = D;
if (++N != DEnd)
if (++N == DEnd)
continue;
if (const EnumDecl *ED = dyn_cast<EnumDecl>(*N)) {
if (++N != DEnd) {
if (const TypedefDecl *TD1 = dyn_cast<TypedefDecl>(*N)) {
if (migrateNSEnumDecl(Ctx, ED, TD1)) {
if (++N != DEnd)
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;
}
}
}
if (migrateNSEnumDecl(Ctx, ED, TD)) {
++D;
continue;
@ -1547,7 +1548,6 @@ void ObjCMigrateASTConsumer::HandleTranslationUnit(ASTContext &Ctx) {
}
CacheObjCNSIntegerTypedefed(TD);
}
}
else if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(*D)) {
if (ASTMigrateActions & FrontendOptions::ObjCMT_Annotation)
migrateCFAnnotation(Ctx, FD);