about summary refs log tree commit diff homepage
path: root/tools
diff options
context:
space:
mode:
authorDan Liew <daniel.liew@imperial.ac.uk>2015-04-25 14:39:29 +0100
committerDan Liew <daniel.liew@imperial.ac.uk>2015-04-25 18:28:06 +0100
commit9fc9cdde42b5a1d38dd5a3ea0815104762c2b367 (patch)
tree497a5cfa7df649c636f777d3d16277d118a9b756 /tools
parent1b765967efc8d88460331d271ffefcb175a6c419 (diff)
downloadklee-9fc9cdde42b5a1d38dd5a3ea0815104762c2b367.tar.gz
Give KLEE release version information in the output of klee and kleaver
when they are given the --version command line option.

Unfortunately to make the build type and git revision available we
need to check this for every build which means KLEE's support library
will be rebuilt for every build which will slow down incremental builds.

This addresses issue #231
Diffstat (limited to 'tools')
-rw-r--r--tools/kleaver/main.cpp9
-rw-r--r--tools/klee/main.cpp9
2 files changed, 4 insertions, 14 deletions
diff --git a/tools/kleaver/main.cpp b/tools/kleaver/main.cpp
index fafe955f..af337abe 100644
--- a/tools/kleaver/main.cpp
+++ b/tools/kleaver/main.cpp
@@ -12,8 +12,8 @@
 #include "klee/Common.h"
 #include "klee/util/ExprPPrinter.h"
 #include "klee/util/ExprVisitor.h"
-
 #include "klee/util/ExprSMTLIBPrinter.h"
+#include "klee/Internal/Support/PrintVersion.h"
 
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/Support/CommandLine.h"
@@ -24,12 +24,6 @@
 #include <sys/stat.h>
 #include <unistd.h>
 
-// FIXME: Ugh, this is gross. But otherwise our config.h conflicts with LLVMs.
-#undef PACKAGE_BUGREPORT
-#undef PACKAGE_NAME
-#undef PACKAGE_STRING
-#undef PACKAGE_TARNAME
-#undef PACKAGE_VERSION
 
 #include "llvm/Support/Signals.h"
 
@@ -451,6 +445,7 @@ int main(int argc, char **argv) {
   bool success = true;
 
   llvm::sys::PrintStackTraceOnErrorSignal();
+  llvm::cl::SetVersionPrinter(klee::printVersion);
   llvm::cl::ParseCommandLineOptions(argc, argv);
 
   std::string ErrorStr;
diff --git a/tools/klee/main.cpp b/tools/klee/main.cpp
index 2cb9537b..97192183 100644
--- a/tools/klee/main.cpp
+++ b/tools/klee/main.cpp
@@ -13,13 +13,7 @@
 #include "klee/Internal/Support/Debug.h"
 #include "klee/Internal/Support/ModuleUtil.h"
 #include "klee/Internal/System/Time.h"
-
-// FIXME: Ugh, this is gross. But otherwise our config.h conflicts with LLVMs.
-#undef PACKAGE_BUGREPORT
-#undef PACKAGE_NAME
-#undef PACKAGE_STRING
-#undef PACKAGE_TARNAME
-#undef PACKAGE_VERSION
+#include "klee/Internal/Support/PrintVersion.h"
 
 #if LLVM_VERSION_CODE > LLVM_VERSION(3, 2)
 #include "llvm/IR/Constants.h"
@@ -630,6 +624,7 @@ static std::string strip(std::string &in) {
 }
 
 static void parseArguments(int argc, char **argv) {
+  cl::SetVersionPrinter(klee::printVersion);
 #if LLVM_VERSION_CODE >= LLVM_VERSION(3, 2)
   // This version always reads response files
   cl::ParseCommandLineOptions(argc, argv, " klee\n");