1
Fork 0

Make coverage counter IDs count up from 0, not 1

Operand types are now tracked explicitly, so there is no need to reserve ID 0
for the special always-zero counter.

As part of the renumbering, this change fixes an off-by-one error in the way
counters were counted by the `coverageinfo` query. As a result, functions
should now have exactly the number of counters they actually need, instead of
always having an extra counter that is never used.
This commit is contained in:
Zalathar 2023-06-29 12:36:19 +10:00
parent f103db894f
commit 3920e07f0b
12 changed files with 43 additions and 61 deletions

View file

@ -683,7 +683,7 @@ fn test_make_bcb_counters() {
let_bcb!(1);
assert_eq!(
1, // coincidentally, bcb1 has a `Counter` with id = 1
0, // bcb1 has a `Counter` with id = 0
match basic_coverage_blocks[bcb1].counter().expect("should have a counter") {
CoverageKind::Counter { id, .. } => id,
_ => panic!("expected a Counter"),
@ -693,7 +693,7 @@ fn test_make_bcb_counters() {
let_bcb!(2);
assert_eq!(
2, // coincidentally, bcb2 has a `Counter` with id = 2
1, // bcb2 has a `Counter` with id = 1
match basic_coverage_blocks[bcb2].counter().expect("should have a counter") {
CoverageKind::Counter { id, .. } => id,
_ => panic!("expected a Counter"),