Introduce FileNameMapping::to_real_filename
and use it everywhere
This commit is contained in:
parent
d6a817a7d9
commit
6a2b2b43bd
@ -85,6 +85,8 @@ pub(crate) fn new(tcx: TyCtxt<'_>, isa: &dyn TargetIsa, cgu_name: &str) -> Self
|
|||||||
let mut dwarf = DwarfUnit::new(encoding);
|
let mut dwarf = DwarfUnit::new(encoding);
|
||||||
|
|
||||||
use rustc_session::config::RemapPathScopeComponents;
|
use rustc_session::config::RemapPathScopeComponents;
|
||||||
|
use rustc_session::RemapFileNameExt;
|
||||||
|
|
||||||
let should_remap_filepaths =
|
let should_remap_filepaths =
|
||||||
tcx.sess.should_prefer_remapped(RemapPathScopeComponents::DEBUGINFO);
|
tcx.sess.should_prefer_remapped(RemapPathScopeComponents::DEBUGINFO);
|
||||||
|
|
||||||
@ -93,22 +95,16 @@ pub(crate) fn new(tcx: TyCtxt<'_>, isa: &dyn TargetIsa, cgu_name: &str) -> Self
|
|||||||
.sess
|
.sess
|
||||||
.opts
|
.opts
|
||||||
.working_dir
|
.working_dir
|
||||||
.to_string_lossy(if should_remap_filepaths {
|
.for_scope(tcx.sess, RemapPathScopeComponents::DEBUGINFO)
|
||||||
FileNameDisplayPreference::Remapped
|
.to_string_lossy()
|
||||||
} else {
|
.to_string();
|
||||||
FileNameDisplayPreference::Local
|
|
||||||
})
|
|
||||||
.into_owned();
|
|
||||||
|
|
||||||
let (name, file_info) = match tcx.sess.local_crate_source_file() {
|
let (name, file_info) = match tcx.sess.local_crate_source_file() {
|
||||||
Some(path) => {
|
Some(path) => {
|
||||||
let name = path
|
let name = path
|
||||||
.to_string_lossy(if should_remap_filepaths {
|
.for_scope(tcx.sess, RemapPathScopeComponents::DEBUGINFO)
|
||||||
FileNameDisplayPreference::Remapped
|
.to_string_lossy()
|
||||||
} else {
|
.to_string();
|
||||||
FileNameDisplayPreference::Local
|
|
||||||
})
|
|
||||||
.into_owned();
|
|
||||||
(name, None)
|
(name, None)
|
||||||
}
|
}
|
||||||
None => (tcx.crate_name(LOCAL_CRATE).to_string(), None),
|
None => (tcx.crate_name(LOCAL_CRATE).to_string(), None),
|
||||||
|
Loading…
Reference in New Issue
Block a user