summary refs log tree commit diff
path: root/src/rustllvm/RustWrapper.cpp
diff options
context:
space:
mode:
authorTamir Duberstein <tamird@gmail.com>2015-04-20 10:19:02 -0700
committerTamir Duberstein <tamird@gmail.com>2015-04-21 07:20:48 -0700
commitba276adab596bafe48a27dc02dcc5867446a52b5 (patch)
tree5cb6a4d98ba9e6e3c1ffc5782654d292bf338266 /src/rustllvm/RustWrapper.cpp
parent77acda1c8ee75f9eb923ddd811ee591951b2d43f (diff)
downloadrust-ba276adab596bafe48a27dc02dcc5867446a52b5.tar.gz
rust-ba276adab596bafe48a27dc02dcc5867446a52b5.zip
LLVM < 3.5 is unsupported since bb18a3c
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
-rw-r--r--src/rustllvm/RustWrapper.cpp22
1 files changed, 6 insertions, 16 deletions
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<DIDescriptor>(Context),
 #else
     return wrap(Builder->createStaticVariable(unwrapDI<DIDescriptor>(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<llvm::Value *, 16> addr_ops;
         llvm::Type *Int64Ty = Type::getInt64Ty(unwrap<MDNode>(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<Module *> Src = llvm::getLazyBitcodeModule(buf, Dst->getContext());
-#else
+#if LLVM_VERSION_MINOR >= 6
     std::unique_ptr<MemoryBuffer> buf = MemoryBuffer::getMemBufferCopy(StringRef(bc, len));
     ErrorOr<Module *> Src = llvm::getLazyBitcodeModule(std::move(buf), Dst->getContext());
+#else
+    MemoryBuffer* buf = MemoryBuffer::getMemBufferCopy(StringRef(bc, len));
+    ErrorOr<Module *> 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