Gate binary dependency information behind -Zbinary-dep-depinfo

This commit is contained in:
Mark Rousskov 2019-07-24 11:00:09 -04:00
parent eafb42dc94
commit d749b5e223
3 changed files with 18 additions and 11 deletions

View file

@ -1468,6 +1468,8 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
symbol_mangling_version: SymbolManglingVersion = (SymbolManglingVersion::Legacy,
parse_symbol_mangling_version, [TRACKED],
"which mangling version to use for symbol names"),
binary_dep_depinfo: bool = (false, parse_bool, [TRACKED],
"include artifacts (sysroot, crate dependencies) used during compilation in dep-info"),
}
pub fn default_lib_output() -> CrateType {

View file

@ -545,6 +545,9 @@ impl Session {
pub fn print_llvm_passes(&self) -> bool {
self.opts.debugging_opts.print_llvm_passes
}
pub fn binary_dep_depinfo(&self) -> bool {
self.opts.debugging_opts.binary_dep_depinfo
}
/// Gets the features enabled for the current compilation session.
/// DO NOT USE THIS METHOD if there is a TyCtxt available, as it circumvents

View file

@ -677,17 +677,19 @@ fn write_out_deps(compiler: &Compiler, outputs: &OutputFilenames, out_filenames:
.map(|fmap| escape_dep_filename(&fmap.name))
.collect();
for cnum in compiler.cstore.crates_untracked() {
let metadata = compiler.cstore.crate_data_as_rc_any(cnum);
let metadata = metadata.downcast_ref::<cstore::CrateMetadata>().unwrap();
if let Some((path, _)) = &metadata.source.dylib {
files.push(escape_dep_filename(&FileName::Real(path.clone())));
}
if let Some((path, _)) = &metadata.source.rlib {
files.push(escape_dep_filename(&FileName::Real(path.clone())));
}
if let Some((path, _)) = &metadata.source.rmeta {
files.push(escape_dep_filename(&FileName::Real(path.clone())));
if sess.binary_dep_depinfo() {
for cnum in compiler.cstore.crates_untracked() {
let metadata = compiler.cstore.crate_data_as_rc_any(cnum);
let metadata = metadata.downcast_ref::<cstore::CrateMetadata>().unwrap();
if let Some((path, _)) = &metadata.source.dylib {
files.push(escape_dep_filename(&FileName::Real(path.clone())));
}
if let Some((path, _)) = &metadata.source.rlib {
files.push(escape_dep_filename(&FileName::Real(path.clone())));
}
if let Some((path, _)) = &metadata.source.rmeta {
files.push(escape_dep_filename(&FileName::Real(path.clone())));
}
}
}