Skip to content

Commit 2e01bf1

Browse files
committed
Moved cache to CrateDebugContext
1 parent 490b268 commit 2e01bf1

File tree

1 file changed

+5
-0
lines changed
  • compiler/rustc_codegen_llvm/src/debuginfo

1 file changed

+5
-0
lines changed

compiler/rustc_codegen_llvm/src/debuginfo/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ use crate::llvm::debuginfo::{
1515
DIArray, DIBuilder, DIFile, DIFlags, DILexicalBlock, DILocation, DISPFlags, DIScope, DIType,
1616
DIVariable,
1717
};
18+
use crate::debuginfo::utils::debug_context;
1819
use crate::value::Value;
1920

2021
use rustc_codegen_ssa::debuginfo::type_names;
@@ -62,6 +63,7 @@ pub struct CrateDebugContext<'a, 'tcx> {
6263
builder: &'a mut DIBuilder<'a>,
6364
created_files: RefCell<FxHashMap<(Option<String>, Option<String>), &'a DIFile>>,
6465
created_enum_disr_types: RefCell<FxHashMap<(DefId, Primitive), &'a DIType>>,
66+
type_name_cache: RefCell<FxHashMap<(Ty<'tcx>, bool), String>>,
6567

6668
type_map: RefCell<TypeMap<'a, 'tcx>>,
6769
namespace_map: RefCell<DefIdMap<&'a DIScope>>,
@@ -91,6 +93,7 @@ impl<'a, 'tcx> CrateDebugContext<'a, 'tcx> {
9193
builder,
9294
created_files: Default::default(),
9395
created_enum_disr_types: Default::default(),
96+
type_name_cache: Default::default(),
9497
type_map: Default::default(),
9598
namespace_map: RefCell::new(Default::default()),
9699
composite_types_completed: Default::default(),
@@ -435,10 +438,12 @@ impl DebugInfoMethods<'tcx> for CodegenCx<'ll, 'tcx> {
435438
substs: SubstsRef<'tcx>,
436439
name_to_append_suffix_to: &mut String,
437440
) -> &'ll DIArray {
441+
let type_name_cache = &mut *debug_context(cx).type_name_cache.borrow_mut();
438442
type_names::push_generic_params(
439443
cx.tcx,
440444
cx.tcx.normalize_erasing_regions(ty::ParamEnv::reveal_all(), substs),
441445
name_to_append_suffix_to,
446+
type_name_cache,
442447
);
443448

444449
if substs.types().next().is_none() {

0 commit comments

Comments
 (0)