aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-10-10 03:56:01 +0000
committerChris Lattner <sabre@nondot.org>2003-10-10 03:56:01 +0000
commit0f3bc5ecc2730d917cb420af1027d7bf19c82d40 (patch)
tree3d73f412e65da1e59aaf1f4612e0ab033ba89bbf
parent987e49c6d0d4df3122c8f45642a6b2923ec73c9e (diff)
downloadexternal_llvm-0f3bc5ecc2730d917cb420af1027d7bf19c82d40.zip
external_llvm-0f3bc5ecc2730d917cb420af1027d7bf19c82d40.tar.gz
external_llvm-0f3bc5ecc2730d917cb420af1027d7bf19c82d40.tar.bz2
Add better checking
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8996 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/AsmParser/llvmAsmParser.y6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/AsmParser/llvmAsmParser.y b/lib/AsmParser/llvmAsmParser.y
index 773ea7a..4543fcd 100644
--- a/lib/AsmParser/llvmAsmParser.y
+++ b/lib/AsmParser/llvmAsmParser.y
@@ -1060,6 +1060,9 @@ ConstVal : SIntType EINT64VAL { // integral constants
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 @@ InstVal : ArithmeticOps Types ValueRef ',' ValueRef {
$$ = 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;
}