r186700 - Fixes an ObjC migrator crash when last decl
Fariborz Jahanian
fjahanian at apple.com
Fri Jul 19 10:44:32 PDT 2013
Author: fjahanian
Date: Fri Jul 19 12:44:32 2013
New Revision: 186700
URL: http://llvm.org/viewvc/llvm-project?rev=186700&view=rev
Log:
Fixes an ObjC migrator crash when last decl
in file is an enum.
Modified:
cfe/trunk/lib/ARCMigrate/ObjCMT.cpp
cfe/trunk/test/ARCMT/objcmt-ns-macros.m
cfe/trunk/test/ARCMT/objcmt-ns-macros.m.result
Modified: cfe/trunk/lib/ARCMigrate/ObjCMT.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ARCMigrate/ObjCMT.cpp?rev=186700&r1=186699&r2=186700&view=diff
==============================================================================
--- cfe/trunk/lib/ARCMigrate/ObjCMT.cpp (original)
+++ cfe/trunk/lib/ARCMigrate/ObjCMT.cpp Fri Jul 19 12:44:32 2013
@@ -399,7 +399,7 @@ static bool rewriteToNSEnumDecl(const En
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::HandleTrans
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);
}
}
Modified: cfe/trunk/test/ARCMT/objcmt-ns-macros.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ARCMT/objcmt-ns-macros.m?rev=186700&r1=186699&r2=186700&view=diff
==============================================================================
--- cfe/trunk/test/ARCMT/objcmt-ns-macros.m (original)
+++ cfe/trunk/test/ARCMT/objcmt-ns-macros.m Fri Jul 19 12:44:32 2013
@@ -27,3 +27,8 @@ enum {
typedef NSUInteger UITableViewCellStyle;
+enum {
+ UNOne,
+ UNTwo
+};
+
Modified: cfe/trunk/test/ARCMT/objcmt-ns-macros.m.result
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ARCMT/objcmt-ns-macros.m.result?rev=186700&r1=186699&r2=186700&view=diff
==============================================================================
--- cfe/trunk/test/ARCMT/objcmt-ns-macros.m.result (original)
+++ cfe/trunk/test/ARCMT/objcmt-ns-macros.m.result Fri Jul 19 12:44:32 2013
@@ -27,3 +27,8 @@ typedef NS_OPTIONS(NSUInteger, UITableVi
+enum {
+ UNOne,
+ UNTwo
+};
+
More information about the cfe-commits
mailing list