about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorJiri Slaby <jirislaby@gmail.com>2017-06-07 14:58:29 +0200
committerMartinNowack <martin.nowack@gmail.com>2018-09-18 10:36:36 +0100
commitbad4c5083b3e160abfaa84ede071c5e69d1f2709 (patch)
tree876cb40b4a44b29964de0552a7fbecf0a0058412
parent39630fd66650ddb90c155ed1d0b10d9027438296 (diff)
downloadklee-bad4c5083b3e160abfaa84ede071c5e69d1f2709.tar.gz
llvm4: errorOr and similar
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
-rw-r--r--lib/Module/ModuleUtil.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/Module/ModuleUtil.cpp b/lib/Module/ModuleUtil.cpp
index e2da9e51..bfec9e7d 100644
--- a/lib/Module/ModuleUtil.cpp
+++ b/lib/Module/ModuleUtil.cpp
@@ -433,7 +433,7 @@ bool klee::loadFile(const std::string &fileName, LLVMContext &context,
     if (auto archive = dyn_cast<object::Archive>(arch)) {
 // Load all bitcode files into memory
 #if LLVM_VERSION_CODE >= LLVM_VERSION(3, 9)
-      Error Err;
+      auto Err = Error::success();
       for (object::Archive::child_iterator AI = archive->child_begin(Err),
                                            AE = archive->child_end();
            AI != AE; ++AI)
@@ -461,8 +461,13 @@ bool klee::loadFile(const std::string &fileName, LLVMContext &context,
 #else
 	object::Archive::child_iterator childOrErr = AI;
 #endif
-        ErrorOr<StringRef> memberNameErr = childOrErr->getName();
+        auto memberNameErr = childOrErr->getName();
+#if LLVM_VERSION_CODE >= LLVM_VERSION(4, 0)
+        ec = memberNameErr ? std::error_code() :
+                errorToErrorCode(memberNameErr.takeError());
+#else
         ec = memberNameErr.getError();
+#endif
         if (!ec) {
           memberName = memberNameErr.get();
 #else
@@ -494,8 +499,12 @@ bool klee::loadFile(const std::string &fileName, LLVMContext &context,
         if (ec) {
 // If we can't open as a binary object file its hopefully a bitcode file
 #if LLVM_VERSION_CODE >= LLVM_VERSION(3, 6)
-          ErrorOr<MemoryBufferRef> buff = childOrErr->getMemoryBufferRef();
+          auto buff = childOrErr->getMemoryBufferRef();
+#if LLVM_VERSION_CODE >= LLVM_VERSION(4, 0)
+          ec = buff ? std::error_code() : errorToErrorCode(buff.takeError());
+#else
           ec = buff.getError();
+#endif
 #elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 5)
           ErrorOr<std::unique_ptr<MemoryBuffer>> buffErr =
               AI->getMemoryBuffer();