Commit Graph

31 Commits

Author SHA1 Message Date
Zalathar ecce90b3ef coverage: Remove intermediate data structures from mapping creation 2025-08-14 21:35:23 +10:00
Zalathar 7671b5af71 coverage: Extract HIR-related helper code out of the main module 2025-08-08 20:04:13 +10:00
Zalathar 81ed042c8c coverage: Remove all unstable support for MC/DC instrumentation 2025-08-06 22:38:52 +10:00
Zalathar fb39d3ed88 coverage: Push async special case down into extract_refined_covspans 2025-08-04 13:48:41 +10:00
Zalathar 51e62a09a3 coverage: Remove -Zcoverage-options=no-mir-spans
This flag turned out to be less useful than anticipated, and interferes with
work towards expansion support.
2025-08-04 13:48:40 +10:00
Zalathar 4d5a1acebf coverage: Only merge adjacent coverage spans
This also removes some manipulation of the function signature span that only
made sense in the context of merging non-adjacent spans.
2025-05-06 20:42:25 +10:00
Zalathar 26cea8a286 coverage: Don't split bang-macro spans, just truncate them 2025-04-01 13:13:21 +11:00
Zalathar 20d051ec87 coverage: Defer part of counter-creation until codegen 2025-02-06 21:44:31 +11:00
Rémy Rakic a13354bea0 rename BitSet to DenseBitSet
This should make it clearer that this bitset is dense, with the
advantages and disadvantages that it entails.
2025-01-11 11:34:01 +00:00
Matthias Krüger 1c619373f9 remove more redundant into() conversions 2025-01-10 07:08:28 +01:00
Zalathar 544809e48a coverage: Rename basic_coverage_blocks to just graph
During coverage instrumentation, this variable always holds the coverage graph,
which is a simplified view of the MIR control-flow graph. The new name is
clearer in context, and also shorter.
2024-12-20 17:48:59 +11:00
Matthias Krüger dab76eccdf fix a couple clippy:complexitys
double_parens
 filter_map_identity
 needless_question_mark
 redundant_guards
2024-10-23 22:15:59 +02:00
zhuyunxing acd64fa0d9 coverage. Warn about too many test vectors 2024-10-08 11:15:26 +08:00
zhuyunxing 6e3e19f714 coverage. Adapt to mcdc mapping formats introduced by llvm 19 2024-10-08 11:15:24 +08:00
Michael Goulet c682aa162b Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
Zalathar d4f1f92426 coverage: Restrict ExpressionUsed simplification to Code mappings
In the future, branch and MC/DC mappings might have expressions that don't
correspond to any single point in the control-flow graph. That makes it
trickier to keep track of which expressions should expect an `ExpressionUsed`
node.

We therefore sidestep that complexity by only performing `ExpressionUsed`
simplification for expressions associated directly with ordinary `Code`
mappings.
2024-07-15 20:54:28 +10:00
Zalathar 741ed01646 coverage: Store a copy of num_bcbs in ExtractedMappings
This makes it possible to allocate per-BCB data structures without needing
access to the whole graph.
2024-07-15 20:37:14 +10:00
Zalathar f095de4bf1 coverage: Rename mir::coverage::BranchInfo to CoverageInfoHi
This opens the door to collecting and storing coverage information that is
unrelated to branch coverage or MC/DC.
2024-07-05 13:53:05 +10:00
Zalathar 6c33149055 coverage: Avoid getting extra unexpansion info when we don't need it
These particular callers don't actually use the returned macro information, so
they can use a simpler span-unexpansion function that doesn't return it.
2024-06-30 19:05:14 +10:00
Zalathar 617de8cfb5 coverage: Move span unexpansion into its own submodule 2024-06-30 17:44:19 +10:00
Zalathar abc2c702af coverage: Add debugging flag -Zcoverage-options=no-mir-spans
When set, this flag skips the code that normally extracts coverage spans from
MIR statements and terminators. That sometimes makes it easier to debug branch
coverage and MC/DC coverage, because the coverage output is less noisy.

For internal debugging only. If other code changes would make it hard to keep
supporting this flag, remove it.
2024-06-17 21:16:15 +10:00
Zalathar c671eaaaff coverage: Rename MC/DC conditions_num to num_conditions
This value represents a quantity of conditions, not an ID, so the new spelling
is more appropriate.
2024-05-30 13:16:07 +10:00
Zalathar 56c6288c6f coverage: Rename CoverageSpans to ExtractedMappings 2024-05-06 12:13:30 +10:00
Zalathar 83852d9bf3 coverage: Don't recompute the number of test vector bitmap bytes
The code in `extract_mcdc_mappings` that allocates these bytes already knows
how many are needed in total, so there's no need to immediately recompute that
value in the calling function.
2024-05-06 12:13:30 +10:00
Zalathar 496ae1ee1c coverage: Make the special case for async functions exit early 2024-05-06 12:13:30 +10:00
Zalathar 1a26404f10 coverage: Separately compute the set of BCBs with counter mappings 2024-05-06 12:13:30 +10:00
Zalathar 6968123c3f coverage: Rename BcbBranchPair to mappings::BranchPair
This makes it consistent with the other mapping structs introduced by this PR.
2024-05-04 11:26:05 +10:00
Zalathar 76d8d01604 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.)
2024-05-04 11:26:05 +10:00
Zalathar 23b6508181 coverage: Split out MC/DC branches from BcbMappingKind 2024-05-04 11:26:05 +10:00
Zalathar af33fc85de coverage: Split out MC/DC decisions from BcbMappingKind 2024-05-04 11:26:02 +10:00
Zalathar ba87e5bb3e coverage: Split off mappings.rs from spans.rs and from_mir.rs 2024-04-30 13:17:21 +10:00