coverage: Remove vestigial format_counter
methods
This commit is contained in:
parent
3d66513fe4
commit
bbd347409f
2 changed files with 20 additions and 40 deletions
|
@ -345,10 +345,7 @@ impl<'a> MakeBcbCounters<'a> {
|
||||||
sumup_counter_operand,
|
sumup_counter_operand,
|
||||||
|| None,
|
|| None,
|
||||||
);
|
);
|
||||||
debug!(
|
debug!(" [new intermediate expression: {:?}]", intermediate_expression);
|
||||||
" [new intermediate expression: {}]",
|
|
||||||
self.format_counter(&intermediate_expression)
|
|
||||||
);
|
|
||||||
let intermediate_expression_operand = intermediate_expression.as_operand();
|
let intermediate_expression_operand = intermediate_expression.as_operand();
|
||||||
self.coverage_counters.intermediate_expressions.push(intermediate_expression);
|
self.coverage_counters.intermediate_expressions.push(intermediate_expression);
|
||||||
some_sumup_counter_operand.replace(intermediate_expression_operand);
|
some_sumup_counter_operand.replace(intermediate_expression_operand);
|
||||||
|
@ -372,7 +369,7 @@ impl<'a> MakeBcbCounters<'a> {
|
||||||
sumup_counter_operand,
|
sumup_counter_operand,
|
||||||
|| Some(format!("{expression_branch:?}")),
|
|| Some(format!("{expression_branch:?}")),
|
||||||
);
|
);
|
||||||
debug!("{:?} gets an expression: {}", expression_branch, self.format_counter(&expression));
|
debug!("{:?} gets an expression: {:?}", expression_branch, expression);
|
||||||
let bcb = expression_branch.target_bcb;
|
let bcb = expression_branch.target_bcb;
|
||||||
if expression_branch.is_only_path_to_target() {
|
if expression_branch.is_only_path_to_target() {
|
||||||
self.coverage_counters.set_bcb_counter(bcb, expression)?;
|
self.coverage_counters.set_bcb_counter(bcb, expression)?;
|
||||||
|
@ -394,10 +391,10 @@ impl<'a> MakeBcbCounters<'a> {
|
||||||
// If the BCB already has a counter, return it.
|
// If the BCB already has a counter, return it.
|
||||||
if let Some(counter_kind) = &self.coverage_counters.bcb_counters[bcb] {
|
if let Some(counter_kind) = &self.coverage_counters.bcb_counters[bcb] {
|
||||||
debug!(
|
debug!(
|
||||||
"{}{:?} already has a counter: {}",
|
"{}{:?} already has a counter: {:?}",
|
||||||
NESTED_INDENT.repeat(debug_indent_level),
|
NESTED_INDENT.repeat(debug_indent_level),
|
||||||
bcb,
|
bcb,
|
||||||
self.format_counter(counter_kind),
|
counter_kind,
|
||||||
);
|
);
|
||||||
return Ok(counter_kind.as_operand());
|
return Ok(counter_kind.as_operand());
|
||||||
}
|
}
|
||||||
|
@ -410,19 +407,19 @@ impl<'a> MakeBcbCounters<'a> {
|
||||||
let counter_kind = self.coverage_counters.make_counter(|| Some(format!("{bcb:?}")));
|
let counter_kind = self.coverage_counters.make_counter(|| Some(format!("{bcb:?}")));
|
||||||
if one_path_to_target {
|
if one_path_to_target {
|
||||||
debug!(
|
debug!(
|
||||||
"{}{:?} gets a new counter: {}",
|
"{}{:?} gets a new counter: {:?}",
|
||||||
NESTED_INDENT.repeat(debug_indent_level),
|
NESTED_INDENT.repeat(debug_indent_level),
|
||||||
bcb,
|
bcb,
|
||||||
self.format_counter(&counter_kind),
|
counter_kind,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
debug!(
|
debug!(
|
||||||
"{}{:?} has itself as its own predecessor. It can't be part of its own \
|
"{}{:?} has itself as its own predecessor. It can't be part of its own \
|
||||||
Expression sum, so it will get its own new counter: {}. (Note, the compiled \
|
Expression sum, so it will get its own new counter: {:?}. (Note, the compiled \
|
||||||
code will generate an infinite loop.)",
|
code will generate an infinite loop.)",
|
||||||
NESTED_INDENT.repeat(debug_indent_level),
|
NESTED_INDENT.repeat(debug_indent_level),
|
||||||
bcb,
|
bcb,
|
||||||
self.format_counter(&counter_kind),
|
counter_kind,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return self.coverage_counters.set_bcb_counter(bcb, counter_kind);
|
return self.coverage_counters.set_bcb_counter(bcb, counter_kind);
|
||||||
|
@ -460,9 +457,9 @@ impl<'a> MakeBcbCounters<'a> {
|
||||||
|| None,
|
|| None,
|
||||||
);
|
);
|
||||||
debug!(
|
debug!(
|
||||||
"{}new intermediate expression: {}",
|
"{}new intermediate expression: {:?}",
|
||||||
NESTED_INDENT.repeat(debug_indent_level),
|
NESTED_INDENT.repeat(debug_indent_level),
|
||||||
self.format_counter(&intermediate_expression)
|
intermediate_expression
|
||||||
);
|
);
|
||||||
let intermediate_expression_operand = intermediate_expression.as_operand();
|
let intermediate_expression_operand = intermediate_expression.as_operand();
|
||||||
self.coverage_counters.intermediate_expressions.push(intermediate_expression);
|
self.coverage_counters.intermediate_expressions.push(intermediate_expression);
|
||||||
|
@ -476,10 +473,10 @@ impl<'a> MakeBcbCounters<'a> {
|
||||||
|| Some(format!("{bcb:?}")),
|
|| Some(format!("{bcb:?}")),
|
||||||
);
|
);
|
||||||
debug!(
|
debug!(
|
||||||
"{}{:?} gets a new counter (sum of predecessor counters): {}",
|
"{}{:?} gets a new counter (sum of predecessor counters): {:?}",
|
||||||
NESTED_INDENT.repeat(debug_indent_level),
|
NESTED_INDENT.repeat(debug_indent_level),
|
||||||
bcb,
|
bcb,
|
||||||
self.format_counter(&counter_kind)
|
counter_kind
|
||||||
);
|
);
|
||||||
self.coverage_counters.set_bcb_counter(bcb, counter_kind)
|
self.coverage_counters.set_bcb_counter(bcb, counter_kind)
|
||||||
}
|
}
|
||||||
|
@ -510,11 +507,11 @@ impl<'a> MakeBcbCounters<'a> {
|
||||||
self.coverage_counters.bcb_edge_counters.get(&(from_bcb, to_bcb))
|
self.coverage_counters.bcb_edge_counters.get(&(from_bcb, to_bcb))
|
||||||
{
|
{
|
||||||
debug!(
|
debug!(
|
||||||
"{}Edge {:?}->{:?} already has a counter: {}",
|
"{}Edge {:?}->{:?} already has a counter: {:?}",
|
||||||
NESTED_INDENT.repeat(debug_indent_level),
|
NESTED_INDENT.repeat(debug_indent_level),
|
||||||
from_bcb,
|
from_bcb,
|
||||||
to_bcb,
|
to_bcb,
|
||||||
self.format_counter(counter_kind)
|
counter_kind
|
||||||
);
|
);
|
||||||
return Ok(counter_kind.as_operand());
|
return Ok(counter_kind.as_operand());
|
||||||
}
|
}
|
||||||
|
@ -523,11 +520,11 @@ impl<'a> MakeBcbCounters<'a> {
|
||||||
let counter_kind =
|
let counter_kind =
|
||||||
self.coverage_counters.make_counter(|| Some(format!("{from_bcb:?}->{to_bcb:?}")));
|
self.coverage_counters.make_counter(|| Some(format!("{from_bcb:?}->{to_bcb:?}")));
|
||||||
debug!(
|
debug!(
|
||||||
"{}Edge {:?}->{:?} gets a new counter: {}",
|
"{}Edge {:?}->{:?} gets a new counter: {:?}",
|
||||||
NESTED_INDENT.repeat(debug_indent_level),
|
NESTED_INDENT.repeat(debug_indent_level),
|
||||||
from_bcb,
|
from_bcb,
|
||||||
to_bcb,
|
to_bcb,
|
||||||
self.format_counter(&counter_kind)
|
counter_kind
|
||||||
);
|
);
|
||||||
self.coverage_counters.set_bcb_edge_counter(from_bcb, to_bcb, counter_kind)
|
self.coverage_counters.set_bcb_edge_counter(from_bcb, to_bcb, counter_kind)
|
||||||
}
|
}
|
||||||
|
@ -686,9 +683,4 @@ impl<'a> MakeBcbCounters<'a> {
|
||||||
fn bcb_dominates(&self, dom: BasicCoverageBlock, node: BasicCoverageBlock) -> bool {
|
fn bcb_dominates(&self, dom: BasicCoverageBlock, node: BasicCoverageBlock) -> bool {
|
||||||
self.basic_coverage_blocks.dominates(dom, node)
|
self.basic_coverage_blocks.dominates(dom, node)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
|
||||||
fn format_counter(&self, counter_kind: &BcbCounter) -> String {
|
|
||||||
format!("{counter_kind:?}")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -286,22 +286,15 @@ impl<'a, 'tcx> Instrumentor<'a, 'tcx> {
|
||||||
let new_bb = inject_edge_counter_basic_block(self.mir_body, from_bb, to_bb);
|
let new_bb = inject_edge_counter_basic_block(self.mir_body, from_bb, to_bb);
|
||||||
debug!(
|
debug!(
|
||||||
"Edge {:?} (last {:?}) -> {:?} (leader {:?}) requires a new MIR \
|
"Edge {:?} (last {:?}) -> {:?} (leader {:?}) requires a new MIR \
|
||||||
BasicBlock {:?}, for unclaimed edge counter {}",
|
BasicBlock {:?}, for unclaimed edge counter {:?}",
|
||||||
edge_from_bcb,
|
edge_from_bcb, from_bb, target_bcb, to_bb, new_bb, counter_kind,
|
||||||
from_bb,
|
|
||||||
target_bcb,
|
|
||||||
to_bb,
|
|
||||||
new_bb,
|
|
||||||
self.format_counter(&counter_kind),
|
|
||||||
);
|
);
|
||||||
new_bb
|
new_bb
|
||||||
} else {
|
} else {
|
||||||
let target_bb = self.bcb_last_bb(target_bcb);
|
let target_bb = self.bcb_last_bb(target_bcb);
|
||||||
debug!(
|
debug!(
|
||||||
"{:?} ({:?}) gets a new Coverage statement for unclaimed counter {}",
|
"{:?} ({:?}) gets a new Coverage statement for unclaimed counter {:?}",
|
||||||
target_bcb,
|
target_bcb, target_bb, counter_kind,
|
||||||
target_bb,
|
|
||||||
self.format_counter(&counter_kind),
|
|
||||||
);
|
);
|
||||||
target_bb
|
target_bb
|
||||||
};
|
};
|
||||||
|
@ -336,11 +329,6 @@ impl<'a, 'tcx> Instrumentor<'a, 'tcx> {
|
||||||
&self.basic_coverage_blocks[bcb]
|
&self.basic_coverage_blocks[bcb]
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
|
||||||
fn format_counter(&self, counter_kind: &BcbCounter) -> String {
|
|
||||||
format!("{counter_kind:?}")
|
|
||||||
}
|
|
||||||
|
|
||||||
fn make_mir_coverage_kind(&self, counter_kind: &BcbCounter) -> CoverageKind {
|
fn make_mir_coverage_kind(&self, counter_kind: &BcbCounter) -> CoverageKind {
|
||||||
match *counter_kind {
|
match *counter_kind {
|
||||||
BcbCounter::Counter { id } => {
|
BcbCounter::Counter { id } => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue