Index: src/IceGlobalContext.h |
diff --git a/src/IceGlobalContext.h b/src/IceGlobalContext.h |
index 9264d4302fbc0d6990e4261c399630ea1fafab39..8154e002c4e5aedaba25296bdde7860d8a94e8f8 100644 |
--- a/src/IceGlobalContext.h |
+++ b/src/IceGlobalContext.h |
@@ -145,14 +145,19 @@ class GlobalContext { |
}; |
public: |
+ // The dump stream is a log stream while emit is the stream code |
+ // is emitted to. The error stream is strictly for logging errors. |
+ // If an error stream is not provided, the dump stream will be |
+ // used instead. |
GlobalContext(Ostream *OsDump, Ostream *OsEmit, ELFStreamer *ELFStreamer, |
- const ClFlags &Flags); |
+ const ClFlags &Flags, Ostream *OsError = nullptr); |
~GlobalContext(); |
- // The dump and emit streams need to be used by only one thread at a |
- // time. This is done by exclusively reserving the streams via |
- // lockStr() and unlockStr(). The OstreamLocker class can be used |
- // to conveniently manage this. |
+ // |
+ // The dump, error, and emit streams need to be used by only one |
+ // thread at a time. This is done by exclusively reserving the |
+ // streams via lockStr() and unlockStr(). The OstreamLocker class |
+ // can be used to conveniently manage this. |
// |
// The model is that a thread grabs the stream lock, then does an |
// arbitrary amount of work during which far-away callees may grab |
@@ -163,6 +168,7 @@ public: |
void lockStr() { StrLock.lock(); } |
void unlockStr() { StrLock.unlock(); } |
Ostream &getStrDump() { return *StrDump; } |
+ Ostream &getStrError() { return StrError ? *StrError : *StrDump; } |
Ostream &getStrEmit() { return *StrEmit; } |
LockedPtr<ErrorCode> getErrorStatus() { |
@@ -418,6 +424,7 @@ private: |
StrLockType StrLock; |
Ostream *StrDump; // Stream for dumping / diagnostics |
Ostream *StrEmit; // Stream for code emission |
+ Ostream *StrError; // If non-null, stream for logging errors. |
ICE_CACHELINE_BOUNDARY; |