Use LLVMDIBuilderCreateTypedef

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

View File

@@ -821,14 +821,15 @@ fn build_basic_type_di_node<'ll, 'tcx>(
};
let typedef_di_node = unsafe {
llvm::LLVMRustDIBuilderCreateTypedef(
llvm::LLVMDIBuilderCreateTypedef(
DIB(cx),
ty_di_node,
typedef_name.as_c_char_ptr(),
typedef_name.as_ptr(),
typedef_name.len(),
unknown_file_metadata(cx),
0,
None,
0, // (no line number)
None, // (no scope)
0u32, // (no alignment specified)
)
};

View File

@@ -24,7 +24,7 @@ use rustc_target::spec::SymbolVisibility;
use super::RustString;
use super::debuginfo::{
DIArray, DIBasicType, DIBuilder, DIDerivedType, DIDescriptor, DIEnumerator, DIFile, DIFlags,
DIArray, DIBuilder, DIDerivedType, DIDescriptor, DIEnumerator, DIFile, DIFlags,
DIGlobalVariableExpression, DILocation, DISPFlags, DIScope, DISubprogram, DISubrange,
DITemplateTypeParameter, DIType, DIVariable, DebugEmissionKind, DebugNameTableKind,
};
@@ -1978,6 +1978,17 @@ unsafe extern "C" {
Tag: c_uint, // (DWARF tag, e.g. `DW_TAG_const_type`)
Type: &'ll Metadata,
) -> &'ll Metadata;
pub(crate) fn LLVMDIBuilderCreateTypedef<'ll>(
Builder: &DIBuilder<'ll>,
Type: &'ll Metadata,
Name: *const c_uchar, // See "PTR_LEN_STR".
NameLen: size_t,
File: &'ll Metadata,
LineNo: c_uint,
Scope: Option<&'ll Metadata>,
AlignInBits: u32, // (optional; default is 0)
) -> &'ll Metadata;
}
#[link(name = "llvm-wrapper", kind = "static")]
@@ -2313,16 +2324,6 @@ unsafe extern "C" {
TParam: &'a DIArray,
) -> &'a DISubprogram;
pub(crate) fn LLVMRustDIBuilderCreateTypedef<'a>(
Builder: &DIBuilder<'a>,
Type: &'a DIBasicType,
Name: *const c_char,
NameLen: size_t,
File: &'a DIFile,
LineNo: c_uint,
Scope: Option<&'a DIScope>,
) -> &'a DIDerivedType;
pub(crate) fn LLVMRustDIBuilderCreateVariantMemberType<'a>(
Builder: &DIBuilder<'a>,
Scope: &'a DIScope,

View File

@@ -1064,16 +1064,6 @@ extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateMethod(
return wrap(Sub);
}
extern "C" LLVMMetadataRef
LLVMRustDIBuilderCreateTypedef(LLVMDIBuilderRef Builder, LLVMMetadataRef Type,
const char *Name, size_t NameLen,
LLVMMetadataRef File, unsigned LineNo,
LLVMMetadataRef Scope) {
return wrap(unwrap(Builder)->createTypedef(
unwrap<DIType>(Type), StringRef(Name, NameLen), unwrap<DIFile>(File),
LineNo, unwrapDIPtr<DIScope>(Scope)));
}
extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateVariantPart(
LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
size_t NameLen, LLVMMetadataRef File, unsigned LineNumber,