From 69331f5726b653e3566768044c449c9461a6f11e Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Thu, 24 Feb 2005 05:25:17 +0000 Subject: [PATCH] add more checking git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20296 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/AsmParser/llvmAsmParser.y | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/AsmParser/llvmAsmParser.y b/lib/AsmParser/llvmAsmParser.y index 239ae836254..6014ae144f2 100644 --- a/lib/AsmParser/llvmAsmParser.y +++ b/lib/AsmParser/llvmAsmParser.y @@ -1815,8 +1815,12 @@ BBTerminatorInst : RET ResolvedVal { // Return with a result... std::vector >::iterator I = $8->begin(), E = $8->end(); - for (; I != E; ++I) - S->addCase(I->first, I->second); + for (; I != E; ++I) { + if (ConstantInt *CI = dyn_cast(I->first)) + S->addCase(CI, I->second); + else + ThrowException("Switch case is constant, but not a simple integer!"); + } delete $8; } | SWITCH IntType ValueRef ',' LABEL ValueRef '[' ']' {