@@ -38,8 +38,8 @@ use crate::debuginfo::metadata::type_map::build_type_with_children;
38
38
use crate::debuginfo::utils::{WidePtrKind, wide_pointer_kind};
39
39
use crate::llvm;
40
40
use crate::llvm::debuginfo::{
41
- DIDescriptor, DIFile, DIFlags, DILexicalBlock, DIScope, DIType, DebugEmissionKind ,
42
- DebugNameTableKind,
41
+ DICompositeType, DIDescriptor, DIFile, DIFlags, DILexicalBlock, DIScope, DIType,
42
+ DebugEmissionKind, DebugNameTableKind,
43
43
};
44
44
use crate::value::Value;
45
45
@@ -312,12 +312,7 @@ fn build_subroutine_type_di_node<'ll, 'tcx>(
312
312
313
313
debug_context(cx).type_map.unique_id_to_di_node.borrow_mut().remove(&unique_type_id);
314
314
315
- let fn_di_node = unsafe {
316
- llvm::LLVMRustDIBuilderCreateSubroutineType(
317
- DIB(cx),
318
- create_DIArray(DIB(cx), &signature_di_nodes[..]),
319
- )
320
- };
315
+ let fn_di_node = create_subroutine_type(cx, create_DIArray(DIB(cx), &signature_di_nodes[..]));
321
316
322
317
// This is actually a function pointer, so wrap it in pointer DI.
323
318
let name = compute_debuginfo_type_name(cx.tcx, fn_ty, false);
@@ -341,6 +336,13 @@ fn build_subroutine_type_di_node<'ll, 'tcx>(
341
336
DINodeCreationResult::new(di_node, false)
342
337
}
343
338
339
+ pub(super) fn create_subroutine_type<'ll>(
340
+ cx: &CodegenCx<'ll, '_>,
341
+ signature: &'ll DICompositeType,
342
+ ) -> &'ll DICompositeType {
343
+ unsafe { llvm::LLVMRustDIBuilderCreateSubroutineType(DIB(cx), signature) }
344
+ }
345
+
344
346
/// Create debuginfo for `dyn SomeTrait` types. Currently these are empty structs
345
347
/// we with the correct type name (e.g. "dyn SomeTrait<Foo, Item=u32> + Sync").
346
348
fn build_dyn_type_di_node<'ll, 'tcx>(
0 commit comments