File tree Expand file tree Collapse file tree 3 files changed +16
-5
lines changed
Expand file tree Collapse file tree 3 files changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -214,7 +214,7 @@ void smt2_convt::write_footer()
214214 {
215215 out << " (check-sat-assuming (" ;
216216 for (const auto &assumption : assumptions)
217- convert_literal (to_literal_expr ( assumption). get_literal () );
217+ convert_literal (assumption);
218218 out << " ))\n " ;
219219 }
220220 else
@@ -227,7 +227,7 @@ void smt2_convt::write_footer()
227227 for (const auto &assumption : assumptions)
228228 {
229229 out << " (assert " ;
230- convert_literal (to_literal_expr ( assumption). get_literal () );
230+ convert_literal (assumption);
231231 out << " )"
232232 << " \n " ;
233233 }
@@ -323,7 +323,7 @@ decision_proceduret::resultt smt2_convt::dec_solve(const exprt &assumption)
323323 write_footer ();
324324 else
325325 {
326- assumptions.push_back (literal_exprt ( convert (assumption) ));
326+ assumptions.push_back (convert (assumption));
327327 write_footer ();
328328 assumptions.pop_back ();
329329 }
@@ -987,7 +987,9 @@ void smt2_convt::push(const std::vector<exprt> &_assumptions)
987987{
988988 INVARIANT (assumptions.empty (), " nested contexts are not supported" );
989989
990- assumptions = _assumptions;
990+ assumptions.reserve (_assumptions.size ());
991+ for (auto &assumption : _assumptions)
992+ assumptions.push_back (convert (assumption));
991993}
992994
993995void smt2_convt::pop ()
Original file line number Diff line number Diff line change @@ -102,7 +102,7 @@ class smt2_convt : public stack_decision_proceduret
102102 unordered_map<irep_idt, std::function<void (const exprt &)>, irep_id_hash>;
103103 converterst converters;
104104
105- std::vector<exprt > assumptions;
105+ std::vector<literalt > assumptions;
106106 boolbv_widtht boolbv_width;
107107
108108 std::size_t number_of_solver_calls = 0 ;
Original file line number Diff line number Diff line change @@ -42,12 +42,21 @@ decision_proceduret::resultt smt2_dect::dec_solve(const exprt &assumption)
4242 temp_file_stderr (" smt2_dec_stderr_" , " " );
4343
4444 const auto write_problem_to_file = [&](std::ofstream problem_out) {
45+ if (assumption.is_not_nil ())
46+ assumptions.push_back (convert (assumption));
47+
4548 cached_output << stringstream.str ();
4649 stringstream.str (std::string{});
50+
4751 write_footer ();
52+
53+ if (assumption.is_not_nil ())
54+ assumptions.pop_back ();
55+
4856 problem_out << cached_output.str () << stringstream.str ();
4957 stringstream.str (std::string{});
5058 };
59+
5160 write_problem_to_file (std::ofstream (
5261 temp_file_problem (), std::ios_base::out | std::ios_base::trunc));
5362
You can’t perform that action at this time.
0 commit comments