@@ -39,8 +39,8 @@ use crate::debuginfo::metadata::type_map::build_type_with_children;
39
39
use crate :: debuginfo:: utils:: { WidePtrKind , wide_pointer_kind} ;
40
40
use crate :: llvm;
41
41
use crate :: llvm:: debuginfo:: {
42
- DIBasicType , DIBuilder , DICompositeType , DIDescriptor , DIFile , DIFlags , DILexicalBlock ,
43
- DIScope , DIType , DebugEmissionKind , DebugNameTableKind ,
42
+ DIBuilder , DICompositeType , DIDescriptor , DIFile , DIFlags , DILexicalBlock , DIScope , DIType ,
43
+ DebugEmissionKind , DebugNameTableKind ,
44
44
} ;
45
45
use crate :: value:: Value ;
46
46
@@ -491,22 +491,26 @@ pub(crate) fn type_di_node<'ll, 'tcx>(cx: &CodegenCx<'ll, 'tcx>, t: Ty<'tcx>) ->
491
491
// FIXME(mw): Cache this via a regular UniqueTypeId instead of an extra field in the debug context.
492
492
fn recursion_marker_type_di_node < ' ll , ' tcx > ( cx : & CodegenCx < ' ll , ' tcx > ) -> & ' ll DIType {
493
493
* debug_context ( cx) . recursion_marker_type . get_or_init ( move || {
494
- // The choice of type here is pretty arbitrary -
495
- // anything reading the debuginfo for a recursive
496
- // type is going to see *something* weird - the only
497
- // question is what exactly it will see.
498
- //
499
- // FIXME: the name `<recur_type>` does not fit the naming scheme
500
- // of other types.
501
- //
502
- // FIXME: it might make sense to use an actual pointer type here
503
- // so that debuggers can show the address.
504
- create_basic_type (
505
- cx,
506
- "<recur_type>" ,
507
- cx. tcx . data_layout . pointer_size ,
508
- dwarf_const:: DW_ATE_unsigned ,
509
- )
494
+ unsafe {
495
+ // The choice of type here is pretty arbitrary -
496
+ // anything reading the debuginfo for a recursive
497
+ // type is going to see *something* weird - the only
498
+ // question is what exactly it will see.
499
+ //
500
+ // FIXME: the name `<recur_type>` does not fit the naming scheme
501
+ // of other types.
502
+ //
503
+ // FIXME: it might make sense to use an actual pointer type here
504
+ // so that debuggers can show the address.
505
+ let name = "<recur_type>" ;
506
+ llvm:: LLVMRustDIBuilderCreateBasicType (
507
+ DIB ( cx) ,
508
+ name. as_c_char_ptr ( ) ,
509
+ name. len ( ) ,
510
+ cx. tcx . data_layout . pointer_size . bits ( ) ,
511
+ dwarf_const:: DW_ATE_unsigned ,
512
+ )
513
+ }
510
514
} )
511
515
}
512
516
@@ -784,7 +788,15 @@ fn build_basic_type_di_node<'ll, 'tcx>(
784
788
_ => bug ! ( "debuginfo::build_basic_type_di_node - `t` is invalid type" ) ,
785
789
} ;
786
790
787
- let ty_di_node = create_basic_type ( cx, name, cx. size_of ( t) , encoding) ;
791
+ let ty_di_node = unsafe {
792
+ llvm:: LLVMRustDIBuilderCreateBasicType (
793
+ DIB ( cx) ,
794
+ name. as_c_char_ptr ( ) ,
795
+ name. len ( ) ,
796
+ cx. size_of ( t) . bits ( ) ,
797
+ encoding,
798
+ )
799
+ } ;
788
800
789
801
if !cpp_like_debuginfo {
790
802
return DINodeCreationResult :: new ( ty_di_node, false ) ;
@@ -812,23 +824,6 @@ fn build_basic_type_di_node<'ll, 'tcx>(
812
824
DINodeCreationResult :: new ( typedef_di_node, false )
813
825
}
814
826
815
- fn create_basic_type < ' ll , ' tcx > (
816
- cx : & CodegenCx < ' ll , ' tcx > ,
817
- name : & str ,
818
- size : Size ,
819
- encoding : u32 ,
820
- ) -> & ' ll DIBasicType {
821
- unsafe {
822
- llvm:: LLVMRustDIBuilderCreateBasicType (
823
- DIB ( cx) ,
824
- name. as_c_char_ptr ( ) ,
825
- name. len ( ) ,
826
- size. bits ( ) ,
827
- encoding,
828
- )
829
- }
830
- }
831
-
832
827
fn build_foreign_type_di_node < ' ll , ' tcx > (
833
828
cx : & CodegenCx < ' ll , ' tcx > ,
834
829
t : Ty < ' tcx > ,
0 commit comments