diff options
author | Dan Liew <daniel.liew@imperial.ac.uk> | 2014-04-02 21:44:51 +0100 |
---|---|---|
committer | Martin Nowack <martin@se.inf.tu-dresden.de> | 2014-04-14 10:34:54 +0200 |
commit | 4a9a908739d7d7c833e7985ea7465d95c0dd0b82 (patch) | |
tree | 34943eae75ca7471ff91534acde5bc4578a7d530 /lib | |
parent | f2ce7b5b53d78c370b01f5f219df0ea0021c7bb2 (diff) | |
download | klee-4a9a908739d7d7c833e7985ea7465d95c0dd0b82.tar.gz |
Tidy up code by using LLVM's V2 path API only and removing uses
of old V1 path API. LLVM2.9 supports LLVM's V2 path API. Because that is the minimum version we support we should just use this API everywhere so we reduce the number of #if LLVM_VERSION_CODE macros and duplicated code.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Core/StatsTracker.cpp | 28 | ||||
-rw-r--r-- | lib/Module/KModule.cpp | 17 |
2 files changed, 14 insertions, 31 deletions
diff --git a/lib/Core/StatsTracker.cpp b/lib/Core/StatsTracker.cpp index fde2eae8..1bb9885a 100644 --- a/lib/Core/StatsTracker.cpp +++ b/lib/Core/StatsTracker.cpp @@ -49,9 +49,7 @@ #include "llvm/Support/raw_os_ostream.h" #include "llvm/Support/Process.h" #include "llvm/Support/Path.h" -#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 1) #include "llvm/Support/FileSystem.h" -#endif #include <iostream> #include <fstream> @@ -183,27 +181,15 @@ StatsTracker::StatsTracker(Executor &_executor, std::string _objectFilename, updateMinDistToUncovered(_updateMinDistToUncovered) { KModule *km = executor.kmodule; -#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) - if (current.exists()) -#else - 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(sys::fs::make_absolute(current)) { + bool exists = false; + error_code ec = sys::fs::exists(current.str(), exists); + if (ec == errc::success && exists) { + objectFilename = current.c_str(); + } + } } if (OutputIStats) diff --git a/lib/Module/KModule.cpp b/lib/Module/KModule.cpp index 5f03728b..e06e722a 100644 --- a/lib/Module/KModule.cpp +++ b/lib/Module/KModule.cpp @@ -375,19 +375,16 @@ 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"); + llvm::sys::path::append(LibPath, +#if LLVM_VERSION_CODE >= LLVM_VERSION(3,3) + "kleeRuntimeIntrinsic.bc" #else - path.appendComponent("libkleeRuntimeIntrinsic.bca"); -#endif - module = linkWithLibrary(module, path.c_str()); + "libkleeRuntimeIntrinsic.bca" #endif + ); + module = linkWithLibrary(module, LibPath.str()); // Add internal functions which are not used to check if instructions // have been already visited |