1
Fork 0

coverage: Flatten BcbMappingKind into mappings::CodeMapping

Now that branch and MC/DC mappings have been split out into separate types and
vectors, this enum is no longer needed, since it only represents ordinary
"code" regions.

(We can revisit this decision if we ever add support for other region kinds,
such as skipped regions or expansion regions. But at that point, we might just
add new structs/vectors for those kinds as well.)
This commit is contained in:
Zalathar 2024-05-02 14:18:22 +10:00
parent cf2d741d40
commit 76d8d01604
3 changed files with 20 additions and 32 deletions

View file

@ -9,7 +9,7 @@ mod tests;
use self::counters::{CounterIncrementSite, CoverageCounters};
use self::graph::{BasicCoverageBlock, CoverageGraph};
use self::mappings::{BcbBranchPair, BcbMapping, BcbMappingKind, CoverageSpans};
use self::mappings::{BcbBranchPair, CoverageSpans};
use crate::MirPass;
@ -150,12 +150,10 @@ fn create_mappings<'tcx>(
let mut mappings = Vec::new();
mappings.extend(coverage_spans.mappings.iter().filter_map(
|&BcbMapping { kind: bcb_mapping_kind, span }| {
let kind = match bcb_mapping_kind {
BcbMappingKind::Code(bcb) => MappingKind::Code(term_for_bcb(bcb)),
};
mappings.extend(coverage_spans.code_mappings.iter().filter_map(
|&mappings::CodeMapping { span, bcb }| {
let code_region = region_for_span(span)?;
let kind = MappingKind::Code(term_for_bcb(bcb));
Some(Mapping { kind, code_region })
},
));