Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Unified Diff: src/PNaClTranslator.cpp

Issue 1091023002: Fix locking for printing error messages. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fix nits. Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/IceClFlags.cpp ('k') | unittest/BitcodeMunge.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/PNaClTranslator.cpp
diff --git a/src/PNaClTranslator.cpp b/src/PNaClTranslator.cpp
index 35cdcf7ab6a81134edf4129eec2767de8f9dcd9e..ce462396537e1990410eae780ab88bf4289e49db 100644
--- a/src/PNaClTranslator.cpp
+++ b/src/PNaClTranslator.cpp
@@ -486,10 +486,12 @@ bool TopLevelParser::ErrorAt(naclbitc::ErrorLevel Level, uint64_t Bit,
ErrorStatus.assign(Ice::EC_Bitcode);
++NumErrors;
Ice::GlobalContext *Context = Translator.getContext();
- Ice::OstreamLocker L(Context);
- raw_ostream &OldErrStream = setErrStream(Context->getStrDump());
- NaClBitcodeParser::ErrorAt(Level, Bit, Message);
- setErrStream(OldErrStream);
+ { // Lock while printing out error message.
+ Ice::OstreamLocker L(Context);
+ raw_ostream &OldErrStream = setErrStream(Context->getStrDump());
+ NaClBitcodeParser::ErrorAt(Level, Bit, Message);
+ setErrStream(OldErrStream);
+ }
if (Level >= naclbitc::Error &&
!Translator.getFlags().getAllowErrorRecovery())
Fatal();
jvoung (off chromium) 2015/04/16 19:11:52 I was wondering why not just report_fatal_error he
Karl 2015/04/16 19:58:51 The point of calling fatal() is that it uses exist
jvoung (off chromium) 2015/04/16 20:22:47 Ok right, because this call to Fatal() has no para
« no previous file with comments | « src/IceClFlags.cpp ('k') | unittest/BitcodeMunge.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698