diff options
author | Dan Liew <daniel.liew@imperial.ac.uk> | 2014-08-20 23:57:22 +0100 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2014-09-17 08:09:38 -0700 |
commit | 05a3dcd0f55f948767c089c137e93c8fe22a3045 (patch) | |
tree | 8b2935aa8b16b80f0a48a592136549cc4d95899f /tools | |
parent | 0b0f7d0ad8465e551b0298e0a60ce68f7a2771ac (diff) | |
download | klee-05a3dcd0f55f948767c089c137e93c8fe22a3045.tar.gz |
Fix more LLVM3.5 compilation issues.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/klee/main.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tools/klee/main.cpp b/tools/klee/main.cpp index ab51c0dd..636b933b 100644 --- a/tools/klee/main.cpp +++ b/tools/klee/main.cpp @@ -555,7 +555,11 @@ void KleeHandler::loadPathFile(std::string name, void KleeHandler::getOutFiles(std::string path, std::vector<std::string> &results) { +#if LLVM_VERSION_CODE < LLVM_VERSION(3, 5) error_code ec; +#else + std::error_code ec; +#endif for (llvm::sys::fs::directory_iterator i(path,ec),e; i!=e && !ec; i.increment(ec)){ std::string f = (*i).path(); if (f.substr(f.size()-6,f.size()) == ".ktest") { @@ -1210,12 +1214,14 @@ int main(int argc, char **argv, char **envp) { // Load the bytecode... std::string ErrorMsg; Module *mainModule = 0; +#if LLVM_VERSION_CODE < LLVM_VERSION(3, 5) OwningPtr<MemoryBuffer> BufferPtr; error_code ec=MemoryBuffer::getFileOrSTDIN(InputFile.c_str(), BufferPtr); if (ec) { klee_error("error loading program '%s': %s", InputFile.c_str(), ec.message().c_str()); } + mainModule = getLazyBitcodeModule(BufferPtr.get(), getGlobalContext(), &ErrorMsg); if (mainModule) { @@ -1227,6 +1233,25 @@ int main(int argc, char **argv, char **envp) { if (!mainModule) klee_error("error loading program '%s': %s", InputFile.c_str(), ErrorMsg.c_str()); +#else + auto Buffer = MemoryBuffer::getFileOrSTDIN(InputFile.c_str()); + if (!Buffer) + klee_error("error loading program '%s': %s", InputFile.c_str(), + Buffer.getError().message().c_str()); + + auto mainModuleOrError = getLazyBitcodeModule(Buffer->get(), getGlobalContext()); + + if (!mainModuleOrError) + klee_error("error loading program '%s': %s", InputFile.c_str(), + mainModuleOrError.getError().message().c_str()); + + mainModule = *mainModuleOrError; + if (auto ec = mainModule->materializeAllPermanently()) { + klee_error("error loading program '%s': %s", InputFile.c_str(), + ec.message().c_str()); + } +#endif + if (WithPOSIXRuntime) { int r = initEnv(mainModule); @@ -1515,7 +1540,12 @@ int main(int argc, char **argv, char **envp) { handler->getInfoStream() << stats.str(); +#if LLVM_VERSION_CODE < LLVM_VERSION(3, 5) + // FIXME: This really doesn't look right + // This is preventing the module from being + // deleted automatically BufferPtr.take(); +#endif delete handler; return 0; |