mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-18 03:25:55 +00:00
b5ee20f714
These headers and flags were historically needed, but are now unnecessary due to various changes in how coverage information is stored in MIR.
29 lines
822 B
Rust
29 lines
822 B
Rust
// Test that `-C instrument-coverage` injects Coverage statements.
|
|
// The Coverage::CounterIncrement statements are later converted into LLVM
|
|
// instrprof.increment intrinsics, during codegen.
|
|
|
|
//@ unit-test: InstrumentCoverage
|
|
//@ compile-flags: -Cinstrument-coverage -Zno-profiler-runtime
|
|
|
|
// EMIT_MIR instrument_coverage.main.InstrumentCoverage.diff
|
|
// EMIT_MIR instrument_coverage.bar.InstrumentCoverage.diff
|
|
fn main() {
|
|
loop {
|
|
if bar() {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
#[inline(never)]
|
|
fn bar() -> bool {
|
|
true
|
|
}
|
|
|
|
// CHECK: coverage ExpressionId({{[0-9]+}}) =>
|
|
// CHECK-DAG: coverage Code(Counter({{[0-9]+}})) =>
|
|
// CHECK-DAG: coverage Code(Expression({{[0-9]+}})) =>
|
|
// CHECK: bb0:
|
|
// CHECK-DAG: Coverage::ExpressionUsed({{[0-9]+}})
|
|
// CHECK-DAG: Coverage::CounterIncrement({{[0-9]+}})
|