From ba276adab596bafe48a27dc02dcc5867446a52b5 Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Mon, 20 Apr 2015 10:19:02 -0700 Subject: LLVM < 3.5 is unsupported since bb18a3c --- src/rustllvm/RustWrapper.cpp | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) (limited to 'src/rustllvm/RustWrapper.cpp') diff --git a/src/rustllvm/RustWrapper.cpp b/src/rustllvm/RustWrapper.cpp index 31f75ae03b0..b9d62673a43 100644 --- a/src/rustllvm/RustWrapper.cpp +++ b/src/rustllvm/RustWrapper.cpp @@ -412,7 +412,7 @@ extern "C" LLVMMetadataRef LLVMDIBuilderCreateStaticVariable( bool isLocalToUnit, LLVMValueRef Val, LLVMMetadataRef Decl = NULL) { -#if LLVM_VERSION_MINOR == 6 +#if LLVM_VERSION_MINOR >= 6 return wrap(Builder->createGlobalVariable(unwrapDI(Context), #else return wrap(Builder->createStaticVariable(unwrapDI(Context), @@ -440,7 +440,7 @@ extern "C" LLVMMetadataRef LLVMDIBuilderCreateVariable( int64_t* AddrOps, unsigned AddrOpsCount, unsigned ArgNo) { -#if LLVM_VERSION_MINOR < 6 +#if LLVM_VERSION_MINOR == 5 if (AddrOpsCount > 0) { SmallVector addr_ops; llvm::Type *Int64Ty = Type::getInt64Ty(unwrap(Scope)->getContext()); @@ -707,12 +707,12 @@ extern "C" void LLVMWriteValueToString(LLVMValueRef Value, RustStringRef str) { extern "C" bool LLVMRustLinkInExternalBitcode(LLVMModuleRef dst, char *bc, size_t len) { Module *Dst = unwrap(dst); -#if LLVM_VERSION_MINOR == 5 - MemoryBuffer* buf = MemoryBuffer::getMemBufferCopy(StringRef(bc, len)); - ErrorOr Src = llvm::getLazyBitcodeModule(buf, Dst->getContext()); -#else +#if LLVM_VERSION_MINOR >= 6 std::unique_ptr buf = MemoryBuffer::getMemBufferCopy(StringRef(bc, len)); ErrorOr Src = llvm::getLazyBitcodeModule(std::move(buf), Dst->getContext()); +#else + MemoryBuffer* buf = MemoryBuffer::getMemBufferCopy(StringRef(bc, len)); + ErrorOr Src = llvm::getLazyBitcodeModule(buf, Dst->getContext()); #endif if (!Src) { LLVMRustSetLastError(Src.getError().message().c_str()); @@ -809,16 +809,6 @@ LLVMRustSetDLLExportStorageClass(LLVMValueRef Value) { V->setDLLStorageClass(GlobalValue::DLLExportStorageClass); } -extern "C" int -LLVMVersionMinor() { - return LLVM_VERSION_MINOR; -} - -extern "C" int -LLVMVersionMajor() { - return LLVM_VERSION_MAJOR; -} - // Note that the two following functions look quite similar to the // LLVMGetSectionName function. Sadly, it appears that this function only // returns a char* pointer, which isn't guaranteed to be null-terminated. The -- cgit 1.4.1-3-g733a5