Skip to content

A decision_proceduret isn't a messaget [blocks: #3800] #4042

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/cbmc/all_properties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ safety_checkert::resultt bmc_all_propertiest::operator()()
{
status() << "Passing problem to " << solver.decision_procedure_text() << eom;

solver.set_message_handler(get_message_handler());

auto solver_start=std::chrono::steady_clock::now();

convert_symex_target_equation(
Expand Down
4 changes: 0 additions & 4 deletions src/cbmc/bmc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ decision_proceduret::resultt bmct::run_decision_procedure()
status() << "Passing problem to "
<< prop_conv.decision_procedure_text() << eom;

prop_conv.set_message_handler(get_message_handler());

auto solver_start = std::chrono::steady_clock::now();

convert_symex_target_equation(equation, prop_conv, get_message_handler());
Expand Down Expand Up @@ -192,8 +190,6 @@ safety_checkert::resultt bmct::run(

safety_checkert::resultt bmct::decide(const goto_functionst &goto_functions)
{
prop_conv.set_message_handler(get_message_handler());

if(options.get_bool_option("stop-on-fail"))
return stop_on_fail();
else
Expand Down
2 changes: 1 addition & 1 deletion src/cbmc/bmc.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class bmct:public safety_checkert
options(_options),
outer_symbol_table(outer_symbol_table),
ns(outer_symbol_table, symex_symbol_table),
equation(),
equation(_message_handler),
path_storage(_path_storage),
symex(
_message_handler,
Expand Down
1 change: 1 addition & 0 deletions src/goto-checker/multi_path_symex_only_checker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ multi_path_symex_only_checkert::multi_path_symex_only_checkert(
: incremental_goto_checkert(options, ui_message_handler),
goto_model(goto_model),
ns(goto_model.get_symbol_table(), symex_symbol_table),
equation(ui_message_handler),
symex(
ui_message_handler,
goto_model.get_symbol_table(),
Expand Down
2 changes: 1 addition & 1 deletion src/goto-checker/single_path_symex_checker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ operator()(propertiest &properties)
symex_initialized = true;

// Put initial state into the work list
symex_target_equationt equation;
symex_target_equationt equation(ui_message_handler);
symex_bmct symex(
ui_message_handler,
goto_model.get_symbol_table(),
Expand Down
2 changes: 1 addition & 1 deletion src/goto-checker/single_path_symex_only_checker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ operator()(propertiest &properties)

{
// Put initial state into the work list
symex_target_equationt equation;
symex_target_equationt equation(ui_message_handler);
symex_bmct symex(
ui_message_handler,
goto_model.get_symbol_table(),
Expand Down
6 changes: 2 additions & 4 deletions src/goto-checker/solver_factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,8 @@ solver_factoryt::get_smt2(smt2_dect::solvert solver)
if(options.get_bool_option("fpa"))
smt2_dec->use_FPA_theory = true;

smt2_dec->set_message_handler(message_handler);

set_prop_conv_time_limit(*smt2_dec);
return util_make_unique<solvert>(std::move(smt2_dec));
}
Expand All @@ -284,8 +286,6 @@ solver_factoryt::get_smt2(smt2_dect::solvert solver)
if(options.get_bool_option("fpa"))
smt2_conv->use_FPA_theory = true;

smt2_conv->set_message_handler(message_handler);

set_prop_conv_time_limit(*smt2_conv);
return util_make_unique<solvert>(std::move(smt2_conv));
}
Expand Down Expand Up @@ -314,8 +314,6 @@ solver_factoryt::get_smt2(smt2_dect::solvert solver)
if(options.get_bool_option("fpa"))
smt2_conv->use_FPA_theory = true;

smt2_conv->set_message_handler(message_handler);

set_prop_conv_time_limit(*smt2_conv);
return util_make_unique<solvert>(std::move(smt2_conv), std::move(out));
}
Expand Down
2 changes: 1 addition & 1 deletion src/goto-instrument/accelerate/scratch_program.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class scratch_programt:public goto_programt
symbol_table(_symbol_table),
symex_symbol_table(),
ns(symbol_table, symex_symbol_table),
equation(),
equation(mh),
path_storage(),
options(get_default_options()),
symex(mh, symbol_table, equation, options, path_storage),
Expand Down
49 changes: 20 additions & 29 deletions src/goto-symex/symex_target_equation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -359,12 +359,10 @@ void symex_target_equationt::convert_assignments(
{
if(step.is_assignment() && !step.ignore && !step.converted)
{
decision_procedure.conditional_output(
decision_procedure.debug(),
[&step](messaget::mstreamt &mstream) {
step.output(mstream);
mstream << messaget::eom;
});
log.conditional_output(log.debug(), [&step](messaget::mstreamt &mstream) {
step.output(mstream);
mstream << messaget::eom;
});

decision_procedure.set_to_true(step.cond_expr);
step.converted = true;
Expand Down Expand Up @@ -404,12 +402,10 @@ void symex_target_equationt::convert_guards(
step.guard_literal=const_literal(false);
else
{
prop_conv.conditional_output(
prop_conv.debug(),
[&step](messaget::mstreamt &mstream) {
step.output(mstream);
mstream << messaget::eom;
});
log.conditional_output(log.debug(), [&step](messaget::mstreamt &mstream) {
step.output(mstream);
mstream << messaget::eom;
});

try
{
Expand All @@ -436,9 +432,8 @@ void symex_target_equationt::convert_assumptions(
step.cond_literal=const_literal(true);
else
{
prop_conv.conditional_output(
prop_conv.debug(),
[&step](messaget::mstreamt &mstream) {
log.conditional_output(
log.debug(), [&step](messaget::mstreamt &mstream) {
step.output(mstream);
mstream << messaget::eom;
});
Expand Down Expand Up @@ -469,9 +464,8 @@ void symex_target_equationt::convert_goto_instructions(
step.cond_literal=const_literal(true);
else
{
prop_conv.conditional_output(
prop_conv.debug(),
[&step](messaget::mstreamt &mstream) {
log.conditional_output(
log.debug(), [&step](messaget::mstreamt &mstream) {
step.output(mstream);
mstream << messaget::eom;
});
Expand All @@ -498,11 +492,10 @@ void symex_target_equationt::convert_constraints(
{
if(step.is_constraint() && !step.ignore && !step.converted)
{
decision_procedure.conditional_output(
decision_procedure.debug(), [&step](messaget::mstreamt &mstream) {
step.output(mstream);
mstream << messaget::eom;
});
log.conditional_output(log.debug(), [&step](messaget::mstreamt &mstream) {
step.output(mstream);
mstream << messaget::eom;
});

try
{
Expand Down Expand Up @@ -568,12 +561,10 @@ void symex_target_equationt::convert_assertions(
{
step.converted = true;

prop_conv.conditional_output(
prop_conv.debug(),
[&step](messaget::mstreamt &mstream) {
step.output(mstream);
mstream << messaget::eom;
});
log.conditional_output(log.debug(), [&step](messaget::mstreamt &mstream) {
step.output(mstream);
mstream << messaget::eom;
});

implies_exprt implication(
assumption,
Expand Down
8 changes: 8 additions & 0 deletions src/goto-symex/symex_target_equation.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Author: Daniel Kroening, kroening@kroening.com

#include <util/invariant.h>
#include <util/merge_irep.h>
#include <util/message.h>
#include <util/narrow.h>

#include <goto-programs/goto_program.h>
Expand All @@ -37,6 +38,11 @@ class prop_convt;
class symex_target_equationt:public symex_targett
{
public:
explicit symex_target_equationt(message_handlert &message_handler)
: log(message_handler)
{
}

virtual ~symex_target_equationt() = default;

/// \copydoc symex_targett::shared_read()
Expand Down Expand Up @@ -408,6 +414,8 @@ class symex_target_equationt:public symex_targett
}

protected:
messaget log;

// for enforcing sharing in the expressions stored
merge_irept merge_irep;
void merge_ireps(SSA_stept &SSA_step);
Expand Down
3 changes: 2 additions & 1 deletion src/solvers/prop/prop_conv.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Author: Daniel Kroening, kroening@kroening.com

#include <util/decision_procedure.h>
#include <util/expr.h>
#include <util/message.h>
#include <util/std_expr.h>

#include "literal.h"
Expand Down Expand Up @@ -67,7 +68,7 @@ class prop_convt:public decision_proceduret

/*! \brief TO_BE_DOCUMENTED
*/
class prop_conv_solvert:public prop_convt
class prop_conv_solvert : public prop_convt, public messaget
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ideally the inheritance should be removed here as well (could be done in a separate PR)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I am going to do so in a separate PR. I just wanted to keep the churn as small as possible.

{
public:
explicit prop_conv_solvert(propt &_prop) : prop(_prop)
Expand Down
4 changes: 3 additions & 1 deletion src/solvers/smt2/smt2_dec.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ class smt2_stringstreamt

/*! \brief Decision procedure interface for various SMT 2.x solvers
*/
class smt2_dect:protected smt2_stringstreamt, public smt2_convt
class smt2_dect : protected smt2_stringstreamt,
public smt2_convt,
public messaget
{
public:
smt2_dect(
Expand Down
5 changes: 3 additions & 2 deletions src/util/decision_procedure.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ Author: Daniel Kroening, kroening@kroening.com
#ifndef CPROVER_UTIL_DECISION_PROCEDURE_H
#define CPROVER_UTIL_DECISION_PROCEDURE_H

#include "message.h"
#include <iosfwd>
#include <string>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why these are needed.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

decision_procedure_text returns a std::string and print_assignment takes a std::ostream as parameter. (Previously both includes were dragged in by message.h.)


class exprt;

class decision_proceduret:public messaget
class decision_proceduret
{
public:
virtual ~decision_proceduret();
Expand Down
3 changes: 2 additions & 1 deletion unit/goto-symex/ssa_equation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Author: Diffblue Ltd.

\*******************************************************************/

#include <testing-utils/message.h>
#include <testing-utils/use_catch.h>

#include <util/arith_tools.h>
Expand All @@ -27,7 +28,7 @@ SCENARIO("Validation of well-formed SSA steps", "[core][goto-symex][validate]")

goto_programt goto_program;
goto_program.add_instruction(END_FUNCTION);
symex_target_equationt equation;
symex_target_equationt equation(null_message_handler);
symex_targett::sourcet at_end_function(fun_name, goto_program);
equation.SSA_steps.emplace_back(
at_end_function, goto_trace_stept::typet::FUNCTION_RETURN);
Expand Down