Use LLVMDIBuilderCreateStructType
This commit is contained in:
parent
bae6fde270
commit
af88d14cac
3 changed files with 29 additions and 42 deletions
|
|
@ -10,7 +10,7 @@ use rustc_middle::bug;
|
|||
use rustc_middle::ty::{self, ExistentialTraitRef, Ty, TyCtxt};
|
||||
|
||||
use super::{DefinitionLocation, SmallVec, UNKNOWN_LINE_NUMBER, unknown_file_metadata};
|
||||
use crate::common::{AsCCharPtr, CodegenCx};
|
||||
use crate::common::CodegenCx;
|
||||
use crate::debuginfo::utils::{DIB, create_DIArray, debug_context};
|
||||
use crate::llvm::debuginfo::{DIFlags, DIScope, DIType};
|
||||
use crate::llvm::{self};
|
||||
|
|
@ -193,7 +193,6 @@ pub(super) fn stub<'ll, 'tcx>(
|
|||
flags: DIFlags,
|
||||
) -> StubInfo<'ll, 'tcx> {
|
||||
let no_elements: &[Option<&llvm::Metadata>] = &[];
|
||||
let empty_array = create_DIArray(DIB(cx), &[]);
|
||||
let unique_type_id_str = unique_type_id.generate_unique_id_string(cx.tcx);
|
||||
|
||||
let (file_metadata, line_number) = if let Some(def_location) = def_location {
|
||||
|
|
@ -209,10 +208,10 @@ pub(super) fn stub<'ll, 'tcx>(
|
|||
_ => None,
|
||||
};
|
||||
unsafe {
|
||||
llvm::LLVMRustDIBuilderCreateStructType(
|
||||
llvm::LLVMDIBuilderCreateStructType(
|
||||
DIB(cx),
|
||||
containing_scope,
|
||||
name.as_c_char_ptr(),
|
||||
name.as_ptr(),
|
||||
name.len(),
|
||||
file_metadata,
|
||||
line_number,
|
||||
|
|
@ -220,10 +219,11 @@ pub(super) fn stub<'ll, 'tcx>(
|
|||
align.bits() as u32,
|
||||
flags,
|
||||
None,
|
||||
empty_array,
|
||||
0,
|
||||
no_elements.as_ptr(),
|
||||
no_elements.len() as c_uint,
|
||||
0u32, // (Objective-C runtime version; default is 0)
|
||||
vtable_holder,
|
||||
unique_type_id_str.as_c_char_ptr(),
|
||||
unique_type_id_str.as_ptr(),
|
||||
unique_type_id_str.len(),
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,9 +24,9 @@ use rustc_target::spec::SymbolVisibility;
|
|||
|
||||
use super::RustString;
|
||||
use super::debuginfo::{
|
||||
DIArray, DIBasicType, DIBuilder, DICompositeType, DIDerivedType, DIDescriptor, DIEnumerator,
|
||||
DIFile, DIFlags, DIGlobalVariableExpression, DILocation, DISPFlags, DIScope, DISubprogram,
|
||||
DISubrange, DITemplateTypeParameter, DIType, DIVariable, DebugEmissionKind, DebugNameTableKind,
|
||||
DIArray, DIBasicType, DIBuilder, DIDerivedType, DIDescriptor, DIEnumerator, DIFile, DIFlags,
|
||||
DIGlobalVariableExpression, DILocation, DISPFlags, DIScope, DISubprogram, DISubrange,
|
||||
DITemplateTypeParameter, DIType, DIVariable, DebugEmissionKind, DebugNameTableKind,
|
||||
};
|
||||
use crate::llvm;
|
||||
|
||||
|
|
@ -1923,6 +1923,25 @@ unsafe extern "C" {
|
|||
Name: *const c_uchar, // See "PTR_LEN_STR".
|
||||
NameLen: size_t,
|
||||
) -> &'ll Metadata;
|
||||
|
||||
pub(crate) fn LLVMDIBuilderCreateStructType<'ll>(
|
||||
Builder: &DIBuilder<'ll>,
|
||||
Scope: Option<&'ll Metadata>,
|
||||
Name: *const c_uchar, // See "PTR_LEN_STR".
|
||||
NameLen: size_t,
|
||||
File: &'ll Metadata,
|
||||
LineNumber: c_uint,
|
||||
SizeInBits: u64,
|
||||
AlignInBits: u32,
|
||||
Flags: DIFlags,
|
||||
DerivedFrom: Option<&'ll Metadata>,
|
||||
Elements: *const Option<&'ll Metadata>,
|
||||
NumElements: c_uint,
|
||||
RunTimeLang: c_uint, // (optional Objective-C runtime version; default is 0)
|
||||
VTableHolder: Option<&'ll Metadata>,
|
||||
UniqueId: *const c_uchar, // See "PTR_LEN_STR".
|
||||
UniqueIdLen: size_t,
|
||||
) -> &'ll Metadata;
|
||||
}
|
||||
|
||||
#[link(name = "llvm-wrapper", kind = "static")]
|
||||
|
|
@ -2268,24 +2287,6 @@ unsafe extern "C" {
|
|||
Scope: Option<&'a DIScope>,
|
||||
) -> &'a DIDerivedType;
|
||||
|
||||
pub(crate) fn LLVMRustDIBuilderCreateStructType<'a>(
|
||||
Builder: &DIBuilder<'a>,
|
||||
Scope: Option<&'a DIDescriptor>,
|
||||
Name: *const c_char,
|
||||
NameLen: size_t,
|
||||
File: &'a DIFile,
|
||||
LineNumber: c_uint,
|
||||
SizeInBits: u64,
|
||||
AlignInBits: u32,
|
||||
Flags: DIFlags,
|
||||
DerivedFrom: Option<&'a DIType>,
|
||||
Elements: &'a DIArray,
|
||||
RunTimeLang: c_uint,
|
||||
VTableHolder: Option<&'a DIType>,
|
||||
UniqueId: *const c_char,
|
||||
UniqueIdLen: size_t,
|
||||
) -> &'a DICompositeType;
|
||||
|
||||
pub(crate) fn LLVMRustDIBuilderCreateMemberType<'a>(
|
||||
Builder: &DIBuilder<'a>,
|
||||
Scope: &'a DIDescriptor,
|
||||
|
|
|
|||
|
|
@ -1074,20 +1074,6 @@ LLVMRustDIBuilderCreateTypedef(LLVMDIBuilderRef Builder, LLVMMetadataRef Type,
|
|||
LineNo, unwrapDIPtr<DIScope>(Scope)));
|
||||
}
|
||||
|
||||
extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateStructType(
|
||||
LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
|
||||
size_t NameLen, LLVMMetadataRef File, unsigned LineNumber,
|
||||
uint64_t SizeInBits, uint32_t AlignInBits, LLVMDIFlags Flags,
|
||||
LLVMMetadataRef DerivedFrom, LLVMMetadataRef Elements, unsigned RunTimeLang,
|
||||
LLVMMetadataRef VTableHolder, const char *UniqueId, size_t UniqueIdLen) {
|
||||
return wrap(unwrap(Builder)->createStructType(
|
||||
unwrapDI<DIDescriptor>(Scope), StringRef(Name, NameLen),
|
||||
unwrapDI<DIFile>(File), LineNumber, SizeInBits, AlignInBits,
|
||||
fromRust(Flags), unwrapDI<DIType>(DerivedFrom),
|
||||
DINodeArray(unwrapDI<MDTuple>(Elements)), RunTimeLang,
|
||||
unwrapDI<DIType>(VTableHolder), StringRef(UniqueId, UniqueIdLen)));
|
||||
}
|
||||
|
||||
extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateVariantPart(
|
||||
LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
|
||||
size_t NameLen, LLVMMetadataRef File, unsigned LineNumber,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue