Use LLVMDIBuilderCreateSubroutineType
This commit is contained in:
parent
9d82de19df
commit
5419896111
4 changed files with 23 additions and 19 deletions
|
|
@ -318,7 +318,7 @@ fn build_subroutine_type_di_node<'ll, 'tcx>(
|
|||
|
||||
debug_context(cx).type_map.unique_id_to_di_node.borrow_mut().remove(&unique_type_id);
|
||||
|
||||
let fn_di_node = create_subroutine_type(cx, create_DIArray(DIB(cx), &signature_di_nodes[..]));
|
||||
let fn_di_node = create_subroutine_type(cx, &signature_di_nodes[..]);
|
||||
|
||||
// This is actually a function pointer, so wrap it in pointer DI.
|
||||
let name = compute_debuginfo_type_name(cx.tcx, fn_ty, false);
|
||||
|
|
@ -346,9 +346,17 @@ fn build_subroutine_type_di_node<'ll, 'tcx>(
|
|||
|
||||
pub(super) fn create_subroutine_type<'ll>(
|
||||
cx: &CodegenCx<'ll, '_>,
|
||||
signature: &'ll DICompositeType,
|
||||
signature: &[Option<&'ll llvm::Metadata>],
|
||||
) -> &'ll DICompositeType {
|
||||
unsafe { llvm::LLVMRustDIBuilderCreateSubroutineType(DIB(cx), signature) }
|
||||
unsafe {
|
||||
llvm::LLVMDIBuilderCreateSubroutineType(
|
||||
DIB(cx),
|
||||
None, // ("File" is ignored and has no effect)
|
||||
signature.as_ptr(),
|
||||
signature.len() as c_uint,
|
||||
DIFlags::FlagZero, // (default value)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/// Create debuginfo for `dyn SomeTrait` types. Currently these are empty structs
|
||||
|
|
|
|||
|
|
@ -349,7 +349,7 @@ impl<'ll, 'tcx> DebugInfoCodegenMethods<'tcx> for CodegenCx<'ll, 'tcx> {
|
|||
let file_metadata = file_metadata(self, &loc.file);
|
||||
|
||||
let function_type_metadata =
|
||||
create_subroutine_type(self, get_function_signature(self, fn_abi));
|
||||
create_subroutine_type(self, &get_function_signature(self, fn_abi));
|
||||
|
||||
let mut name = String::with_capacity(64);
|
||||
type_names::push_item_name(tcx, def_id, false, &mut name);
|
||||
|
|
@ -441,9 +441,9 @@ impl<'ll, 'tcx> DebugInfoCodegenMethods<'tcx> for CodegenCx<'ll, 'tcx> {
|
|||
fn get_function_signature<'ll, 'tcx>(
|
||||
cx: &CodegenCx<'ll, 'tcx>,
|
||||
fn_abi: &FnAbi<'tcx, Ty<'tcx>>,
|
||||
) -> &'ll DIArray {
|
||||
) -> Vec<Option<&'ll llvm::Metadata>> {
|
||||
if cx.sess().opts.debuginfo != DebugInfo::Full {
|
||||
return create_DIArray(DIB(cx), &[]);
|
||||
return vec![];
|
||||
}
|
||||
|
||||
let mut signature = Vec::with_capacity(fn_abi.args.len() + 1);
|
||||
|
|
@ -484,7 +484,7 @@ impl<'ll, 'tcx> DebugInfoCodegenMethods<'tcx> for CodegenCx<'ll, 'tcx> {
|
|||
.extend(fn_abi.args.iter().map(|arg| Some(type_di_node(cx, arg.layout.ty))));
|
||||
}
|
||||
|
||||
create_DIArray(DIB(cx), &signature[..])
|
||||
signature
|
||||
}
|
||||
|
||||
fn get_template_parameters<'ll, 'tcx>(
|
||||
|
|
|
|||
|
|
@ -1870,6 +1870,14 @@ unsafe extern "C" {
|
|||
Scope: &'ll Metadata,
|
||||
InlinedAt: Option<&'ll Metadata>,
|
||||
) -> &'ll Metadata;
|
||||
|
||||
pub(crate) fn LLVMDIBuilderCreateSubroutineType<'ll>(
|
||||
Builder: &DIBuilder<'ll>,
|
||||
File: Option<&'ll Metadata>, // (ignored and has no effect)
|
||||
ParameterTypes: *const Option<&'ll Metadata>,
|
||||
NumParameterTypes: c_uint,
|
||||
Flags: DIFlags, // (default is `DIFlags::DIFlagZero`)
|
||||
) -> &'ll Metadata;
|
||||
}
|
||||
|
||||
#[link(name = "llvm-wrapper", kind = "static")]
|
||||
|
|
@ -2172,11 +2180,6 @@ unsafe extern "C" {
|
|||
SourceLen: size_t,
|
||||
) -> &'a DIFile;
|
||||
|
||||
pub(crate) fn LLVMRustDIBuilderCreateSubroutineType<'a>(
|
||||
Builder: &DIBuilder<'a>,
|
||||
ParameterTypes: &'a DIArray,
|
||||
) -> &'a DICompositeType;
|
||||
|
||||
pub(crate) fn LLVMRustDIBuilderCreateFunction<'a>(
|
||||
Builder: &DIBuilder<'a>,
|
||||
Scope: &'a DIDescriptor,
|
||||
|
|
|
|||
|
|
@ -1026,13 +1026,6 @@ LLVMRustDIBuilderCreateFile(LLVMDIBuilderRef Builder, const char *Filename,
|
|||
CSInfo, oSource));
|
||||
}
|
||||
|
||||
extern "C" LLVMMetadataRef
|
||||
LLVMRustDIBuilderCreateSubroutineType(LLVMDIBuilderRef Builder,
|
||||
LLVMMetadataRef ParameterTypes) {
|
||||
return wrap(unwrap(Builder)->createSubroutineType(
|
||||
DITypeRefArray(unwrap<MDTuple>(ParameterTypes))));
|
||||
}
|
||||
|
||||
extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateFunction(
|
||||
LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
|
||||
size_t NameLen, const char *LinkageName, size_t LinkageNameLen,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue