llvm6: Different return value for writeArchive

Updated in llvm-mirror/llvm@203c90ba this function now just returns an `Error`,
so this updates the C++ bindings accordingly
This commit is contained in:
Alex Crichton 2018-01-22 17:59:27 -08:00
parent b6fe1127e4
commit caedb36f08

View File

@ -232,9 +232,16 @@ LLVMRustWriteArchive(char *Dst, size_t NumMembers,
Members.push_back(std::move(*MOrErr));
}
}
auto Pair = writeArchive(Dst, Members, WriteSymbtab, Kind, true, false);
if (!Pair.second)
auto Result = writeArchive(Dst, Members, WriteSymbtab, Kind, true, false);
#if LLVM_VERSION_GE(6, 0)
if (!Result)
return LLVMRustResult::Success;
LLVMRustSetLastError(Pair.second.message().c_str());
LLVMRustSetLastError(toString(std::move(Result)).c_str());
#else
if (!Result.second)
return LLVMRustResult::Success;
LLVMRustSetLastError(Result.second.message().c_str());
#endif
return LLVMRustResult::Failure;
}