about summary refs log tree commit diff
path: root/src/rustllvm/RustWrapper.cpp
diff options
context:
space:
mode:
authorDylan McKay <dylanmckay34@gmail.com>2017-02-04 23:22:05 +1300
committerDylan McKay <dylanmckay34@gmail.com>2017-02-04 23:22:05 +1300
commit768c6c081e4a8cac6b6f8eee5cde72ed13a7e87a (patch)
tree971746f9da04b4be1593c9d9733e7f1b74b53570 /src/rustllvm/RustWrapper.cpp
parent0648517faf1e2cf37c8b6770cbd0180a816ed9a0 (diff)
downloadrust-768c6c081e4a8cac6b6f8eee5cde72ed13a7e87a.tar.gz
rust-768c6c081e4a8cac6b6f8eee5cde72ed13a7e87a.zip
Support a debug info API change for LLVM 4.0
Instead of directly creating a 'DIGlobalVariable', we now have to create
a 'DIGlobalVariableExpression' which itself contains a reference to a
'DIGlobalVariable'.

This is a straightforward change.

In the future, we should rename 'DIGlobalVariable' in the FFI
bindings, assuming we will only refer to 'DIGlobalVariableExpression'
and not 'DIGlobalVariable'.
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
-rw-r--r--src/rustllvm/RustWrapper.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/rustllvm/RustWrapper.cpp b/src/rustllvm/RustWrapper.cpp
index 34ee7d552f3..c7bcd255818 100644
--- a/src/rustllvm/RustWrapper.cpp
+++ b/src/rustllvm/RustWrapper.cpp
@@ -588,7 +588,11 @@ extern "C" LLVMRustMetadataRef LLVMRustDIBuilderCreateStaticVariable(
   }
 #endif
 
+#if LLVM_VERSION_GE(4, 0)
+  return wrap(Builder->createGlobalVariableExpression(
+#else
   return wrap(Builder->createGlobalVariable(
+#endif
       unwrapDI<DIDescriptor>(Context), Name, LinkageName,
       unwrapDI<DIFile>(File), LineNo, unwrapDI<DIType>(Ty), IsLocalToUnit,
 #if LLVM_VERSION_GE(4, 0)