Skip to content

Commit 768c6c0

Browse files
author
Dylan McKay
committed
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'.
1 parent 0648517 commit 768c6c0

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/librustc_llvm/ffi.rs

+6
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// FIXME: Rename 'DIGlobalVariable' to 'DIGlobalVariableExpression'
12+
// once support for LLVM 3.9 is dropped.
13+
//
14+
// This method was changed in this LLVM patch:
15+
// https://reviews.llvm.org/D26769
16+
1117
use debuginfo::{DIBuilderRef, DIDescriptor, DIFile, DILexicalBlock, DISubprogram, DIType,
1218
DIBasicType, DIDerivedType, DICompositeType, DIScope, DIVariable,
1319
DIGlobalVariable, DIArray, DISubrange, DITemplateTypeParameter, DIEnumerator,

src/rustllvm/RustWrapper.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,11 @@ extern "C" LLVMRustMetadataRef LLVMRustDIBuilderCreateStaticVariable(
588588
}
589589
#endif
590590

591+
#if LLVM_VERSION_GE(4, 0)
592+
return wrap(Builder->createGlobalVariableExpression(
593+
#else
591594
return wrap(Builder->createGlobalVariable(
595+
#endif
592596
unwrapDI<DIDescriptor>(Context), Name, LinkageName,
593597
unwrapDI<DIFile>(File), LineNo, unwrapDI<DIType>(Ty), IsLocalToUnit,
594598
#if LLVM_VERSION_GE(4, 0)

0 commit comments

Comments
 (0)