diff options
| author | Fariborz Jahanian <fjahanian@apple.com> | 2013-07-19 17:44:32 +0000 |
|---|---|---|
| committer | Fariborz Jahanian <fjahanian@apple.com> | 2013-07-19 17:44:32 +0000 |
| commit | 008ef72bee8718e45e331a856f7ba1492f655538 (patch) | |
| tree | 3f68249ed476f45cb63a2f2ddb9a154e94059780 /clang/lib | |
| parent | dece1a5c5cada0117c0161f4900c8b1344ae5fb0 (diff) | |
| download | bcm5719-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.cpp | 7 |
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); } } |

