1
Fork 0

Make local_crate_source_file return a RealFileName

so it can be remapped (or not) by callers
This commit is contained in:
Urgau 2024-03-19 13:51:22 +01:00
parent 106146fd95
commit ee2898d3f1
5 changed files with 23 additions and 14 deletions

View file

@ -838,9 +838,11 @@ pub fn build_compile_unit_di_node<'ll, 'tcx>(
codegen_unit_name: &str,
debug_context: &CodegenUnitDebugContext<'ll, 'tcx>,
) -> &'ll DIDescriptor {
use rustc_session::{config::RemapPathScopeComponents, RemapFileNameExt};
let mut name_in_debuginfo = tcx
.sess
.local_crate_source_file()
.map(|src| src.for_scope(&tcx.sess, RemapPathScopeComponents::DEBUGINFO).to_path_buf())
.unwrap_or_else(|| PathBuf::from(tcx.crate_name(LOCAL_CRATE).as_str()));
// To avoid breaking split DWARF, we need to ensure that each codegen unit
@ -868,7 +870,6 @@ pub fn build_compile_unit_di_node<'ll, 'tcx>(
// FIXME(#41252) Remove "clang LLVM" if we can get GDB and LLVM to play nice.
let producer = format!("clang LLVM ({rustc_producer})");
use rustc_session::{config::RemapPathScopeComponents, RemapFileNameExt};
let name_in_debuginfo = name_in_debuginfo.to_string_lossy();
let work_dir = tcx
.sess