Chromium Code Reviews| Index: src/PNaClTranslator.cpp |
| diff --git a/src/PNaClTranslator.cpp b/src/PNaClTranslator.cpp |
| index 023a433119266995c2ba026c305db89d07112148..f31f78a0f92bb1ac19de27e316c9141c5c1e3da2 100644 |
| --- a/src/PNaClTranslator.cpp |
| +++ b/src/PNaClTranslator.cpp |
| @@ -1298,16 +1298,14 @@ public: |
| if (Index < CachedNumGlobalValueIDs) { |
| return Context->getGlobalConstantByID(Index); |
| } |
| + if (isIRGenerationDisabled()) |
| + return nullptr; |
| NaClBcIndexSize_t LocalIndex = Index - CachedNumGlobalValueIDs; |
| + if (LocalIndex >= LocalOperands.size()) |
| + reportGetOperandUndefined(Index); |
| Ice::Operand *Op = LocalOperands[LocalIndex]; |
| - if (Op == nullptr) { |
| - if (isIRGenerationDisabled()) |
| - return nullptr; |
| - std::string Buffer; |
| - raw_string_ostream StrBuf(Buffer); |
| - StrBuf << "Value index " << Index << " not defined!"; |
| - Fatal(StrBuf.str()); |
| - } |
| + if (Op == nullptr) |
| + reportGetOperandUndefined(Index); |
| return Op; |
| } |
| @@ -2004,8 +2002,18 @@ private: |
| Ice::Variable *Var = getNextInstVar(Ty); |
| CurrentNode->appendInst(Ice::InstAssign::create(Func.get(), Var, Var)); |
| } |
| + |
| + Ice::Operand *reportGetOperandUndefined(NaClBcIndexSize_t Index); |
|
Jim Stichnoth
2015/09/16 19:57:41
Seems a little odd not to just provide the definit
Karl
2015/09/16 20:47:29
Done.
|
| }; |
| +Ice::Operand * |
| +FunctionParser::reportGetOperandUndefined(NaClBcIndexSize_t Index) { |
| + std::string Buffer; |
| + raw_string_ostream StrBuf(Buffer); |
| + StrBuf << "Value index " << Index << " not defined!"; |
| + Fatal(StrBuf.str()); |
| +} |
| + |
| void FunctionParser::ExitBlock() { |
| // Check if the last instruction in the function was terminating. |
| if (!InstIsTerminating) { |