diff options
author | Daniel Schemmel <daniel@schemmel.net> | 2023-03-24 00:54:38 +0000 |
---|---|---|
committer | Cristian Cadar <c.cadar@imperial.ac.uk> | 2023-04-21 13:07:31 +0100 |
commit | ad61b674eef24d63f4514b3798f0d215c3080579 (patch) | |
tree | 2a05ad0cf12ec71762989992e1e7d8b8b664bbb2 | |
parent | 4ccb3fe8df5babec7480b433b38da265de73a8eb (diff) | |
download | klee-ad61b674eef24d63f4514b3798f0d215c3080579.tar.gz |
use unique_ptr in ValidatingSolver
-rw-r--r-- | lib/Solver/ValidatingSolver.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/lib/Solver/ValidatingSolver.cpp b/lib/Solver/ValidatingSolver.cpp index d95b8942..72bdc830 100644 --- a/lib/Solver/ValidatingSolver.cpp +++ b/lib/Solver/ValidatingSolver.cpp @@ -11,24 +11,22 @@ #include "klee/Solver/Solver.h" #include "klee/Solver/SolverImpl.h" +#include <memory> #include <vector> namespace klee { class ValidatingSolver : public SolverImpl { private: - Solver *solver, *oracle; - bool ownsOracle; + std::unique_ptr<Solver> solver; + std::unique_ptr<Solver, void(*)(Solver*)> oracle; public: ValidatingSolver(Solver *solver, Solver *oracle, bool ownsOracle = false) - : solver(solver), oracle(oracle), ownsOracle(ownsOracle) {} - ~ValidatingSolver() { - delete solver; - if (ownsOracle) { - delete oracle; - } - } + : solver(solver), + oracle( + oracle, ownsOracle ? [](Solver *solver) { delete solver; } + : [](Solver *) {}) {} bool computeValidity(const Query &, Solver::Validity &result); bool computeTruth(const Query &, bool &isValid); |