Allow using -Z fewer-names=no
to retain value names
Change `-Z fewer-names` into an optional boolean flag and allow using it to either discard value names when true or retain them when false, regardless of other settings.
This commit is contained in:
parent
068320b39e
commit
fafe3cd682
4 changed files with 31 additions and 8 deletions
|
@ -900,7 +900,7 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
|
|||
"emits a future-incompatibility report for lints (RFC 2834)"),
|
||||
emit_stack_sizes: bool = (false, parse_bool, [UNTRACKED],
|
||||
"emit a section containing stack size metadata (default: no)"),
|
||||
fewer_names: bool = (false, parse_bool, [TRACKED],
|
||||
fewer_names: Option<bool> = (None, parse_opt_bool, [TRACKED],
|
||||
"reduce memory use by retaining fewer names within compilation artifacts (LLVM-IR) \
|
||||
(default: no)"),
|
||||
force_overflow_checks: Option<bool> = (None, parse_opt_bool, [TRACKED],
|
||||
|
|
|
@ -734,12 +734,15 @@ impl Session {
|
|||
self.opts.cg.panic.unwrap_or(self.target.panic_strategy)
|
||||
}
|
||||
pub fn fewer_names(&self) -> bool {
|
||||
let more_names = self.opts.output_types.contains_key(&OutputType::LlvmAssembly)
|
||||
|| self.opts.output_types.contains_key(&OutputType::Bitcode)
|
||||
// AddressSanitizer and MemorySanitizer use alloca name when reporting an issue.
|
||||
|| self.opts.debugging_opts.sanitizer.intersects(SanitizerSet::ADDRESS | SanitizerSet::MEMORY);
|
||||
|
||||
self.opts.debugging_opts.fewer_names || !more_names
|
||||
if let Some(fewer_names) = self.opts.debugging_opts.fewer_names {
|
||||
fewer_names
|
||||
} else {
|
||||
let more_names = self.opts.output_types.contains_key(&OutputType::LlvmAssembly)
|
||||
|| self.opts.output_types.contains_key(&OutputType::Bitcode)
|
||||
// AddressSanitizer and MemorySanitizer use alloca name when reporting an issue.
|
||||
|| self.opts.debugging_opts.sanitizer.intersects(SanitizerSet::ADDRESS | SanitizerSet::MEMORY);
|
||||
!more_names
|
||||
}
|
||||
}
|
||||
|
||||
pub fn unstable_options(&self) -> bool {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue