about summary refs log tree commit diff homepage
path: root/include
diff options
context:
space:
mode:
authorJiri Slaby <jirislaby@gmail.com>2017-06-07 13:36:28 +0200
committerMartinNowack <martin.nowack@gmail.com>2018-09-18 10:36:36 +0100
commitb2659ec04a9814718736ad960635a9a28edd6078 (patch)
tree5b7b383549644760782be0d23b827968decd4694 /include
parentbad4c5083b3e160abfaa84ede071c5e69d1f2709 (diff)
downloadklee-b2659ec04a9814718736ad960635a9a28edd6078.tar.gz
llvm4: use chrono helpers from LLVM
LLVM 4 removes the old time interface and starts using the C++11's
chrono. So switch to that in klee for LLVM 4 too.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Diffstat (limited to 'include')
-rw-r--r--include/klee/Internal/Support/Timer.h8
-rw-r--r--include/klee/Internal/System/Time.h11
2 files changed, 19 insertions, 0 deletions
diff --git a/include/klee/Internal/Support/Timer.h b/include/klee/Internal/Support/Timer.h
index a422abd0..d80ccb31 100644
--- a/include/klee/Internal/Support/Timer.h
+++ b/include/klee/Internal/Support/Timer.h
@@ -12,9 +12,17 @@
 
 #include <stdint.h>
 
+#if LLVM_VERSION_CODE >= LLVM_VERSION(4, 0)
+#include <llvm/Support/Chrono.h>
+#endif
+
 namespace klee {
   class WallTimer {
+#if LLVM_VERSION_CODE >= LLVM_VERSION(4, 0)
+    llvm::sys::TimePoint<> start;
+#else
     uint64_t startMicroseconds;
+#endif
     
   public:
     WallTimer();
diff --git a/include/klee/Internal/System/Time.h b/include/klee/Internal/System/Time.h
index 220e260c..12522c86 100644
--- a/include/klee/Internal/System/Time.h
+++ b/include/klee/Internal/System/Time.h
@@ -10,7 +10,13 @@
 #ifndef KLEE_UTIL_TIME_H
 #define KLEE_UTIL_TIME_H
 
+#if LLVM_VERSION_CODE >= LLVM_VERSION(4, 0)
+#include <chrono>
+
+#include "llvm/Support/Chrono.h"
+#else
 #include "llvm/Support/TimeValue.h"
+#endif
 
 namespace klee {
   namespace util {
@@ -22,7 +28,12 @@ namespace klee {
     double getWallTime();
 
     /// Wall time as TimeValue object.
+#if LLVM_VERSION_CODE >= LLVM_VERSION(4, 0)
+    double durationToDouble(std::chrono::nanoseconds dur);
+    llvm::sys::TimePoint<> getWallTimeVal();
+#else
     llvm::sys::TimeValue getWallTimeVal();
+#endif
   }
 }