mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-13 04:38:24 +00:00
Change getConstantValue to throw an exception on error, not return null
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8988 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -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);
|
||||
|
Reference in New Issue
Block a user