summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2013-07-19 17:44:32 +0000
committerFariborz Jahanian <fjahanian@apple.com>2013-07-19 17:44:32 +0000
commit008ef72bee8718e45e331a856f7ba1492f655538 (patch)
tree3f68249ed476f45cb63a2f2ddb9a154e94059780 /clang/lib
parentdece1a5c5cada0117c0161f4900c8b1344ae5fb0 (diff)
downloadbcm5719-llvm-008ef72bee8718e45e331a856f7ba1492f655538.tar.gz
bcm5719-llvm-008ef72bee8718e45e331a856f7ba1492f655538.zip
Fixes an ObjC migrator crash when last decl
in file is an enum. llvm-svn: 186700
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/ARCMigrate/ObjCMT.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/clang/lib/ARCMigrate/ObjCMT.cpp b/clang/lib/ARCMigrate/ObjCMT.cpp
index 2f4a3e7401c..282006b5769 100644
--- a/clang/lib/ARCMigrate/ObjCMT.cpp
+++ b/clang/lib/ARCMigrate/ObjCMT.cpp
@@ -399,7 +399,7 @@ static bool rewriteToNSEnumDecl(const EnumDecl *EnumDcl,
return false;
}
-void ObjCMigrateASTConsumer::migrateProtocolConformance(ASTContext &Ctx,
+void ObjCMigrateASTConsumer::migrateProtocolConformance(ASTContext &Ctx,
const ObjCImplementationDecl *ImpDecl) {
const ObjCInterfaceDecl *IDecl = ImpDecl->getClassInterface();
if (!IDecl || ObjCProtocolDecls.empty())
@@ -514,8 +514,9 @@ void ObjCMigrateASTConsumer::HandleTranslationUnit(ASTContext &Ctx) {
else if (const EnumDecl *ED = dyn_cast<EnumDecl>(*D)) {
DeclContext::decl_iterator N = D;
++N;
- if (const TypedefDecl *TD = dyn_cast<TypedefDecl>(*N))
- migrateNSEnumDecl(Ctx, ED, TD);
+ if (N != DEnd)
+ if (const TypedefDecl *TD = dyn_cast<TypedefDecl>(*N))
+ migrateNSEnumDecl(Ctx, ED, TD);
}
}
OpenPOWER on IntegriCloud