add more checking
authorChris Lattner <sabre@nondot.org>
Thu, 24 Feb 2005 05:25:17 +0000 (05:25 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 24 Feb 2005 05:25:17 +0000 (05:25 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20296 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AsmParser/llvmAsmParser.y

index 239ae836254ab295128f15452e82b9934d4feae5..6014ae144f2b5ddf2ff9f746dfa0d565bd5d9ad8 100644 (file)
@@ -1815,8 +1815,12 @@ BBTerminatorInst : RET ResolvedVal {              // Return with a result...
 
     std::vector<std::pair<Constant*,BasicBlock*> >::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<ConstantInt>(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 '[' ']' {