diff options
| author | bors <bors@rust-lang.org> | 2023-08-20 13:37:47 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-08-20 13:37:47 +0000 |
| commit | 0510a1526d4135861226281eed38114ab71a12f0 (patch) | |
| tree | 8e55a53108498cd4e675bbb7eb91c2e6ff5ca21c /compiler/rustc_mir_transform/src/coverage/spans.rs | |
| parent | c0b6ffaaea3ebdf5f7a58fc4cf7ee52c91077fb9 (diff) | |
| parent | 72f4c78dc6d5fc4a09d946f979ccfbf3fa763585 (diff) | |
| download | rust-0510a1526d4135861226281eed38114ab71a12f0.tar.gz rust-0510a1526d4135861226281eed38114ab71a12f0.zip | |
Auto merge of #114791 - Zalathar:bcb-counter, r=cjgillot
coverage: Give the instrumentor its own counter type, separate from MIR Within the MIR representation of coverage data, `CoverageKind` is an important part of `StatementKind::Coverage`, but the `InstrumentCoverage` pass also uses it heavily as an internal data structure. This means that any change to `CoverageKind` also needs to update all of the internal parts of `InstrumentCoverage` that manipulate it directly, making the MIR representation difficult to modify. --- This change fixes that by giving the instrumentor its own `BcbCounter` type for internal use, which is then converted to a `CoverageKind` when injecting coverage information into MIR. The main change is mostly mechanical, because the initial `BcbCounter` is drop-in compatible with `CoverageKind`, minus the unnecessary `CoverageKind::Unreachable` variant. I've then removed the `function_source_hash` field from `BcbCounter::Counter`, as a small example of how the two types can now usefully differ from each other. Every counter in a MIR-level function should have the same source hash, so we can supply the hash during the conversion to `CoverageKind::Counter` instead. --- *Background:* BCB stands for “basic coverage block”, which is a node in the simplified control-flow graph used by coverage instrumentation. The instrumentor pass uses the function's actual MIR control-flow graph to build a simplified BCB graph, then assigns coverage counters and counter expressions to various nodes/edges in that simplified graph, and then finally injects corresponding coverage information into the underlying MIR.
Diffstat (limited to 'compiler/rustc_mir_transform/src/coverage/spans.rs')
0 files changed, 0 insertions, 0 deletions
