@@ -15,6 +15,7 @@ use crate::llvm::debuginfo::{
15
15
DIArray , DIBuilder , DIFile , DIFlags , DILexicalBlock , DILocation , DISPFlags , DIScope , DIType ,
16
16
DIVariable ,
17
17
} ;
18
+ use crate :: debuginfo:: utils:: debug_context;
18
19
use crate :: value:: Value ;
19
20
20
21
use rustc_codegen_ssa:: debuginfo:: type_names;
@@ -62,6 +63,7 @@ pub struct CrateDebugContext<'a, 'tcx> {
62
63
builder : & ' a mut DIBuilder < ' a > ,
63
64
created_files : RefCell < FxHashMap < ( Option < String > , Option < String > ) , & ' a DIFile > > ,
64
65
created_enum_disr_types : RefCell < FxHashMap < ( DefId , Primitive ) , & ' a DIType > > ,
66
+ type_name_cache : RefCell < FxHashMap < ( Ty < ' tcx > , bool ) , String > > ,
65
67
66
68
type_map : RefCell < TypeMap < ' a , ' tcx > > ,
67
69
namespace_map : RefCell < DefIdMap < & ' a DIScope > > ,
@@ -91,6 +93,7 @@ impl<'a, 'tcx> CrateDebugContext<'a, 'tcx> {
91
93
builder,
92
94
created_files : Default :: default ( ) ,
93
95
created_enum_disr_types : Default :: default ( ) ,
96
+ type_name_cache : Default :: default ( ) ,
94
97
type_map : Default :: default ( ) ,
95
98
namespace_map : RefCell :: new ( Default :: default ( ) ) ,
96
99
composite_types_completed : Default :: default ( ) ,
@@ -435,10 +438,12 @@ impl DebugInfoMethods<'tcx> for CodegenCx<'ll, 'tcx> {
435
438
substs : SubstsRef < ' tcx > ,
436
439
name_to_append_suffix_to : & mut String ,
437
440
) -> & ' ll DIArray {
441
+ let type_name_cache = & mut * debug_context ( cx) . type_name_cache . borrow_mut ( ) ;
438
442
type_names:: push_generic_params (
439
443
cx. tcx ,
440
444
cx. tcx . normalize_erasing_regions ( ty:: ParamEnv :: reveal_all ( ) , substs) ,
441
445
name_to_append_suffix_to,
446
+ type_name_cache,
442
447
) ;
443
448
444
449
if substs. types ( ) . next ( ) . is_none ( ) {
0 commit comments