summaryrefslogtreecommitdiff
path: root/tools/standalone_miri/debug.hpp
diff options
context:
space:
mode:
authorJohn Hodge <tpg@ucc.asn.au>2019-07-19 18:47:50 +0800
committerJohn Hodge <tpg@ucc.asn.au>2019-07-19 18:47:50 +0800
commit306cc5f2bc4ecd265cf4bcacf96ce9906d6d4782 (patch)
tree95802c636dd2ba4ade8f74255873b4fef8d17697 /tools/standalone_miri/debug.hpp
parent0d5fe417e6ff1806987f77c97b0841b0b600cde0 (diff)
downloadmrust-306cc5f2bc4ecd265cf4bcacf96ce9906d6d4782.tar.gz
Standaline MIRI - Report errors to stderr as well as the log
Diffstat (limited to 'tools/standalone_miri/debug.hpp')
-rw-r--r--tools/standalone_miri/debug.hpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/tools/standalone_miri/debug.hpp b/tools/standalone_miri/debug.hpp
index b3b0d76f..4b8d7aa9 100644
--- a/tools/standalone_miri/debug.hpp
+++ b/tools/standalone_miri/debug.hpp
@@ -21,17 +21,26 @@ enum class DebugLevel {
Bug,
};
-class DebugSink
+class DebugSink//:
+ //public ::std::ostream
{
static unsigned s_indent;
static ::std::unique_ptr<std::ofstream> s_out_file;
::std::ostream& m_inner;
- DebugSink(::std::ostream& inner);
+ bool m_stderr_too;
+ DebugSink(::std::ostream& inner, bool stderr_too);
public:
~DebugSink();
template<typename T>
- ::std::ostream& operator<<(const T& v) { return m_inner << v; }
+ DebugSink& operator<<(const T& v) {
+ if( m_stderr_too )
+ {
+ ::std::cerr << v;
+ }
+ m_inner << v;
+ return *this;
+ }
static void set_output_file(const ::std::string& s);
static bool enabled(const char* fcn_name);