diff options
author | Julian Büning <julian.buening@rwth-aachen.de> | 2018-10-03 14:42:37 +0200 |
---|---|---|
committer | Cristian Cadar <c.cadar@imperial.ac.uk> | 2018-10-23 18:57:53 +0300 |
commit | 2b34877c5dbf24eabf331a124b1e68d901a72cba (patch) | |
tree | 4d6f4a753d9d36a18c482cf0c8d4b8dc550bafb8 /lib/Solver/QueryLoggingSolver.cpp | |
parent | d032742a963e7d8e83dad509dd1c95b4e1a34436 (diff) | |
download | klee-2b34877c5dbf24eabf331a124b1e68d901a72cba.tar.gz |
refactor klee_open_output_file to return std::unique_ptr
and introduce klee_open_compressed_output_file with similar behavior along some other minor improvements
Diffstat (limited to 'lib/Solver/QueryLoggingSolver.cpp')
-rw-r--r-- | lib/Solver/QueryLoggingSolver.cpp | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/lib/Solver/QueryLoggingSolver.cpp b/lib/Solver/QueryLoggingSolver.cpp index 7e4d8fe0..0fb145d7 100644 --- a/lib/Solver/QueryLoggingSolver.cpp +++ b/lib/Solver/QueryLoggingSolver.cpp @@ -7,18 +7,11 @@ // //===----------------------------------------------------------------------===// #include "QueryLoggingSolver.h" -#include "klee/Config/config.h" -#include "klee/Internal/System/Time.h" #include "klee/Statistics.h" -#ifdef HAVE_ZLIB_H -#include "klee/Internal/Support/CompressionStream.h" +#include "klee/Config/config.h" #include "klee/Internal/Support/ErrorHandling.h" #include "klee/Internal/Support/FileHandling.h" -#endif - -#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 5) -#include "llvm/Support/FileSystem.h" -#endif +#include "klee/Internal/System/Time.h" using namespace klee::util; @@ -37,9 +30,9 @@ llvm::cl::opt<bool> CreateCompressedQueryLog( QueryLoggingSolver::QueryLoggingSolver(Solver *_solver, std::string path, const std::string &commentSign, int queryTimeToLog) - : solver(_solver), os(0), BufferString(""), logBuffer(BufferString), - queryCount(0), minQueryTimeToLog(queryTimeToLog), startTime(0.0f), - lastQueryTime(0.0f), queryCommentSign(commentSign) { + : solver(_solver), BufferString(""), logBuffer(BufferString), queryCount(0), + minQueryTimeToLog(queryTimeToLog), startTime(0.0f), lastQueryTime(0.0f), + queryCommentSign(commentSign) { std::string error; #ifdef HAVE_ZLIB_H if (!CreateCompressedQueryLog) { @@ -47,18 +40,18 @@ QueryLoggingSolver::QueryLoggingSolver(Solver *_solver, std::string path, os = klee_open_output_file(path, error); #ifdef HAVE_ZLIB_H } else { - os = new compressed_fd_ostream((path + ".gz").c_str(), error); + path.append(".gz"); + os = klee_open_compressed_output_file(path, error); } - if (!error.empty()) { +#endif + if (!os) { klee_error("Could not open file %s : %s", path.c_str(), error.c_str()); } -#endif assert(0 != solver); } QueryLoggingSolver::~QueryLoggingSolver() { delete solver; - delete os; } void QueryLoggingSolver::flushBufferConditionally(bool writeToFile) { |