Use LLVMDIBuilderCreateUnionType
This commit is contained in:
parent
5419896111
commit
2552deb9cd
3 changed files with 25 additions and 34 deletions
|
|
@ -1,5 +1,6 @@
|
|||
use std::cell::RefCell;
|
||||
|
||||
use libc::c_uint;
|
||||
use rustc_abi::{Align, Size, VariantIdx};
|
||||
use rustc_data_structures::fingerprint::Fingerprint;
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
|
|
@ -191,6 +192,7 @@ pub(super) fn stub<'ll, 'tcx>(
|
|||
containing_scope: Option<&'ll DIScope>,
|
||||
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);
|
||||
|
||||
|
|
@ -227,19 +229,20 @@ pub(super) fn stub<'ll, 'tcx>(
|
|||
}
|
||||
}
|
||||
Stub::Union => unsafe {
|
||||
llvm::LLVMRustDIBuilderCreateUnionType(
|
||||
llvm::LLVMDIBuilderCreateUnionType(
|
||||
DIB(cx),
|
||||
containing_scope,
|
||||
name.as_c_char_ptr(),
|
||||
name.as_ptr(),
|
||||
name.len(),
|
||||
file_metadata,
|
||||
line_number,
|
||||
size.bits(),
|
||||
align.bits() as u32,
|
||||
flags,
|
||||
Some(empty_array),
|
||||
0,
|
||||
unique_type_id_str.as_c_char_ptr(),
|
||||
no_elements.as_ptr(),
|
||||
no_elements.len() as c_uint,
|
||||
0u32, // (Objective-C runtime version; default is 0)
|
||||
unique_type_id_str.as_ptr(),
|
||||
unique_type_id_str.len(),
|
||||
)
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1878,6 +1878,23 @@ unsafe extern "C" {
|
|||
NumParameterTypes: c_uint,
|
||||
Flags: DIFlags, // (default is `DIFlags::DIFlagZero`)
|
||||
) -> &'ll Metadata;
|
||||
|
||||
pub(crate) fn LLVMDIBuilderCreateUnionType<'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,
|
||||
Elements: *const Option<&'ll Metadata>,
|
||||
NumElements: c_uint,
|
||||
RunTimeLang: c_uint, // (optional Objective-C runtime version; default is 0)
|
||||
UniqueId: *const c_uchar, // See "PTR_LEN_STR".
|
||||
UniqueIdLen: size_t,
|
||||
) -> &'ll Metadata;
|
||||
}
|
||||
|
||||
#[link(name = "llvm-wrapper", kind = "static")]
|
||||
|
|
@ -2391,22 +2408,6 @@ unsafe extern "C" {
|
|||
IsScoped: bool,
|
||||
) -> &'a DIType;
|
||||
|
||||
pub(crate) fn LLVMRustDIBuilderCreateUnionType<'a>(
|
||||
Builder: &DIBuilder<'a>,
|
||||
Scope: Option<&'a DIScope>,
|
||||
Name: *const c_char,
|
||||
NameLen: size_t,
|
||||
File: &'a DIFile,
|
||||
LineNumber: c_uint,
|
||||
SizeInBits: u64,
|
||||
AlignInBits: u32,
|
||||
Flags: DIFlags,
|
||||
Elements: Option<&'a DIArray>,
|
||||
RunTimeLang: c_uint,
|
||||
UniqueId: *const c_char,
|
||||
UniqueIdLen: size_t,
|
||||
) -> &'a DIType;
|
||||
|
||||
pub(crate) fn LLVMRustDIBuilderCreateVariantPart<'a>(
|
||||
Builder: &DIBuilder<'a>,
|
||||
Scope: &'a DIScope,
|
||||
|
|
|
|||
|
|
@ -1268,19 +1268,6 @@ extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateEnumerationType(
|
|||
/* RunTimeLang */ 0, "", IsScoped));
|
||||
}
|
||||
|
||||
extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateUnionType(
|
||||
LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
|
||||
size_t NameLen, LLVMMetadataRef File, unsigned LineNumber,
|
||||
uint64_t SizeInBits, uint32_t AlignInBits, LLVMDIFlags Flags,
|
||||
LLVMMetadataRef Elements, unsigned RunTimeLang, const char *UniqueId,
|
||||
size_t UniqueIdLen) {
|
||||
return wrap(unwrap(Builder)->createUnionType(
|
||||
unwrapDI<DIDescriptor>(Scope), StringRef(Name, NameLen),
|
||||
unwrapDI<DIFile>(File), LineNumber, SizeInBits, AlignInBits,
|
||||
fromRust(Flags), DINodeArray(unwrapDI<MDTuple>(Elements)), RunTimeLang,
|
||||
StringRef(UniqueId, UniqueIdLen)));
|
||||
}
|
||||
|
||||
extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateTemplateTypeParameter(
|
||||
LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
|
||||
size_t NameLen, LLVMMetadataRef Ty) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue