Skip to content

Commit

Permalink
Rollup merge of rust-lang#39528 - dylanmckay:llvm-4.0-diglobalvar, r=…
Browse files Browse the repository at this point in the history
…alexcrichton

[LLVM 4.0] 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`.
  • Loading branch information
frewsxcv committed Feb 5, 2017
2 parents e0f3512 + 768c6c0 commit 184b46d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/librustc_llvm/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// FIXME: Rename 'DIGlobalVariable' to 'DIGlobalVariableExpression'
// once support for LLVM 3.9 is dropped.
//
// This method was changed in this LLVM patch:
// https://reviews.llvm.org/D26769

use debuginfo::{DIBuilderRef, DIDescriptor, DIFile, DILexicalBlock, DISubprogram, DIType,
DIBasicType, DIDerivedType, DICompositeType, DIScope, DIVariable,
DIGlobalVariable, DIArray, DISubrange, DITemplateTypeParameter, DIEnumerator,
Expand Down
4 changes: 4 additions & 0 deletions src/rustllvm/RustWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 184b46d

Please sign in to comment.