Fixes an ObjC migrator crash when last decl

in file is an enum.

llvm-svn: 186700
This commit is contained in:
Fariborz Jahanian 2013-07-19 17:44:32 +00:00
parent dece1a5c5c
commit 008ef72bee
3 changed files with 14 additions and 3 deletions

View File

@ -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);
}
}

View File

@ -27,3 +27,8 @@ enum {
typedef NSUInteger UITableViewCellStyle;
enum {
UNOne,
UNTwo
};

View File

@ -27,3 +27,8 @@ typedef NS_OPTIONS(NSUInteger, UITableViewCellStyle) {
enum {
UNOne,
UNTwo
};