@@ -437,11 +437,9 @@ pub fn type_di_node<'ll, 'tcx>(cx: &CodegenCx<'ll, 'tcx>, t: Ty<'tcx>) -> &'ll D
437
437
438
438
let DINodeCreationResult { di_node, already_stored_in_typemap } = match * t. kind ( ) {
439
439
ty:: Never | ty:: Bool | ty:: Char | ty:: Int ( _) | ty:: Uint ( _) | ty:: Float ( _) => {
440
- DINodeCreationResult :: new ( build_basic_type_di_node ( cx, t) , false )
441
- }
442
- ty:: Tuple ( elements) if elements. is_empty ( ) => {
443
- DINodeCreationResult :: new ( build_basic_type_di_node ( cx, t) , false )
440
+ build_basic_type_di_node ( cx, t)
444
441
}
442
+ ty:: Tuple ( elements) if elements. is_empty ( ) => build_basic_type_di_node ( cx, t) ,
445
443
ty:: Array ( ..) => build_fixed_size_array_di_node ( cx, unique_type_id, t) ,
446
444
ty:: Slice ( _) | ty:: Str => build_slice_type_di_node ( cx, t, unique_type_id) ,
447
445
ty:: Dynamic ( ..) => build_dyn_type_di_node ( cx, t, unique_type_id) ,
@@ -640,7 +638,10 @@ impl MsvcBasicName for ty::FloatTy {
640
638
}
641
639
}
642
640
643
- fn build_basic_type_di_node < ' ll , ' tcx > ( cx : & CodegenCx < ' ll , ' tcx > , t : Ty < ' tcx > ) -> & ' ll DIType {
641
+ fn build_basic_type_di_node < ' ll , ' tcx > (
642
+ cx : & CodegenCx < ' ll , ' tcx > ,
643
+ t : Ty < ' tcx > ,
644
+ ) -> DINodeCreationResult < ' ll > {
644
645
debug ! ( "build_basic_type_di_node: {:?}" , t) ;
645
646
646
647
// When targeting MSVC, emit MSVC style type names for compatibility with
@@ -649,7 +650,13 @@ fn build_basic_type_di_node<'ll, 'tcx>(cx: &CodegenCx<'ll, 'tcx>, t: Ty<'tcx>) -
649
650
650
651
let ( name, encoding) = match t. kind ( ) {
651
652
ty:: Never => ( "!" , DW_ATE_unsigned ) ,
652
- ty:: Tuple ( elements) if elements. is_empty ( ) => ( "()" , DW_ATE_unsigned ) ,
653
+ ty:: Tuple ( elements) if elements. is_empty ( ) => {
654
+ if cpp_like_debuginfo {
655
+ return build_tuple_type_di_node ( cx, UniqueTypeId :: for_ty ( cx. tcx , t) ) ;
656
+ } else {
657
+ ( "()" , DW_ATE_unsigned )
658
+ }
659
+ }
653
660
ty:: Bool => ( "bool" , DW_ATE_boolean ) ,
654
661
ty:: Char => ( "char" , DW_ATE_UTF ) ,
655
662
ty:: Int ( int_ty) if cpp_like_debuginfo => ( int_ty. msvc_basic_name ( ) , DW_ATE_signed ) ,
@@ -672,14 +679,14 @@ fn build_basic_type_di_node<'ll, 'tcx>(cx: &CodegenCx<'ll, 'tcx>, t: Ty<'tcx>) -
672
679
} ;
673
680
674
681
if !cpp_like_debuginfo {
675
- return ty_di_node;
682
+ return DINodeCreationResult :: new ( ty_di_node, false ) ;
676
683
}
677
684
678
685
let typedef_name = match t. kind ( ) {
679
686
ty:: Int ( int_ty) => int_ty. name_str ( ) ,
680
687
ty:: Uint ( uint_ty) => uint_ty. name_str ( ) ,
681
688
ty:: Float ( float_ty) => float_ty. name_str ( ) ,
682
- _ => return ty_di_node,
689
+ _ => return DINodeCreationResult :: new ( ty_di_node, false ) ,
683
690
} ;
684
691
685
692
let typedef_di_node = unsafe {
@@ -694,7 +701,7 @@ fn build_basic_type_di_node<'ll, 'tcx>(cx: &CodegenCx<'ll, 'tcx>, t: Ty<'tcx>) -
694
701
)
695
702
} ;
696
703
697
- typedef_di_node
704
+ DINodeCreationResult :: new ( typedef_di_node, false )
698
705
}
699
706
700
707
fn build_foreign_type_di_node < ' ll , ' tcx > (
0 commit comments