about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorDaniel Schemmel <daniel@schemmel.net>2023-03-24 02:40:47 +0000
committerCristian Cadar <c.cadar@imperial.ac.uk>2023-04-21 13:07:31 +0100
commit4d59fe9aef258c35212e5b7b9f6eb2e17b88d293 (patch)
treea548c7b9edf5e1e77812d00f82c634270a7fd663
parentdab8f985dbf0310a7338e15e85f9268649540293 (diff)
downloadklee-4d59fe9aef258c35212e5b7b9f6eb2e17b88d293.tar.gz
use unique_ptr in QueryLoggingSolver
-rw-r--r--lib/Solver/QueryLoggingSolver.cpp4
-rw-r--r--lib/Solver/QueryLoggingSolver.h6
2 files changed, 3 insertions, 7 deletions
diff --git a/lib/Solver/QueryLoggingSolver.cpp b/lib/Solver/QueryLoggingSolver.cpp
index 4c3d9b30..c057751c 100644
--- a/lib/Solver/QueryLoggingSolver.cpp
+++ b/lib/Solver/QueryLoggingSolver.cpp
@@ -53,10 +53,6 @@ QueryLoggingSolver::QueryLoggingSolver(Solver *_solver, std::string path,
   assert(0 != solver);
 }
 
-QueryLoggingSolver::~QueryLoggingSolver() {
-  delete solver;
-}
-
 void QueryLoggingSolver::flushBufferConditionally(bool writeToFile) {
   logBuffer.flush();
   if (writeToFile) {
diff --git a/lib/Solver/QueryLoggingSolver.h b/lib/Solver/QueryLoggingSolver.h
index 65494498..76bba429 100644
--- a/lib/Solver/QueryLoggingSolver.h
+++ b/lib/Solver/QueryLoggingSolver.h
@@ -17,6 +17,8 @@
 
 #include "llvm/Support/raw_ostream.h"
 
+#include <memory>
+
 using namespace klee;
 
 /// This abstract class represents a solver that is capable of logging
@@ -26,7 +28,7 @@ using namespace klee;
 class QueryLoggingSolver : public SolverImpl {
 
 protected:
-  Solver *solver;
+  std::unique_ptr<Solver> solver;
   std::unique_ptr<llvm::raw_ostream> os;
   // @brief Buffer used by logBuffer
   std::string BufferString;
@@ -59,8 +61,6 @@ public:
   QueryLoggingSolver(Solver *_solver, std::string path, const std::string &commentSign,
                      time::Span queryTimeToLog, bool logTimedOut);
 
-  virtual ~QueryLoggingSolver();
-
   /// implementation of the SolverImpl interface
   bool computeTruth(const Query &query, bool &isValid);
   bool computeValidity(const Query &query, Solver::Validity &result);