diff options
author | Chris Lattner <sabre@nondot.org> | 2004-12-04 05:28:27 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-12-04 05:28:27 +0000 |
commit | 8f97278c49b6fb85858ed860f2cbc4a102d3929b (patch) | |
tree | 460c911c2ef7327071bf0a764a79ed382eb38c8a /llvm/lib/Bytecode/Reader/Reader.cpp | |
parent | 73a1914131242bb2027b186bf875dc8b2e25bbbe (diff) | |
download | bcm5719-llvm-8f97278c49b6fb85858ed860f2cbc4a102d3929b.tar.gz bcm5719-llvm-8f97278c49b6fb85858ed860f2cbc4a102d3929b.zip |
Do not allow bytecode files with unresolved references to be read. Doing
so lets wierd ConstantPlaceholder objects sneak into the system which
confuses it greatly.
llvm-svn: 18487
Diffstat (limited to 'llvm/lib/Bytecode/Reader/Reader.cpp')
-rw-r--r-- | llvm/lib/Bytecode/Reader/Reader.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/llvm/lib/Bytecode/Reader/Reader.cpp b/llvm/lib/Bytecode/Reader/Reader.cpp index a5e70d911fd..a18019aca0a 100644 --- a/llvm/lib/Bytecode/Reader/Reader.cpp +++ b/llvm/lib/Bytecode/Reader/Reader.cpp @@ -1312,7 +1312,7 @@ Constant *BytecodeReader::ParseConstantValue(unsigned TypeID) { // Construct a ConstantExpr of the appropriate kind if (isExprNumArgs == 1) { // All one-operand expressions if (Opcode != Instruction::Cast) - error("Only Cast instruction has one argument for ConstantExpr"); + error("Only cast instruction has one argument for ConstantExpr"); Constant* Result = ConstantExpr::getCast(ArgVec[0], getType(TypeID)); if (Handler) Handler->handleConstantExpression(Opcode, ArgVec, Result); @@ -1568,6 +1568,12 @@ void BytecodeReader::ParseConstantPool(ValueTable &Tab, } } } + + // After we have finished parsing the constant pool, we had better not have + // any dangling references left. + if (!ConstantFwdRefs.empty()) + error("Unresolved constant references exist!"); + checkPastBlockEnd("Constant Pool"); if (Handler) Handler->handleGlobalConstantsEnd(); } |