diff options
author | Cristian Cadar <c.cadar@imperial.ac.uk> | 2017-03-01 16:03:37 +0000 |
---|---|---|
committer | Cristian Cadar <c.cadar@imperial.ac.uk> | 2017-03-01 16:03:37 +0000 |
commit | d4679d75c431dfd4f1289571d9f4f6c555e86334 (patch) | |
tree | 35a748286c59206cc9ec606ccc57c8b851021dce /lib/Support | |
parent | 4f5ea494986689dd89f97f9a64082527557c71c9 (diff) | |
download | klee-d4679d75c431dfd4f1289571d9f4f6c555e86334.tar.gz |
Added new option --warnings-only-to-file which causes warnings to be written to warnings.txt only. Disabled by default.
Diffstat (limited to 'lib/Support')
-rw-r--r-- | lib/Support/ErrorHandling.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/Support/ErrorHandling.cpp b/lib/Support/ErrorHandling.cpp index 7ca223e5..00647701 100644 --- a/lib/Support/ErrorHandling.cpp +++ b/lib/Support/ErrorHandling.cpp @@ -10,6 +10,7 @@ #include "klee/Internal/Support/ErrorHandling.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/raw_ostream.h" +#include "llvm/Support/CommandLine.h" #include <stdlib.h> #include <stdio.h> @@ -20,6 +21,7 @@ #include <set> using namespace klee; +using namespace llvm; FILE *klee::klee_warning_file = NULL; FILE *klee::klee_message_file = NULL; @@ -29,6 +31,13 @@ static const char *warningOncePrefix = "WARNING ONCE"; static const char *errorPrefix = "ERROR"; static const char *notePrefix = "NOTE"; +namespace { +cl::opt<bool> WarningsOnlyToFile( + "warnings-only-to-file", cl::init(false), + cl::desc("All warnings will be written to warnings.txt only. If disabled, " + "they are also written on screen.")); +} + static bool shouldSetColor(const char *pfx, const char *msg, const char *prefixToSearchFor) { if (pfx && strcmp(pfx, prefixToSearchFor) == 0) @@ -139,7 +148,7 @@ void klee::klee_error(const char *msg, ...) { void klee::klee_warning(const char *msg, ...) { va_list ap; va_start(ap, msg); - klee_vmessage(warningPrefix, false, msg, ap); + klee_vmessage(warningPrefix, WarningsOnlyToFile, msg, ap); va_end(ap); } @@ -160,7 +169,7 @@ void klee::klee_warning_once(const void *id, const char *msg, ...) { keys.insert(key); va_list ap; va_start(ap, msg); - klee_vmessage(warningOncePrefix, false, msg, ap); + klee_vmessage(warningOncePrefix, WarningsOnlyToFile, msg, ap); va_end(ap); } } |