Remove checks for LLVM < 4.0

While we still have to support LLVM 4.0 for Emscripten, we can
drop checks for LLVM >= 4.0 and < 4.0.
This commit is contained in:
Nikita Popov 2018-11-01 21:06:50 +01:00
parent f6e9a6e41c
commit d794597698
8 changed files with 6 additions and 215 deletions

View file

@ -42,7 +42,6 @@ LLVMRustLinkerAdd(RustLinker *L, char *BC, size_t Len) {
std::unique_ptr<MemoryBuffer> Buf =
MemoryBuffer::getMemBufferCopy(StringRef(BC, Len));
#if LLVM_VERSION_GE(4, 0)
Expected<std::unique_ptr<Module>> SrcOrError =
llvm::getLazyBitcodeModule(Buf->getMemBufferRef(), L->Ctx);
if (!SrcOrError) {
@ -51,20 +50,8 @@ LLVMRustLinkerAdd(RustLinker *L, char *BC, size_t Len) {
}
auto Src = std::move(*SrcOrError);
#else
ErrorOr<std::unique_ptr<Module>> Src =
llvm::getLazyBitcodeModule(std::move(Buf), L->Ctx);
if (!Src) {
LLVMRustSetLastError(Src.getError().message().c_str());
return false;
}
#endif
#if LLVM_VERSION_GE(4, 0)
if (L->L.linkInModule(std::move(Src))) {
#else
if (L->L.linkInModule(std::move(Src.get()))) {
#endif
LLVMRustSetLastError("");
return false;
}