Chromium Code Reviews| Index: src/PNaClTranslator.cpp |
| diff --git a/src/PNaClTranslator.cpp b/src/PNaClTranslator.cpp |
| index 65b8a5c8ae7e277fd4dcd925971a58dcf416e1a9..d30de0d972049b0a870f328095493148d1cc9bb3 100644 |
| --- a/src/PNaClTranslator.cpp |
| +++ b/src/PNaClTranslator.cpp |
| @@ -237,6 +237,10 @@ public: |
| Ice::Translator &getTranslator() const { return Translator; } |
| + const Ice::ClFlags &getFlags() const { |
|
Jim Stichnoth
2016/03/31 21:02:31
Make this static?
Karl
2016/03/31 21:39:48
Done.
|
| + return Ice::GlobalContext::getFlags(); |
| + } |
| + |
| /// Generates error with given Message, occurring at BitPosition within the |
| /// bitcode file. Always returns true. |
| bool ErrorAt(naclbitc::ErrorLevel Level, uint64_t BitPosition, |
| @@ -489,8 +493,7 @@ private: |
| // Installs names for global variables without names. |
| void installGlobalVarNames() { |
| assert(VariableDeclarations); |
| - const std::string &GlobalPrefix = |
| - getTranslator().getFlags().getDefaultGlobalPrefix(); |
| + const std::string &GlobalPrefix = getFlags().getDefaultGlobalPrefix(); |
| if (!GlobalPrefix.empty()) { |
| NaClBcIndexSize_t NameIndex = 0; |
| for (Ice::VariableDeclaration *Var : *VariableDeclarations) { |
| @@ -501,8 +504,7 @@ private: |
| // Installs names for functions without names. |
| void installFunctionNames() { |
| - const std::string &FunctionPrefix = |
| - getTranslator().getFlags().getDefaultFunctionPrefix(); |
| + const std::string &FunctionPrefix = getFlags().getDefaultFunctionPrefix(); |
| if (!FunctionPrefix.empty()) { |
| NaClBcIndexSize_t NameIndex = 0; |
| for (Ice::FunctionDeclaration *Func : FunctionDeclarations) { |
| @@ -588,8 +590,7 @@ bool TopLevelParser::ErrorAt(naclbitc::ErrorLevel Level, uint64_t Bit, |
| NaClBitcodeParser::ErrorAt(Level, Bit, Message); |
| setErrStream(OldErrStream); |
| } |
| - if (Level >= naclbitc::Error && |
| - !Translator.getFlags().getAllowErrorRecovery()) |
| + if (Level >= naclbitc::Error && !getFlags().getAllowErrorRecovery()) |
| Fatal(); |
| return true; |
| } |
| @@ -693,7 +694,9 @@ protected: |
| // Gets the translator associated with the bitcode parser. |
| Ice::Translator &getTranslator() const { return Context->getTranslator(); } |
| - const Ice::ClFlags &getFlags() const { return getTranslator().getFlags(); } |
| + const Ice::ClFlags &getFlags() const { |
| + return Ice::GlobalContext::getFlags(); |
| + } |
| // Default implementation. Reports that block is unknown and skips its |
| // contents. |
| @@ -3176,7 +3179,7 @@ bool ModuleParser::ParseBlock(unsigned BlockID) { |
| std::unique_ptr<Ice::Cfg> Func = Parser.parseFunction(SeqNumber); |
| bool Failed = Func->hasError(); |
| getTranslator().translateFcn(std::move(Func)); |
| - return Failed && !getTranslator().getFlags().getAllowErrorRecovery(); |
| + return Failed && !getFlags().getAllowErrorRecovery(); |
| } |
| } |
| default: |