aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/Core
diff options
context:
space:
mode:
authorJulian Büning <julian.buening@rwth-aachen.de>2018-10-03 14:15:55 +0200
committerCristian Cadar <c.cadar@imperial.ac.uk>2018-10-23 18:57:53 +0300
commitd032742a963e7d8e83dad509dd1c95b4e1a34436 (patch)
tree9ac1a1ec81af7593c36a2f3a838cca7480225bcf /lib/Core
parent9584781629cd0b04d150762c0b5ea1cced859368 (diff)
downloadklee-d032742a963e7d8e83dad509dd1c95b4e1a34436.tar.gz
use klee_open_output_file for uncompressed logs
Diffstat (limited to 'lib/Core')
-rw-r--r--lib/Core/Executor.cpp24
1 files changed, 6 insertions, 18 deletions
diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp
index ecebe916..475beacb 100644
--- a/lib/Core/Executor.cpp
+++ b/lib/Core/Executor.cpp
@@ -43,6 +43,7 @@
#include "klee/Internal/Module/KInstruction.h"
#include "klee/Internal/Module/KModule.h"
#include "klee/Internal/Support/ErrorHandling.h"
+#include "klee/Internal/Support/FileHandling.h"
#include "klee/Internal/Support/FloatEvaluation.h"
#include "klee/Internal/Support/ModuleUtil.h"
#include "klee/Internal/System/Time.h"
@@ -363,33 +364,20 @@ Executor::Executor(LLVMContext &ctx, const InterpreterOptions &opts,
DebugPrintInstructions.isSet(FILE_SRC)) {
std::string debug_file_name =
interpreterHandler->getOutputFilename("instructions.txt");
- std::string ErrorInfo;
+ std::string error;
#ifdef HAVE_ZLIB_H
if (!DebugCompressInstructions) {
#endif
-
-#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 6)
- std::error_code ec;
- debugInstFile = new llvm::raw_fd_ostream(debug_file_name.c_str(), ec,
- llvm::sys::fs::OpenFlags::F_Text);
- if (ec)
- ErrorInfo = ec.message();
-#elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 5)
- debugInstFile = new llvm::raw_fd_ostream(debug_file_name.c_str(), ErrorInfo,
- llvm::sys::fs::OpenFlags::F_Text);
-#else
- debugInstFile =
- new llvm::raw_fd_ostream(debug_file_name.c_str(), ErrorInfo);
-#endif
+ debugInstFile = klee_open_output_file(debug_file_name, error);
#ifdef HAVE_ZLIB_H
} else {
debugInstFile = new compressed_fd_ostream(
- (debug_file_name + ".gz").c_str(), ErrorInfo);
+ (debug_file_name + ".gz").c_str(), error);
}
#endif
- if (ErrorInfo != "") {
+ if (!error.empty()) {
klee_error("Could not open file %s : %s", debug_file_name.c_str(),
- ErrorInfo.c_str());
+ error.c_str());
}
}
}