about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorDaniel Schemmel <daniel@schemmel.net>2023-03-24 00:56:01 +0000
committerCristian Cadar <c.cadar@imperial.ac.uk>2023-04-21 13:07:31 +0100
commit9953e9901ff9cf68e26745c2aa6ef10de610c66d (patch)
tree3e28446442c7755a50f216ced835d4affffb274c
parentad61b674eef24d63f4514b3798f0d215c3080579 (diff)
downloadklee-9953e9901ff9cf68e26745c2aa6ef10de610c66d.tar.gz
use unique_ptr in Z3SolverImpl
-rw-r--r--lib/Solver/Z3Solver.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/Solver/Z3Solver.cpp b/lib/Solver/Z3Solver.cpp
index 8319e5f3..f3e8f92b 100644
--- a/lib/Solver/Z3Solver.cpp
+++ b/lib/Solver/Z3Solver.cpp
@@ -27,6 +27,8 @@
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/raw_ostream.h"
 
+#include <memory>
+
 namespace {
 // NOTE: Very useful for debugging Z3 behaviour. These files can be given to
 // the z3 binary to replay all Z3 API calls using its `-log` option.
@@ -57,7 +59,7 @@ namespace klee {
 
 class Z3SolverImpl : public SolverImpl {
 private:
-  Z3Builder *builder;
+  std::unique_ptr<Z3Builder> builder;
   time::Span timeout;
   SolverRunStatus runStatusCode;
   std::unique_ptr<llvm::raw_fd_ostream> dumpedQueriesFile;
@@ -135,7 +137,6 @@ Z3SolverImpl::Z3SolverImpl()
 
 Z3SolverImpl::~Z3SolverImpl() {
   Z3_params_dec_ref(builder->ctx, solverParameters);
-  delete builder;
 }
 
 Z3Solver::Z3Solver() : Solver(new Z3SolverImpl()) {}