[Mesa-dev] [PATCH] clover: adapt to new error API since LLVM r286752
Francisco Jerez
currojerez at riseup.net
Mon Nov 14 17:32:03 UTC 2016
Jan Vesely <jan.vesely at rutgers.edu> writes:
> On Mon, 2016-11-14 at 12:17 +0100, Vedran Miletić wrote:
>> ---
>> src/gallium/state_trackers/clover/llvm/codegen/bitcode.cpp | 10 ++++++++--
>> 1 file changed, 8 insertions(+), 2 deletions(-)
>>
>> diff --git a/src/gallium/state_trackers/clover/llvm/codegen/bitcode.cpp b/src/gallium/state_trackers/clover/llvm/codegen/bitcode.cpp
>> index 8e89a49..5dcc4f8 100644
>> --- a/src/gallium/state_trackers/clover/llvm/codegen/bitcode.cpp
>> +++ b/src/gallium/state_trackers/clover/llvm/codegen/bitcode.cpp
>> @@ -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;
>
> Any particular reason to keep this outside of the function?
>
Yeah, just drop the definition altogether, no reason to capture the
useless temporary into the closure below.
>> + ::llvm::handleAllErrors(std::move(err), [&](::llvm::ErrorInfoBase &EIB) {
>> + msg = EIB.message();
>> + fail(r_log, error(CL_INVALID_PROGRAM), msg.c_str());
>
> This could be EIB.message().c_str(), but that's just bikeshedding.
>
> Jan
>
>> + });
>> + }
>>
Isn't this going to break the build with previous LLVM versions? Sounds
like you need to define a small wrapper function in llvm/compat.hpp.
>> return std::unique_ptr<::llvm::Module>(std::move(*mod));
>> }
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 212 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20161114/cd439ea1/attachment.sig>
More information about the mesa-dev
mailing list