From ac0fa15ab0679fe1b5067b07647b0701ae3bc347 Mon Sep 17 00:00:00 2001 From: Daniel Schemmel Date: Fri, 24 Mar 2023 15:05:43 +0000 Subject: use unique_ptr all throughout the solver chain --- tools/kleaver/main.cpp | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'tools') diff --git a/tools/kleaver/main.cpp b/tools/kleaver/main.cpp index eed4e4c9..51298dfb 100644 --- a/tools/kleaver/main.cpp +++ b/tools/kleaver/main.cpp @@ -29,12 +29,11 @@ #include "llvm/Support/ManagedStatic.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/raw_ostream.h" +#include "llvm/Support/Signals.h" #include #include - - -#include "llvm/Support/Signals.h" +#include using namespace llvm; using namespace klee; @@ -200,7 +199,7 @@ static bool EvaluateInputAST(const char *Filename, if (!success) return false; - Solver *coreSolver = klee::createCoreSolver(CoreSolverToUse); + std::unique_ptr coreSolver = klee::createCoreSolver(CoreSolverToUse); if (CoreSolverToUse != DUMMY_SOLVER) { const time::Span maxCoreSolverTime(MaxCoreSolverTime); @@ -209,11 +208,11 @@ static bool EvaluateInputAST(const char *Filename, } } - Solver *S = constructSolverChain(coreSolver, - getQueryLogPath(ALL_QUERIES_SMT2_FILE_NAME), - getQueryLogPath(SOLVER_QUERIES_SMT2_FILE_NAME), - getQueryLogPath(ALL_QUERIES_KQUERY_FILE_NAME), - getQueryLogPath(SOLVER_QUERIES_KQUERY_FILE_NAME)); + std::unique_ptr S = constructSolverChain( + std::move(coreSolver), getQueryLogPath(ALL_QUERIES_SMT2_FILE_NAME), + getQueryLogPath(SOLVER_QUERIES_SMT2_FILE_NAME), + getQueryLogPath(ALL_QUERIES_KQUERY_FILE_NAME), + getQueryLogPath(SOLVER_QUERIES_KQUERY_FILE_NAME)); unsigned Index = 0; for (std::vector::iterator it = Decls.begin(), @@ -294,8 +293,6 @@ static bool EvaluateInputAST(const char *Filename, delete *it; delete P; - delete S; - if (uint64_t queries = *theStatisticManager->getStatisticByName("SolverQueries")) { llvm::outs() << "--\n" -- cgit 1.4.1