about summary refs log tree commit diff homepage
path: root/lib/Solver/ValidatingSolver.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Solver/ValidatingSolver.cpp')
-rw-r--r--lib/Solver/ValidatingSolver.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/Solver/ValidatingSolver.cpp b/lib/Solver/ValidatingSolver.cpp
index 72bdc830..8e9886d1 100644
--- a/lib/Solver/ValidatingSolver.cpp
+++ b/lib/Solver/ValidatingSolver.cpp
@@ -12,6 +12,7 @@
 #include "klee/Solver/SolverImpl.h"
 
 #include <memory>
+#include <utility>
 #include <vector>
 
 namespace klee {
@@ -22,8 +23,9 @@ private:
   std::unique_ptr<Solver, void(*)(Solver*)> oracle;
 
 public:
-  ValidatingSolver(Solver *solver, Solver *oracle, bool ownsOracle = false)
-      : solver(solver),
+  ValidatingSolver(std::unique_ptr<Solver> solver, Solver *oracle,
+                   bool ownsOracle)
+      : solver(std::move(solver)),
         oracle(
             oracle, ownsOracle ? [](Solver *solver) { delete solver; }
                                : [](Solver *) {}) {}
@@ -140,7 +142,10 @@ void ValidatingSolver::setCoreSolverTimeout(time::Span timeout) {
   solver->impl->setCoreSolverTimeout(timeout);
 }
 
-Solver *createValidatingSolver(Solver *s, Solver *oracle, bool ownsOracle) {
-  return new Solver(new ValidatingSolver(s, oracle, ownsOracle));
+std::unique_ptr<Solver> createValidatingSolver(std::unique_ptr<Solver> s,
+                                               Solver *oracle,
+                                               bool ownsOracle) {
+  return std::make_unique<Solver>(
+      std::make_unique<ValidatingSolver>(std::move(s), oracle, ownsOracle));
 }
 }