@@ -19,7 +19,9 @@ use rustc_middle::ty::{
19
19
self , AdtKind , CoroutineArgsExt , ExistentialTraitRef , Instance , Ty , TyCtxt , Visibility ,
20
20
} ;
21
21
use rustc_session:: config:: { self , DebugInfo , Lto } ;
22
- use rustc_span:: { DUMMY_SP , FileName , FileNameDisplayPreference , SourceFile , Symbol , hygiene} ;
22
+ use rustc_span:: {
23
+ DUMMY_SP , FileName , FileNameDisplayPreference , SourceFile , Span , Symbol , hygiene,
24
+ } ;
23
25
use rustc_symbol_mangling:: typeid_for_trait_ref;
24
26
use rustc_target:: spec:: DebuginfoKind ;
25
27
use smallvec:: smallvec;
@@ -423,6 +425,14 @@ fn build_slice_type_di_node<'ll, 'tcx>(
423
425
/// This function will look up the debuginfo node in the TypeMap. If it can't find it, it
424
426
/// will create the node by dispatching to the corresponding `build_*_di_node()` function.
425
427
pub ( crate ) fn type_di_node < ' ll , ' tcx > ( cx : & CodegenCx < ' ll , ' tcx > , t : Ty < ' tcx > ) -> & ' ll DIType {
428
+ spanned_type_di_node ( cx, t, DUMMY_SP )
429
+ }
430
+
431
+ pub ( crate ) fn spanned_type_di_node < ' ll , ' tcx > (
432
+ cx : & CodegenCx < ' ll , ' tcx > ,
433
+ t : Ty < ' tcx > ,
434
+ span : Span ,
435
+ ) -> & ' ll DIType {
426
436
let unique_type_id = UniqueTypeId :: for_ty ( cx. tcx , t) ;
427
437
428
438
if let Some ( existing_di_node) = debug_context ( cx) . type_map . di_node_for_unique_id ( unique_type_id)
@@ -460,7 +470,7 @@ pub(crate) fn type_di_node<'ll, 'tcx>(cx: &CodegenCx<'ll, 'tcx>, t: Ty<'tcx>) ->
460
470
ty:: Adt ( def, ..) => match def. adt_kind ( ) {
461
471
AdtKind :: Struct => build_struct_type_di_node ( cx, unique_type_id) ,
462
472
AdtKind :: Union => build_union_type_di_node ( cx, unique_type_id) ,
463
- AdtKind :: Enum => enums:: build_enum_type_di_node ( cx, unique_type_id) ,
473
+ AdtKind :: Enum => enums:: build_enum_type_di_node ( cx, unique_type_id, span ) ,
464
474
} ,
465
475
ty:: Tuple ( _) => build_tuple_type_di_node ( cx, unique_type_id) ,
466
476
_ => bug ! ( "debuginfo: unexpected type in type_di_node(): {:?}" , t) ,
0 commit comments