Use LLVMDIBuilderCreateArrayType
This commit is contained in:
@@ -32,9 +32,7 @@ use self::type_map::{DINodeCreationResult, Stub, UniqueTypeId};
|
|||||||
use super::CodegenUnitDebugContext;
|
use super::CodegenUnitDebugContext;
|
||||||
use super::namespace::mangled_name_of_instance;
|
use super::namespace::mangled_name_of_instance;
|
||||||
use super::type_names::{compute_debuginfo_type_name, compute_debuginfo_vtable_name};
|
use super::type_names::{compute_debuginfo_type_name, compute_debuginfo_vtable_name};
|
||||||
use super::utils::{
|
use super::utils::{DIB, debug_context, get_namespace_for_item, is_node_local_to_unit};
|
||||||
DIB, create_DIArray, debug_context, get_namespace_for_item, is_node_local_to_unit,
|
|
||||||
};
|
|
||||||
use crate::common::{AsCCharPtr, CodegenCx};
|
use crate::common::{AsCCharPtr, CodegenCx};
|
||||||
use crate::debuginfo::dwarf_const;
|
use crate::debuginfo::dwarf_const;
|
||||||
use crate::debuginfo::metadata::type_map::build_type_with_children;
|
use crate::debuginfo::metadata::type_map::build_type_with_children;
|
||||||
@@ -119,17 +117,17 @@ fn build_fixed_size_array_di_node<'ll, 'tcx>(
|
|||||||
.try_to_target_usize(cx.tcx)
|
.try_to_target_usize(cx.tcx)
|
||||||
.expect("expected monomorphic const in codegen") as c_longlong;
|
.expect("expected monomorphic const in codegen") as c_longlong;
|
||||||
|
|
||||||
let subrange =
|
let subrange = unsafe { llvm::LLVMRustDIBuilderGetOrCreateSubrange(DIB(cx), 0, upper_bound) };
|
||||||
unsafe { Some(llvm::LLVMRustDIBuilderGetOrCreateSubrange(DIB(cx), 0, upper_bound)) };
|
let subscripts = &[subrange];
|
||||||
|
|
||||||
let subscripts = create_DIArray(DIB(cx), &[subrange]);
|
|
||||||
let di_node = unsafe {
|
let di_node = unsafe {
|
||||||
llvm::LLVMRustDIBuilderCreateArrayType(
|
llvm::LLVMDIBuilderCreateArrayType(
|
||||||
DIB(cx),
|
DIB(cx),
|
||||||
size.bits(),
|
size.bits(),
|
||||||
align.bits() as u32,
|
align.bits() as u32,
|
||||||
element_type_di_node,
|
element_type_di_node,
|
||||||
subscripts,
|
subscripts.as_ptr(),
|
||||||
|
subscripts.len() as c_uint,
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1895,6 +1895,15 @@ unsafe extern "C" {
|
|||||||
UniqueId: *const c_uchar, // See "PTR_LEN_STR".
|
UniqueId: *const c_uchar, // See "PTR_LEN_STR".
|
||||||
UniqueIdLen: size_t,
|
UniqueIdLen: size_t,
|
||||||
) -> &'ll Metadata;
|
) -> &'ll Metadata;
|
||||||
|
|
||||||
|
pub(crate) fn LLVMDIBuilderCreateArrayType<'ll>(
|
||||||
|
Builder: &DIBuilder<'ll>,
|
||||||
|
Size: u64,
|
||||||
|
Align: u32,
|
||||||
|
Ty: &'ll Metadata,
|
||||||
|
Subscripts: *const &'ll Metadata,
|
||||||
|
NumSubscripts: c_uint,
|
||||||
|
) -> &'ll Metadata;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[link(name = "llvm-wrapper", kind = "static")]
|
#[link(name = "llvm-wrapper", kind = "static")]
|
||||||
@@ -2355,14 +2364,6 @@ unsafe extern "C" {
|
|||||||
AlignInBits: u32,
|
AlignInBits: u32,
|
||||||
) -> &'a DIVariable;
|
) -> &'a DIVariable;
|
||||||
|
|
||||||
pub(crate) fn LLVMRustDIBuilderCreateArrayType<'a>(
|
|
||||||
Builder: &DIBuilder<'a>,
|
|
||||||
Size: u64,
|
|
||||||
AlignInBits: u32,
|
|
||||||
Ty: &'a DIType,
|
|
||||||
Subscripts: &'a DIArray,
|
|
||||||
) -> &'a DIType;
|
|
||||||
|
|
||||||
pub(crate) fn LLVMRustDIBuilderGetOrCreateSubrange<'a>(
|
pub(crate) fn LLVMRustDIBuilderGetOrCreateSubrange<'a>(
|
||||||
Builder: &DIBuilder<'a>,
|
Builder: &DIBuilder<'a>,
|
||||||
Lo: i64,
|
Lo: i64,
|
||||||
|
|||||||
@@ -1211,15 +1211,6 @@ extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateVariable(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" LLVMMetadataRef
|
|
||||||
LLVMRustDIBuilderCreateArrayType(LLVMDIBuilderRef Builder, uint64_t Size,
|
|
||||||
uint32_t AlignInBits, LLVMMetadataRef Ty,
|
|
||||||
LLVMMetadataRef Subscripts) {
|
|
||||||
return wrap(unwrap(Builder)->createArrayType(
|
|
||||||
Size, AlignInBits, unwrapDI<DIType>(Ty),
|
|
||||||
DINodeArray(unwrapDI<MDTuple>(Subscripts))));
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" LLVMMetadataRef
|
extern "C" LLVMMetadataRef
|
||||||
LLVMRustDIBuilderGetOrCreateSubrange(LLVMDIBuilderRef Builder, int64_t Lo,
|
LLVMRustDIBuilderGetOrCreateSubrange(LLVMDIBuilderRef Builder, int64_t Lo,
|
||||||
int64_t Count) {
|
int64_t Count) {
|
||||||
|
|||||||
Reference in New Issue
Block a user