OSDN Git Service

Fix locking for printing error messages.
authorKarl Schimpf <kschimpf@google.com>
Thu, 16 Apr 2015 20:50:43 +0000 (13:50 -0700)
committerKarl Schimpf <kschimpf@google.com>
Thu, 16 Apr 2015 20:50:43 +0000 (13:50 -0700)
commit187b3dfab5cca45e2af192bf7f5db09bcc156314
tree66ec1893f9bbbcc6fb34ff8f5195d5d6cbaa00b9
parentd8fb3d33f38258b7fb177bd4cb420fab2e0c2c3a
Fix locking for printing error messages.

The method TopLevelParser::ErrorAt applies a lock to print the error
message. Unfortunately, it keeps the lock longer than necessary,
resulting in deadlock (on following fatal message) if error recovery
is not allowed.

Fixed by limiting scope of lock to only apply to the printing of the
error message.

Modified ClFlags to allow a "reset", and made ClFlags modifiable
by bitcode munge tests. This allowed us to test this problem as
a unit test.

BUG= https://code.google.com/p/nativeclient/issues/detail?id=4138
R=jvoung@chromium.org

Review URL: https://codereview.chromium.org/1091023002
src/IceClFlags.cpp
src/IceClFlags.h
src/PNaClTranslator.cpp
unittest/BitcodeMunge.cpp
unittest/BitcodeMunge.h
unittest/IceParseInstsTest.cpp