Index: include/llvm/Bitcode/NaCl/NaClBitcodeParser.h |
diff --git a/include/llvm/Bitcode/NaCl/NaClBitcodeParser.h b/include/llvm/Bitcode/NaCl/NaClBitcodeParser.h |
index f9c02f71ad9e09a0b73fad9fe7502a986a641436..97f09ce34e8651b2c94c07451fbd5275a1bfc3de 100644 |
--- a/include/llvm/Bitcode/NaCl/NaClBitcodeParser.h |
+++ b/include/llvm/Bitcode/NaCl/NaClBitcodeParser.h |
@@ -468,14 +468,18 @@ public: |
return Parser.ParseThisBlock(); |
} |
- // Changes the error stream to print errors to Stream. Warning: |
- // Stream must exist till the next call to setErrStream. Otherwise |
- // it must exist for the entire lifetime of the bitcode parser. |
- // Note: This err stream should be set immediately after |
- // construction. Assigning after nested bitcode parsers have been |
- // built will not work. |
- void setErrStream(raw_ostream &Stream) { |
+ // Changes the stream to print errors to. There are two use cases: |
Jim Stichnoth
2015/01/22 17:26:13
Just to be clear for the short-of-attention-span,
Karl
2015/01/22 17:42:58
Done.
|
+ // 1) To change (from the default errs()) inside the constructor of the |
+ // derived class. In this context, it will be used for all error |
+ // messages for the derived class. |
+ // 2) Temporarily modify it for a single error message. In this context, |
+ // the method Error() is overridden in the derived class, and |
+ // calls this method twice. Once before calling base method Error(), |
+ // and followed by a second call to restore the default error stream. |
+ raw_ostream *setErrStream(raw_ostream &Stream) { |
Jim Stichnoth
2015/01/22 17:26:13
It seems a little odd to mix raw_ostream* and raw_
Karl
2015/01/22 17:42:58
Done.
|
+ raw_ostream *OldErrStream = ErrStream; |
ErrStream = &Stream; |
+ return OldErrStream; |
} |
// Called when error occurs. Message is the error to report. Always |