about summary refs log tree commit diff homepage
path: root/lib/Solver
diff options
context:
space:
mode:
authorDaniel Schemmel <daniel@schemmel.net>2023-03-24 00:49:50 +0000
committerCristian Cadar <c.cadar@imperial.ac.uk>2023-04-21 13:07:31 +0100
commit4ccb3fe8df5babec7480b433b38da265de73a8eb (patch)
tree578fea5af6c10e4eaf1e425af789a3e82b92be97 /lib/Solver
parentf463da0084bc7516c74effe79c161318179dcc13 (diff)
downloadklee-4ccb3fe8df5babec7480b433b38da265de73a8eb.tar.gz
use unique_ptr in STPSolverImpl
Diffstat (limited to 'lib/Solver')
-rw-r--r--lib/Solver/STPSolver.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/Solver/STPSolver.cpp b/lib/Solver/STPSolver.cpp
index 6e62b82b..140ca6f4 100644
--- a/lib/Solver/STPSolver.cpp
+++ b/lib/Solver/STPSolver.cpp
@@ -25,6 +25,7 @@
 
 #include <array>
 #include <csignal>
+#include <memory>
 #include <sys/ipc.h>
 #include <sys/shm.h>
 #include <sys/wait.h>
@@ -85,7 +86,7 @@ namespace klee {
 class STPSolverImpl : public SolverImpl {
 private:
   VC vc;
-  STPBuilder *builder;
+  std::unique_ptr<STPBuilder> builder;
   time::Span timeout;
   bool useForkedSTP;
   SolverRunStatus runStatusCode;
@@ -187,7 +188,7 @@ STPSolverImpl::~STPSolverImpl() {
   shared_memory_ptr = nullptr;
   shared_memory_id = 0;
 
-  delete builder;
+  builder.reset();
 
   vc_Destroy(vc);
 }
@@ -402,13 +403,13 @@ bool STPSolverImpl::computeInitialValues(
 
   bool success;
   if (useForkedSTP) {
-    runStatusCode = runAndGetCexForked(vc, builder, stp_e, objects, values,
-                                       hasSolution, timeout);
+    runStatusCode = runAndGetCexForked(vc, builder.get(), stp_e, objects,
+                                       values, hasSolution, timeout);
     success = ((SOLVER_RUN_STATUS_SUCCESS_SOLVABLE == runStatusCode) ||
                (SOLVER_RUN_STATUS_SUCCESS_UNSOLVABLE == runStatusCode));
   } else {
     runStatusCode =
-        runAndGetCex(vc, builder, stp_e, objects, values, hasSolution);
+        runAndGetCex(vc, builder.get(), stp_e, objects, values, hasSolution);
     success = true;
   }