Chromium Code Reviews| Index: src/PNaClTranslator.cpp |
| diff --git a/src/PNaClTranslator.cpp b/src/PNaClTranslator.cpp |
| index ed19f61ccfd5b869ecceec984fd3c7785b07c25a..f1e330754f628b75856a0d39a068b04dfb5c9dc7 100644 |
| --- a/src/PNaClTranslator.cpp |
| +++ b/src/PNaClTranslator.cpp |
| @@ -1355,33 +1355,36 @@ public: |
| // done to install a CfgLocalAllocator for various internal containers. |
| Func = Ice::Cfg::create(getTranslator().getContext(), |
| getTranslator().getNextSequenceNumber()); |
| - Ice::Cfg::setCurrentCfg(Func.get()); |
| - |
| - // TODO(kschimpf) Clean up API to add a function signature to a CFG. |
| - const Ice::FuncSigType &Signature = FuncDecl->getSignature(); |
| - |
| - Func->setFunctionName(FuncDecl->getName()); |
| - Func->setReturnType(Signature.getReturnType()); |
| - Func->setInternal(FuncDecl->getLinkage() == GlobalValue::InternalLinkage); |
| - CurrentNode = installNextBasicBlock(); |
| - Func->setEntryNode(CurrentNode); |
| - for (Ice::Type ArgType : Signature.getArgList()) { |
| - Func->addArg(getNextInstVar(ArgType)); |
| - } |
| + bool ParserResult; |
| + { |
| + Ice::CfgLocalAllocatorScope _(Func.get()); |
| + |
| + // TODO(kschimpf) Clean up API to add a function signature to a CFG. |
| + const Ice::FuncSigType &Signature = FuncDecl->getSignature(); |
| + |
| + Func->setFunctionName(FuncDecl->getName()); |
| + Func->setReturnType(Signature.getReturnType()); |
| + Func->setInternal(FuncDecl->getLinkage() == GlobalValue::InternalLinkage); |
| + CurrentNode = installNextBasicBlock(); |
| + Func->setEntryNode(CurrentNode); |
| + for (Ice::Type ArgType : Signature.getArgList()) { |
| + Func->addArg(getNextInstVar(ArgType)); |
| + } |
| - bool ParserResult = ParseThisBlock(); |
| + ParserResult = ParseThisBlock(); |
| - // Temporarily end per-function timing, which will be resumed by the |
| - // translator function. This is because translation may be done |
| - // asynchronously in a separate thread. |
| - if (TimeThisFunction) |
| - getTranslator().getContext()->popTimer(TimerID, StackID); |
| + // Temporarily end per-function timing, which will be resumed by the |
| + // translator function. This is because translation may be done |
| + // asynchronously in a separate thread. |
| + if (TimeThisFunction) |
| + getTranslator().getContext()->popTimer(TimerID, StackID); |
| - Ice::Cfg::setCurrentCfg(nullptr); |
| - // Note: Once any errors have been found, we turn off all translation of |
| - // all remaining functions. This allows successive parsing errors to be |
| - // reported, without adding extra checks to the translator for such parsing |
| - // errors. |
| + // Note: Once any errors have been found, we turn off all translation of |
| + // all remaining functions. This allows successive parsing errors to be |
| + // reported, without adding extra checks to the translator for such |
|
Jim Stichnoth
2016/02/24 23:31:24
reflow comment
John
2016/02/24 23:46:06
Done.
|
| + // parsing |
| + // errors. |
| + } |
| if (Context->getNumErrors() == 0 && Func) { |
| getTranslator().translateFcn(std::move(Func)); |
| // The translator now has ownership of Func. |