Skip to content

Commit e5676af

Browse files
committed
Make decision procedure use piped solver
1 parent 76ff675 commit e5676af

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

src/solvers/smt2_incremental/smt2_incremental_decision_procedure.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,15 @@
22

33
#include "smt2_incremental_decision_procedure.h"
44

5+
#include <solvers/smt2_incremental/smt_to_smt2_string.h>
56
#include <util/expr.h>
7+
#include <util/string_utils.h>
68

79
smt2_incremental_decision_proceduret::smt2_incremental_decision_proceduret(
8-
std::string solver_command)
9-
: solver_command{std::move(solver_command)}, number_of_solver_calls{0}
10+
std::string _solver_command)
11+
: solver_command{std::move(_solver_command)},
12+
number_of_solver_calls{0},
13+
solver_process{split_string(solver_command, ' ', false, true)}
1014
{
1115
}
1216

@@ -71,3 +75,9 @@ decision_proceduret::resultt smt2_incremental_decision_proceduret::dec_solve()
7175
++number_of_solver_calls;
7276
UNIMPLEMENTED_FEATURE("solving.");
7377
}
78+
79+
void smt2_incremental_decision_proceduret::send_to_solver(
80+
const smt_commandt &command)
81+
{
82+
solver_process.send(smt_to_smt2_string(command) + "\n");
83+
}

src/solvers/smt2_incremental/smt2_incremental_decision_procedure.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
#define CPROVER_SOLVERS_SMT2_INCREMENTAL_SMT2_INCREMENTAL_DECISION_PROCEDURE_H
88

99
#include <solvers/stack_decision_procedure.h>
10+
#include <util/piped_process.h>
11+
12+
class smt_commandt;
1013

1114
class smt2_incremental_decision_proceduret final
1215
: public stack_decision_proceduret
@@ -32,10 +35,15 @@ class smt2_incremental_decision_proceduret final
3235
protected:
3336
// Implementation of protected decision_proceduret member function.
3437
resultt dec_solve() override;
38+
/// \brief Converts given SMT2 command to SMT2 string and sends it to the
39+
/// solver process.
40+
void send_to_solver(const smt_commandt &command);
3541

3642
/// This is where we store the solver command for reporting the solver used.
3743
std::string solver_command;
3844
size_t number_of_solver_calls;
45+
46+
piped_processt solver_process;
3947
};
4048

4149
#endif // CPROVER_SOLVERS_SMT2_INCREMENTAL_SMT2_INCREMENTAL_DECISION_PROCEDURE_H

0 commit comments

Comments
 (0)