3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-05-04 14:25:46 +00:00

add redirect for warnings

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2022-08-23 15:55:55 -07:00
parent fbf9e3004f
commit 2f8b13368d
4 changed files with 23 additions and 0 deletions

View file

@ -191,6 +191,22 @@ public:
~scoped_watch() { m_ctx.m_watch.stop(); }
};
struct scoped_redirect {
cmd_context& m_ctx;
std::ostream& m_verbose;
std::ostream* m_warning;
scoped_redirect(cmd_context& ctx): m_ctx(ctx), m_verbose(verbose_stream()), m_warning(warning_stream()) {
set_warning_stream(&(*m_ctx.m_diagnostic));
set_verbose_stream(m_ctx.diagnostic_stream());
}
~scoped_redirect() {
set_verbose_stream(m_verbose);
set_warning_stream(m_warning);
}
};
protected: