clover: adapt to new error API since LLVM r286752
authorVedran Miletić <vedran@miletic.net>
Mon, 14 Nov 2016 11:17:42 +0000 (12:17 +0100)
committerTom Stellard <thomas.stellard@amd.com>
Mon, 14 Nov 2016 15:50:29 +0000 (15:50 +0000)
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
src/gallium/state_trackers/clover/llvm/codegen/bitcode.cpp

index 8e89a49a9c0a46bd835dca7e908d57199d9a9e53..5dcc4f8a48c9793b42fa6f43d9239a9edfc4f305 100644 (file)
@@ -98,8 +98,14 @@ clover::llvm::parse_module_library(const module &m, ::llvm::LLVMContext &ctx,
                                    std::string &r_log) {
    auto mod = ::llvm::parseBitcodeFile(::llvm::MemoryBufferRef(
                                         as_string(m.secs[0].data), " "), ctx);
-   if (!mod)
-      fail(r_log, error(CL_INVALID_PROGRAM), mod.getError().message());
+
+   if (::llvm::Error err = mod.takeError()) {
+      std::string msg;
+      ::llvm::handleAllErrors(std::move(err), [&](::llvm::ErrorInfoBase &EIB) {
+         msg = EIB.message();
+         fail(r_log, error(CL_INVALID_PROGRAM), msg.c_str());
+      });
+   }
 
    return std::unique_ptr<::llvm::Module>(std::move(*mod));
 }