diff options
author | Jiri Slaby <jirislaby@gmail.com> | 2018-06-15 08:28:22 +0200 |
---|---|---|
committer | MartinNowack <martin.nowack@gmail.com> | 2018-07-12 23:25:49 +0100 |
commit | 9968c00bdd7626249b6bd3f4df3f00da7406b0c1 (patch) | |
tree | 60b5a35cb3e5fd08ebf28cdd2d927164a3a9b3d2 /lib/Module | |
parent | 4c0c9719678d6a3a7f3cbb7ea6f513bef57180bf (diff) | |
download | klee-9968c00bdd7626249b6bd3f4df3f00da7406b0c1.tar.gz |
llvm38: archive child iterator changes
After LLVM commit 25569fdcdab0, archive iterator returns object::Archive::Child instead of child_iterator, adapt to that. Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Diffstat (limited to 'lib/Module')
-rw-r--r-- | lib/Module/ModuleUtil.cpp | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/lib/Module/ModuleUtil.cpp b/lib/Module/ModuleUtil.cpp index 37c957ba..4912ca94 100644 --- a/lib/Module/ModuleUtil.cpp +++ b/lib/Module/ModuleUtil.cpp @@ -424,8 +424,19 @@ bool klee::loadFile(const std::string &fileName, LLVMContext &context, StringRef memberName; #if LLVM_VERSION_CODE >= LLVM_VERSION(3, 5) - ErrorOr<StringRef> memberNameErr = AI->getName(); - std::error_code ec = memberNameErr.getError(); + std::error_code ec; +#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 8) + ErrorOr<object::Archive::Child> childOrErr = *AI; + ec = childOrErr.getError(); + if (ec) { + errorMsg = ec.message(); + return false; + } +#else + object::Archive::child_iterator childOrErr = AI; +#endif + ErrorOr<StringRef> memberNameErr = childOrErr->getName(); + ec = memberNameErr.getError(); if (!ec) { memberName = memberNameErr.get(); #else @@ -443,7 +454,7 @@ bool klee::loadFile(const std::string &fileName, LLVMContext &context, #if LLVM_VERSION_CODE >= LLVM_VERSION(3, 5) ErrorOr<std::unique_ptr<llvm::object::Binary>> child = - AI->getAsBinary(); + childOrErr->getAsBinary(); ec = child.getError(); #else OwningPtr<object::Binary> child; @@ -452,7 +463,7 @@ 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 = AI->getMemoryBufferRef(); + ErrorOr<MemoryBufferRef> buff = childOrErr->getMemoryBufferRef(); ec = buff.getError(); #elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 5) ErrorOr<std::unique_ptr<MemoryBuffer>> buffErr = |