1
Fork 0

debuginfo: Simplify TypeMap used during LLVM debuginfo generation.

The previous implementation was written before types were properly
normalized for code generation and had to assume a more complicated
relationship between types and their debuginfo -- generating separate
identifiers for debuginfo nodes that were based on normalized types.

Since types are now already normalized, we can use them as identifiers
for debuginfo nodes.
This commit is contained in:
Michael Woerister 2022-02-04 13:19:55 +01:00
parent 026d8ce7f5
commit e72e6399b1
6 changed files with 238 additions and 351 deletions

View file

@ -38,6 +38,7 @@ use libc::c_uint;
use smallvec::SmallVec;
use std::cell::RefCell;
use std::iter;
use std::lazy::OnceCell;
use tracing::debug;
mod create_scope_map;
@ -63,9 +64,11 @@ pub struct CrateDebugContext<'a, 'tcx> {
created_files: RefCell<FxHashMap<(Option<String>, Option<String>), &'a DIFile>>,
created_enum_disr_types: RefCell<FxHashMap<(DefId, Primitive), &'a DIType>>,
type_map: RefCell<TypeMap<'a, 'tcx>>,
type_map: TypeMap<'a, 'tcx>,
namespace_map: RefCell<DefIdMap<&'a DIScope>>,
recursion_marker_type: OnceCell<&'a DIType>,
// This collection is used to assert that composite types (structs, enums,
// ...) have their members only set once:
composite_types_completed: RefCell<FxHashSet<&'a DIType>>,
@ -93,6 +96,7 @@ impl<'a, 'tcx> CrateDebugContext<'a, 'tcx> {
created_enum_disr_types: Default::default(),
type_map: Default::default(),
namespace_map: RefCell::new(Default::default()),
recursion_marker_type: OnceCell::new(),
composite_types_completed: Default::default(),
}
}