[llvm-commits] CVS: llvm/lib/AsmParser/llvmAsmParser.y

Chris Lattner lattner at cs.uiuc.edu
Thu Oct 9 22:57:01 PDT 2003


Changes in directory llvm/lib/AsmParser:

llvmAsmParser.y updated: 1.125 -> 1.126

---
Log message:

Add better checking


---
Diffs of the changes:  (+6 -0)

Index: llvm/lib/AsmParser/llvmAsmParser.y
diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.125 llvm/lib/AsmParser/llvmAsmParser.y:1.126
--- llvm/lib/AsmParser/llvmAsmParser.y:1.125	Thu Oct  2 14:00:34 2003
+++ llvm/lib/AsmParser/llvmAsmParser.y	Thu Oct  9 22:56:01 2003
@@ -1060,6 +1060,9 @@
 
 
 ConstExpr: CAST '(' ConstVal TO Types ')' {
+    if (!$5->get()->isFirstClassType())
+      ThrowException("cast constant expression to a non-primitive type: '" +
+                     $5->get()->getDescription() + "'!");
     $$ = ConstantExpr::getCast($3, $5->get());
     delete $5;
   }
@@ -1632,6 +1635,9 @@
     $$ = new ShiftInst($1, $2, $4);
   }
   | CAST ResolvedVal TO Types {
+    if (!$4->get()->isFirstClassType())
+      ThrowException("cast instruction to a non-primitive type: '" +
+                     $4->get()->getDescription() + "'!");
     $$ = new CastInst($2, *$4);
     delete $4;
   }





More information about the llvm-commits mailing list