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/Reader.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/Reader.cpp')
-rw-r--r-- | llvm/lib/Bytecode/Reader/Reader.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/Bytecode/Reader/Reader.cpp b/llvm/lib/Bytecode/Reader/Reader.cpp index c515c1575c5..bf2b0118a35 100644 --- a/llvm/lib/Bytecode/Reader/Reader.cpp +++ b/llvm/lib/Bytecode/Reader/Reader.cpp @@ -164,7 +164,10 @@ BasicBlock *BytecodeParser::getBasicBlock(unsigned ID) { /// Constant *BytecodeParser::getConstantValue(const Type *Ty, unsigned Slot) { if (Value *V = getValue(Ty, Slot, false)) - return dyn_cast<Constant>(V); // If we already have the value parsed... + if (Constant *C = dyn_cast<Constant>(V)) + return C; // If we already have the value parsed, just return it + else + throw std::string("Reference of a value is expected to be a constant!"); std::pair<const Type*, unsigned> Key(Ty, Slot); GlobalRefsType::iterator I = GlobalRefs.lower_bound(Key); |