TV plugin: optionally, overwrite existing report files
MODIFY
tv/tv.cpp
tv/tv.cpp
@@ -76,6 +76,11 @@ llvm::cl::opt<string> opt_report_dir(
"tv-report-dir", llvm::cl::desc("Alive: save report to disk"),
llvm::cl::value_desc("directory"));
+llvm::cl::opt<bool> opt_overwrite_reports(
+ "tv-overwrite-reports",
+ llvm::cl::desc("Alive: overwrite existing report files"),
+ llvm::cl::init(false));
+
llvm::cl::opt<bool> opt_smt_verbose(
"tv-smt-verbose", llvm::cl::desc("Alive: SMT verbose mode"),
llvm::cl::init(false));
@@ -274,11 +279,13 @@ struct TVPass final : public llvm::FunctionPass {
fname.replace_extension(".txt");
fs::path path = fs::path(opt_report_dir.getValue()) / fname.filename();
+ if (!opt_overwrite_reports) {
do {
auto newname = fname.stem();
newname += "_" + to_string(rand(re)) + ".txt";
path.replace_filename(newname);
} while (fs::exists(path));
+ }
out_file = ofstream(path);
out = &out_file;

TV plugin: optionally, overwrite existing report files (#535)