diff options
Diffstat (limited to 'lib/Bytecode/Reader/Reader.cpp')
-rw-r--r-- | lib/Bytecode/Reader/Reader.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Bytecode/Reader/Reader.cpp b/lib/Bytecode/Reader/Reader.cpp index c515c1575c..bf2b0118a3 100644 --- a/lib/Bytecode/Reader/Reader.cpp +++ b/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); |