1
Fork 0

Move instrument coverage config getters to Options

This commit is contained in:
Dylan MacKenzie 2021-11-29 19:09:01 -08:00
parent 386b1c5f57
commit a0de6346de
2 changed files with 18 additions and 6 deletions

View file

@ -107,6 +107,21 @@ impl Options {
.mir_opt_level
.unwrap_or_else(|| if self.optimize != OptLevel::No { 2 } else { 1 })
}
pub fn instrument_coverage(&self) -> bool {
self.debugging_opts.instrument_coverage.unwrap_or(InstrumentCoverage::Off)
!= InstrumentCoverage::Off
}
pub fn instrument_coverage_except_unused_generics(&self) -> bool {
self.debugging_opts.instrument_coverage.unwrap_or(InstrumentCoverage::Off)
== InstrumentCoverage::ExceptUnusedGenerics
}
pub fn instrument_coverage_except_unused_functions(&self) -> bool {
self.debugging_opts.instrument_coverage.unwrap_or(InstrumentCoverage::Off)
== InstrumentCoverage::ExceptUnusedFunctions
}
}
top_level_options!(

View file

@ -1044,18 +1044,15 @@ impl Session {
}
pub fn instrument_coverage(&self) -> bool {
self.opts.debugging_opts.instrument_coverage.unwrap_or(config::InstrumentCoverage::Off)
!= config::InstrumentCoverage::Off
self.opts.instrument_coverage()
}
pub fn instrument_coverage_except_unused_generics(&self) -> bool {
self.opts.debugging_opts.instrument_coverage.unwrap_or(config::InstrumentCoverage::Off)
== config::InstrumentCoverage::ExceptUnusedGenerics
self.opts.instrument_coverage_except_unused_generics()
}
pub fn instrument_coverage_except_unused_functions(&self) -> bool {
self.opts.debugging_opts.instrument_coverage.unwrap_or(config::InstrumentCoverage::Off)
== config::InstrumentCoverage::ExceptUnusedFunctions
self.opts.instrument_coverage_except_unused_functions()
}
pub fn is_proc_macro_attr(&self, attr: &Attribute) -> bool {