From ad61b674eef24d63f4514b3798f0d215c3080579 Mon Sep 17 00:00:00 2001 From: Daniel Schemmel Date: Fri, 24 Mar 2023 00:54:38 +0000 Subject: use unique_ptr in ValidatingSolver --- lib/Solver/ValidatingSolver.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'lib/Solver') 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 #include namespace klee { class ValidatingSolver : public SolverImpl { private: - Solver *solver, *oracle; - bool ownsOracle; + std::unique_ptr solver; + std::unique_ptr 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); -- cgit 1.4.1