@@ -95,19 +95,33 @@ impl CoverageCounters {
95
95
this
96
96
}
97
97
98
- fn make_counter ( & mut self , site : CounterIncrementSite ) -> BcbCounter {
98
+ /// Shared helper used by [`Self::make_phys_node_counter`] and
99
+ /// [`Self::make_phys_edge_counter`]. Don't call this directly.
100
+ fn make_counter_inner ( & mut self , site : CounterIncrementSite ) -> BcbCounter {
99
101
let id = self . counter_increment_sites . push ( site) ;
100
102
BcbCounter :: Counter { id }
101
103
}
102
104
103
105
/// Creates a new physical counter attached a BCB node.
104
106
/// The node must not already have a counter.
105
107
fn make_phys_node_counter ( & mut self , bcb : BasicCoverageBlock ) -> BcbCounter {
106
- let counter = self . make_counter ( CounterIncrementSite :: Node { bcb } ) ;
108
+ let counter = self . make_counter_inner ( CounterIncrementSite :: Node { bcb } ) ;
107
109
debug ! ( ?bcb, ?counter, "node gets a physical counter" ) ;
108
110
self . set_bcb_counter ( bcb, counter)
109
111
}
110
112
113
+ /// Creates a new physical counter attached to a BCB edge.
114
+ /// The edge must not already have a counter.
115
+ fn make_phys_edge_counter (
116
+ & mut self ,
117
+ from_bcb : BasicCoverageBlock ,
118
+ to_bcb : BasicCoverageBlock ,
119
+ ) -> BcbCounter {
120
+ let counter = self . make_counter_inner ( CounterIncrementSite :: Edge { from_bcb, to_bcb } ) ;
121
+ debug ! ( ?from_bcb, ?to_bcb, ?counter, "edge gets a physical counter" ) ;
122
+ self . set_bcb_edge_counter ( from_bcb, to_bcb, counter)
123
+ }
124
+
111
125
fn make_expression ( & mut self , lhs : BcbCounter , op : Op , rhs : BcbCounter ) -> BcbCounter {
112
126
let new_expr = BcbExpression { lhs, op, rhs } ;
113
127
* self
@@ -417,10 +431,7 @@ impl<'a> MakeBcbCounters<'a> {
417
431
}
418
432
419
433
// Make a new counter to count this edge.
420
- let counter_kind =
421
- self . coverage_counters . make_counter ( CounterIncrementSite :: Edge { from_bcb, to_bcb } ) ;
422
- debug ! ( "Edge {from_bcb:?}->{to_bcb:?} gets a new counter: {counter_kind:?}" ) ;
423
- self . coverage_counters . set_bcb_edge_counter ( from_bcb, to_bcb, counter_kind)
434
+ self . coverage_counters . make_phys_edge_counter ( from_bcb, to_bcb)
424
435
}
425
436
426
437
/// Choose one of the out-edges of `from_bcb` to receive an expression
0 commit comments