Skip to content

Commit 6cfe10d

Browse files
committed
Use LLVMDIBuilderCreateStaticMemberType
1 parent a1bc07f commit 6cfe10d

File tree

3 files changed

+18
-28
lines changed

3 files changed

+18
-28
lines changed

compiler/rustc_codegen_llvm/src/debuginfo/metadata/enums/cpp_like.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use rustc_middle::ty::layout::{LayoutOf, TyAndLayout};
1111
use rustc_middle::ty::{self, AdtDef, CoroutineArgs, CoroutineArgsExt, Ty};
1212
use smallvec::smallvec;
1313

14-
use crate::common::{AsCCharPtr, CodegenCx};
14+
use crate::common::CodegenCx;
1515
use crate::debuginfo::metadata::enums::DiscrResult;
1616
use crate::debuginfo::metadata::type_map::{self, Stub, UniqueTypeId};
1717
use crate::debuginfo::metadata::{
@@ -381,10 +381,10 @@ fn build_single_variant_union_fields<'ll, 'tcx>(
381381
None,
382382
),
383383
unsafe {
384-
llvm::LLVMRustDIBuilderCreateStaticMemberType(
384+
llvm::LLVMDIBuilderCreateStaticMemberType(
385385
DIB(cx),
386386
enum_type_di_node,
387-
TAG_FIELD_NAME.as_c_char_ptr(),
387+
TAG_FIELD_NAME.as_ptr(),
388388
TAG_FIELD_NAME.len(),
389389
unknown_file_metadata(cx),
390390
UNKNOWN_LINE_NUMBER,
@@ -571,10 +571,10 @@ fn build_variant_struct_wrapper_type_di_node<'ll, 'tcx>(
571571

572572
let build_assoc_const =
573573
|name: &str, type_di_node: &'ll DIType, value: u64, align: Align| unsafe {
574-
llvm::LLVMRustDIBuilderCreateStaticMemberType(
574+
llvm::LLVMDIBuilderCreateStaticMemberType(
575575
DIB(cx),
576576
wrapper_struct_type_di_node,
577-
name.as_c_char_ptr(),
577+
name.as_ptr(),
578578
name.len(),
579579
unknown_file_metadata(cx),
580580
UNKNOWN_LINE_NUMBER,

compiler/rustc_codegen_llvm/src/llvm/ffi.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1746,6 +1746,19 @@ unsafe extern "C" {
17461746
Flags: DIFlags,
17471747
Ty: &'ll Metadata,
17481748
) -> &'ll Metadata;
1749+
1750+
pub(crate) fn LLVMDIBuilderCreateStaticMemberType<'ll>(
1751+
Builder: &DIBuilder<'ll>,
1752+
Scope: &'ll Metadata,
1753+
Name: *const c_uchar,
1754+
NameLen: size_t,
1755+
File: &'ll Metadata,
1756+
LineNumber: c_uint,
1757+
Type: &'ll Metadata,
1758+
Flags: DIFlags,
1759+
ConstantVal: Option<&'ll Value>,
1760+
AlignInBits: u32,
1761+
) -> &'ll Metadata;
17491762
}
17501763

17511764
#[link(name = "llvm-wrapper", kind = "static")]
@@ -2103,19 +2116,6 @@ unsafe extern "C" {
21032116
Ty: &'a DIType,
21042117
) -> &'a DIType;
21052118

2106-
pub fn LLVMRustDIBuilderCreateStaticMemberType<'a>(
2107-
Builder: &DIBuilder<'a>,
2108-
Scope: &'a DIDescriptor,
2109-
Name: *const c_char,
2110-
NameLen: size_t,
2111-
File: &'a DIFile,
2112-
LineNo: c_uint,
2113-
Ty: &'a DIType,
2114-
Flags: DIFlags,
2115-
val: Option<&'a Value>,
2116-
AlignInBits: u32,
2117-
) -> &'a DIDerivedType;
2118-
21192119
pub fn LLVMRustDIBuilderCreateStaticVariable<'a>(
21202120
Builder: &DIBuilder<'a>,
21212121
Context: Option<&'a DIScope>,

compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,16 +1006,6 @@ extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateVariantMemberType(
10061006
fromRust(Flags), unwrapDI<DIType>(Ty)));
10071007
}
10081008

1009-
extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateStaticMemberType(
1010-
LLVMRustDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
1011-
size_t NameLen, LLVMMetadataRef File, unsigned LineNo, LLVMMetadataRef Ty,
1012-
LLVMRustDIFlags Flags, LLVMValueRef val, uint32_t AlignInBits) {
1013-
return wrap(Builder->createStaticMemberType(
1014-
unwrapDI<DIDescriptor>(Scope), StringRef(Name, NameLen),
1015-
unwrapDI<DIFile>(File), LineNo, unwrapDI<DIType>(Ty), fromRust(Flags),
1016-
unwrap<llvm::ConstantInt>(val), llvm::dwarf::DW_TAG_member, AlignInBits));
1017-
}
1018-
10191009
extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateStaticVariable(
10201010
LLVMRustDIBuilderRef Builder, LLVMMetadataRef Context, const char *Name,
10211011
size_t NameLen, const char *LinkageName, size_t LinkageNameLen,

0 commit comments

Comments
 (0)