@@ -38,8 +38,8 @@ use crate::debuginfo::metadata::type_map::build_type_with_children;
3838use crate :: debuginfo:: utils:: { WidePtrKind , wide_pointer_kind} ;
3939use crate :: llvm;
4040use crate :: llvm:: debuginfo:: {
41- DIDescriptor , DIFile , DIFlags , DILexicalBlock , DIScope , DIType , DebugEmissionKind ,
42- DebugNameTableKind ,
41+ DICompositeType , DIDescriptor , DIFile , DIFlags , DILexicalBlock , DIScope , DIType ,
42+ DebugEmissionKind , DebugNameTableKind ,
4343} ;
4444use crate :: value:: Value ;
4545
@@ -312,12 +312,7 @@ fn build_subroutine_type_di_node<'ll, 'tcx>(
312312
313313 debug_context ( cx) . type_map . unique_id_to_di_node . borrow_mut ( ) . remove ( & unique_type_id) ;
314314
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[ ..] ) ) ;
321316
322317 // This is actually a function pointer, so wrap it in pointer DI.
323318 let name = compute_debuginfo_type_name ( cx. tcx , fn_ty, false ) ;
@@ -341,6 +336,13 @@ fn build_subroutine_type_di_node<'ll, 'tcx>(
341336 DINodeCreationResult :: new ( di_node, false )
342337}
343338
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+
344346/// Create debuginfo for `dyn SomeTrait` types. Currently these are empty structs
345347/// we with the correct type name (e.g. "dyn SomeTrait<Foo, Item=u32> + Sync").
346348fn build_dyn_type_di_node < ' ll , ' tcx > (
0 commit comments