coverage: Update comments/logs that referred to CoverageSpan

The concrete type `CoverageSpan` is no longer used outside of the `spans`
module.

This is a separate patch to avoid noise in the preceding patch that actually
encapsulates coverage spans.
This commit is contained in:
Zalathar 2023-09-17 22:22:21 +10:00
parent e29db47176
commit 1355e1fc74
3 changed files with 20 additions and 20 deletions

View File

@ -91,7 +91,7 @@ pub(super) fn new(basic_coverage_blocks: &CoverageGraph) -> Self {
}
/// Makes [`BcbCounter`] `Counter`s and `Expressions` for the `BasicCoverageBlock`s directly or
/// indirectly associated with `CoverageSpans`, and accumulates additional `Expression`s
/// indirectly associated with coverage spans, and accumulates additional `Expression`s
/// representing intermediate values.
pub fn make_bcb_counters(
&mut self,
@ -206,7 +206,7 @@ pub(super) fn drain_bcb_edge_counters(
}
/// Traverse the `CoverageGraph` and add either a `Counter` or `Expression` to every BCB, to be
/// injected with `CoverageSpan`s. `Expressions` have no runtime overhead, so if a viable expression
/// injected with coverage spans. `Expressions` have no runtime overhead, so if a viable expression
/// (adding or subtracting two other counters or expressions) can compute the same result as an
/// embedded counter, an `Expression` should be used.
struct MakeBcbCounters<'a> {
@ -239,7 +239,7 @@ fn make_bcb_counters(
debug!("make_bcb_counters(): adding a counter or expression to each BasicCoverageBlock");
// Walk the `CoverageGraph`. For each `BasicCoverageBlock` node with an associated
// `CoverageSpan`, add a counter. If the `BasicCoverageBlock` branches, add a counter or
// coverage span, add a counter. If the `BasicCoverageBlock` branches, add a counter or
// expression to each branch `BasicCoverageBlock` (if the branch BCB has only one incoming
// edge) or edge from the branching BCB to the branch BCB (if the branch BCB has multiple
// incoming edges).
@ -251,7 +251,7 @@ fn make_bcb_counters(
let mut traversal = TraverseCoverageGraphWithLoops::new(&self.basic_coverage_blocks);
while let Some(bcb) = traversal.next(self.basic_coverage_blocks) {
if bcb_has_coverage_spans(bcb) {
debug!("{:?} has at least one `CoverageSpan`. Get or make its counter", bcb);
debug!("{:?} has at least one coverage span. Get or make its counter", bcb);
let branching_counter_operand = self.get_or_make_counter_operand(bcb)?;
if self.bcb_needs_branch_counters(bcb) {
@ -259,7 +259,7 @@ fn make_bcb_counters(
}
} else {
debug!(
"{:?} does not have any `CoverageSpan`s. A counter will only be added if \
"{:?} does not have any coverage spans. A counter will only be added if \
and when a covered BCB has an expression dependency.",
bcb,
);

View File

@ -288,9 +288,9 @@ pub(super) struct BasicCoverageBlock {
/// not relevant to coverage analysis. `FalseUnwind`, for example, can be treated the same as
/// a `Goto`, and merged with its successor into the same BCB.
///
/// Each BCB with at least one computed `CoverageSpan` will have no more than one `Counter`.
/// Each BCB with at least one computed coverage span will have no more than one `Counter`.
/// In some cases, a BCB's execution count can be computed by `Expression`. Additional
/// disjoint `CoverageSpan`s in a BCB can also be counted by `Expression` (by adding `ZERO`
/// disjoint coverage spans in a BCB can also be counted by `Expression` (by adding `ZERO`
/// to the BCB's primary counter or expression).
///
/// The BCB CFG is critical to simplifying the coverage analysis by ensuring graph path-based

View File

@ -154,7 +154,7 @@ fn inject_counters(&'a mut self) {
let body_span = self.body_span;
////////////////////////////////////////////////////
// Compute `CoverageSpan`s from the `CoverageGraph`.
// Compute coverage spans from the `CoverageGraph`.
let coverage_spans = CoverageSpans::generate_coverage_spans(
&self.mir_body,
fn_sig_span,
@ -164,9 +164,9 @@ fn inject_counters(&'a mut self) {
////////////////////////////////////////////////////
// Create an optimized mix of `Counter`s and `Expression`s for the `CoverageGraph`. Ensure
// every `CoverageSpan` has a `Counter` or `Expression` assigned to its `BasicCoverageBlock`
// every coverage span has a `Counter` or `Expression` assigned to its `BasicCoverageBlock`
// and all `Expression` dependencies (operands) are also generated, for any other
// `BasicCoverageBlock`s not already associated with a `CoverageSpan`.
// `BasicCoverageBlock`s not already associated with a coverage span.
//
// Intermediate expressions (used to compute other `Expression` values), which have no
// direct association with any `BasicCoverageBlock`, are accumulated inside `coverage_counters`.
@ -177,20 +177,20 @@ fn inject_counters(&'a mut self) {
if let Ok(()) = result {
////////////////////////////////////////////////////
// Remove the counter or edge counter from of each `CoverageSpan`s associated
// Remove the counter or edge counter from of each coverage cpan's associated
// `BasicCoverageBlock`, and inject a `Coverage` statement into the MIR.
//
// `Coverage` statements injected from `CoverageSpan`s will include the code regions
// `Coverage` statements injected from coverage spans will include the code regions
// (source code start and end positions) to be counted by the associated counter.
//
// These `CoverageSpan`-associated counters are removed from their associated
// These coverage-span-associated counters are removed from their associated
// `BasicCoverageBlock`s so that the only remaining counters in the `CoverageGraph`
// are indirect counters (to be injected next, without associated code regions).
self.inject_coverage_span_counters(&coverage_spans);
////////////////////////////////////////////////////
// For any remaining `BasicCoverageBlock` counters (that were not associated with
// any `CoverageSpan`), inject `Coverage` statements (_without_ code region `Span`s)
// any coverage span), inject `Coverage` statements (_without_ code region spans)
// to ensure `BasicCoverageBlock` counters that other `Expression`s may depend on
// are in fact counted, even though they don't directly contribute to counting
// their own independent code region's coverage.
@ -215,9 +215,9 @@ fn inject_counters(&'a mut self) {
}
}
/// Inject a counter for each `CoverageSpan`. There can be multiple `CoverageSpan`s for a given
/// BCB, but only one actual counter needs to be incremented per BCB. `bb_counters` maps each
/// `bcb` to its `Counter`, when injected. Subsequent `CoverageSpan`s for a BCB that already has
/// Inject a counter for each coverage span. There can be multiple coverage spans for a given
/// BCB, but only one actual counter needs to be incremented per BCB. `bcb_counters` maps each
/// `bcb` to its `Counter`, when injected. Subsequent coverage spans for a BCB that already has
/// a `Counter` will inject an `Expression` instead, and compute its value by adding `ZERO` to
/// the BCB `Counter` value.
fn inject_coverage_span_counters(&mut self, coverage_spans: &CoverageSpans) {
@ -248,12 +248,12 @@ fn inject_coverage_span_counters(&mut self, coverage_spans: &CoverageSpans) {
}
}
/// `inject_coverage_span_counters()` looped through the `CoverageSpan`s and injected the
/// counter from the `CoverageSpan`s `BasicCoverageBlock`, removing it from the BCB in the
/// `inject_coverage_span_counters()` looped through the coverage spans and injected the
/// counter from the coverage span's `BasicCoverageBlock`, removing it from the BCB in the
/// process (via `take_counter()`).
///
/// Any other counter associated with a `BasicCoverageBlock`, or its incoming edge, but not
/// associated with a `CoverageSpan`, should only exist if the counter is an `Expression`
/// associated with a coverage span, should only exist if the counter is an `Expression`
/// dependency (one of the expression operands). Collect them, and inject the additional
/// counters into the MIR, without a reportable coverage span.
fn inject_indirect_counters(&mut self) {