about summary refs log tree commit diff homepage
path: root/lib
diff options
context:
space:
mode:
authorMartin Nowack <martin@se.inf.tu-dresden.de>2014-02-07 21:04:22 +0100
committerMartin Nowack <martin@se.inf.tu-dresden.de>2014-04-14 10:34:54 +0200
commit347795c5d2dbc2815d395e60a08ad3debca68102 (patch)
treea3b11935354c4178fd8baf78a02962226d89deab /lib
parent237899d2fe681e5ea70baef5104c43feba87dea2 (diff)
downloadklee-347795c5d2dbc2815d395e60a08ad3debca68102.tar.gz
Use SmallString and llvm::sys::path/fs API of LLVM 3.4 because
Old Path API was removed
Diffstat (limited to 'lib')
-rw-r--r--lib/Core/StatsTracker.cpp10
-rw-r--r--lib/Module/KModule.cpp6
2 files changed, 15 insertions, 1 deletions
diff --git a/lib/Core/StatsTracker.cpp b/lib/Core/StatsTracker.cpp
index 8161a52c..fde2eae8 100644
--- a/lib/Core/StatsTracker.cpp
+++ b/lib/Core/StatsTracker.cpp
@@ -55,6 +55,7 @@
 
 #include <iostream>
 #include <fstream>
+#include <unistd.h>
 
 using namespace klee;
 using namespace llvm;
@@ -182,12 +183,13 @@ StatsTracker::StatsTracker(Executor &_executor, std::string _objectFilename,
     updateMinDistToUncovered(_updateMinDistToUncovered) {
   KModule *km = executor.kmodule;
 
-  sys::Path module(objectFilename);
 #if LLVM_VERSION_CODE < LLVM_VERSION(3, 1)
   if (!sys::Path(objectFilename).isAbsolute()) {
 #else
   if (!sys::path::is_absolute(objectFilename)) {
 #endif
+
+#if LLVM_VERSION_CODE < LLVM_VERSION(3,4)
     sys::Path current = sys::Path::GetCurrentDirectory();
     current.appendComponent(objectFilename);
 #if LLVM_VERSION_CODE < LLVM_VERSION(3, 1)
@@ -196,6 +198,12 @@ StatsTracker::StatsTracker(Executor &_executor, std::string _objectFilename,
     if (sys::fs::exists(current.c_str()))
 #endif
       objectFilename = current.c_str();
+#else
+    SmallString<128> current(objectFilename);
+    if(sys::fs::make_absolute(current) && sys::fs::exists(current.str()))
+      objectFilename = current.c_str();
+#endif
+
   }
 
   if (OutputIStats)
diff --git a/lib/Module/KModule.cpp b/lib/Module/KModule.cpp
index 2ecb14b8..5f03728b 100644
--- a/lib/Module/KModule.cpp
+++ b/lib/Module/KModule.cpp
@@ -375,6 +375,11 @@ void KModule::prepare(const Interpreter::ModuleOptions &opts,
   // FIXME: Find a way that we can test programs without requiring
   // this to be linked in, it makes low level debugging much more
   // annoying.
+#if LLVM_VERSION_CODE >= LLVM_VERSION(3,4)
+  SmallString<128> LibPath(opts.LibraryDir);
+  llvm::sys::path::append(LibPath, "kleeRuntimeIntrinsic.bc");
+  module = linkWithLibrary(module, LibPath.str());
+#else
   llvm::sys::Path path(opts.LibraryDir);
 #if LLVM_VERSION_CODE >= LLVM_VERSION(3, 3)
   path.appendComponent("kleeRuntimeIntrinsic.bc");
@@ -382,6 +387,7 @@ void KModule::prepare(const Interpreter::ModuleOptions &opts,
   path.appendComponent("libkleeRuntimeIntrinsic.bca");
 #endif
   module = linkWithLibrary(module, path.c_str());
+#endif
 
   // Add internal functions which are not used to check if instructions
   // have been already visited