Use LLVMDIBuilderCreateQualifiedType

This commit is contained in:
Zalathar
2025-09-17 21:36:59 +10:00
parent bb21dbeac7
commit 002771ab5c
3 changed files with 13 additions and 16 deletions

View File

@@ -567,7 +567,8 @@ fn build_variant_struct_wrapper_type_di_node<'ll, 'tcx>(
let build_assoc_const = |name: &str,
type_di_node_: &'ll DIType,
value: u64,
align: Align| unsafe {
align: Align|
-> &'ll llvm::Metadata {
// FIXME: Currently we force all DISCR_* values to be u64's as LLDB seems to have
// problems inspecting other value types. Since DISCR_* is typically only going to be
// directly inspected via the debugger visualizer - which compares it to the `tag` value
@@ -580,8 +581,9 @@ fn build_variant_struct_wrapper_type_di_node<'ll, 'tcx>(
};
// must wrap type in a `const` modifier for LLDB to be able to inspect the value of the member
let field_type =
llvm::LLVMRustDIBuilderCreateQualifiedType(DIB(cx), DW_TAG_const_type, t_di);
let field_type = unsafe {
llvm::LLVMDIBuilderCreateQualifiedType(DIB(cx), DW_TAG_const_type, t_di)
};
create_static_member_type(
cx,

View File

@@ -1970,6 +1970,14 @@ unsafe extern "C" {
ConstantVal: Option<&'ll Value>,
AlignInBits: u32,
) -> &'ll Metadata;
/// Creates a "qualified type" in the C/C++ sense, by adding modifiers
/// like `const` or `volatile`.
pub(crate) fn LLVMDIBuilderCreateQualifiedType<'ll>(
Builder: &DIBuilder<'ll>,
Tag: c_uint, // (DWARF tag, e.g. `DW_TAG_const_type`)
Type: &'ll Metadata,
) -> &'ll Metadata;
}
#[link(name = "llvm-wrapper", kind = "static")]
@@ -2330,12 +2338,6 @@ unsafe extern "C" {
Ty: &'a DIType,
) -> &'a DIType;
pub(crate) fn LLVMRustDIBuilderCreateQualifiedType<'a>(
Builder: &DIBuilder<'a>,
Tag: c_uint,
Type: &'a DIType,
) -> &'a DIDerivedType;
pub(crate) fn LLVMRustDIBuilderCreateStaticVariable<'a>(
Builder: &DIBuilder<'a>,
Context: Option<&'a DIScope>,