diff options
| author | Chris Lattner <sabre@nondot.org> | 2003-10-09 20:41:16 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2003-10-09 20:41:16 +0000 |
| commit | 1ae8a48a62b65106a22b14154fbd749ee79cad2e (patch) | |
| tree | a7fe22dec6830b84c680639bfaf8980f3acb217e /llvm/lib/Bytecode/Reader/ConstantReader.cpp | |
| parent | 47be980aec78d7a65c3acfd21df6e46ec2f16850 (diff) | |
| download | bcm5719-llvm-1ae8a48a62b65106a22b14154fbd749ee79cad2e.tar.gz bcm5719-llvm-1ae8a48a62b65106a22b14154fbd749ee79cad2e.zip | |
Change getConstantValue to throw an exception on error, not return null
llvm-svn: 8988
Diffstat (limited to 'llvm/lib/Bytecode/Reader/ConstantReader.cpp')
| -rw-r--r-- | llvm/lib/Bytecode/Reader/ConstantReader.cpp | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/llvm/lib/Bytecode/Reader/ConstantReader.cpp b/llvm/lib/Bytecode/Reader/ConstantReader.cpp index 4b6e998fed1..2689362fea6 100644 --- a/llvm/lib/Bytecode/Reader/ConstantReader.cpp +++ b/llvm/lib/Bytecode/Reader/ConstantReader.cpp @@ -165,9 +165,7 @@ Constant *BytecodeParser::parseConstantValue(const unsigned char *&Buf, << ArgValSlot << "\n"); // Get the arg value from its slot if it exists, otherwise a placeholder - Constant *C = getConstantValue(ArgTy, ArgValSlot); - if (C == 0) throw std::string("No arg value or placeholder found."); - ArgVec.push_back(C); + ArgVec.push_back(getConstantValue(ArgTy, ArgValSlot)); } // Construct a ConstantExpr of the appropriate kind @@ -241,9 +239,7 @@ Constant *BytecodeParser::parseConstantValue(const unsigned char *&Buf, while (NumElements--) { // Read all of the elements of the constant. unsigned Slot; if (read_vbr(Buf, EndBuf, Slot)) throw Error_readvbr; - Constant *C = getConstantValue(AT->getElementType(), Slot); - if (!C) throw std::string("Unable to get const value of array slot."); - Elements.push_back(C); + Elements.push_back(getConstantValue(AT->getElementType(), Slot)); } return ConstantArray::get(AT, Elements); } @@ -256,9 +252,7 @@ Constant *BytecodeParser::parseConstantValue(const unsigned char *&Buf, for (unsigned i = 0; i < ET.size(); ++i) { unsigned Slot; if (read_vbr(Buf, EndBuf, Slot)) throw Error_readvbr; - Constant *C = getConstantValue(ET[i], Slot); - if (!C) throw std::string("Could not read const value in struct slot."); - Elements.push_back(C); + Elements.push_back(getConstantValue(ET[i], Slot)); } return ConstantStruct::get(ST, Elements); |

