Skip to content

Commit

Permalink
Move instrument coverage config getters to Options
Browse files Browse the repository at this point in the history
  • Loading branch information
ecstatic-morse committed Dec 3, 2021
1 parent 386b1c5 commit a0de634
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
15 changes: 15 additions & 0 deletions compiler/rustc_session/src/options.rs
Expand Up @@ -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!(
Expand Down
9 changes: 3 additions & 6 deletions compiler/rustc_session/src/session.rs
Expand Up @@ -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 {
Expand Down

0 comments on commit a0de634

Please sign in to comment.