diff options
| author | Zalathar <Zalathar@users.noreply.github.com> | 2023-11-23 11:50:39 +1100 |
|---|---|---|
| committer | Zalathar <Zalathar@users.noreply.github.com> | 2023-12-08 22:40:49 +1100 |
| commit | 44b47aa976d6a6bdd7eb1f99a8ee5270afbe993e (patch) | |
| tree | c225d40ad992eeb9162d716f9f586efbd1c4d972 /compiler/rustc_codegen_llvm/src/coverageinfo | |
| parent | d2d742c4ccc8c18fe13bfc42b3a7b9b66486b294 (diff) | |
| download | rust-44b47aa976d6a6bdd7eb1f99a8ee5270afbe993e.tar.gz rust-44b47aa976d6a6bdd7eb1f99a8ee5270afbe993e.zip | |
coverage: Add `CoverageKind::SpanMarker` for including extra spans in MIR
There are cases where coverage instrumentation wants to show a span for some syntax element, but there is no MIR node that naturally carries that span, so the instrumentor can't see it. MIR building can now use this new kind of coverage statement to deliberately include those spans in MIR, attached to a dummy statement that has no other effect.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/coverageinfo')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/coverageinfo/mod.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/compiler/rustc_codegen_llvm/src/coverageinfo/mod.rs b/compiler/rustc_codegen_llvm/src/coverageinfo/mod.rs index 7d69756181a..8386f067baf 100644 --- a/compiler/rustc_codegen_llvm/src/coverageinfo/mod.rs +++ b/compiler/rustc_codegen_llvm/src/coverageinfo/mod.rs @@ -100,6 +100,9 @@ impl<'tcx> CoverageInfoBuilderMethods<'tcx> for Builder<'_, '_, 'tcx> { let Coverage { kind } = coverage; match *kind { + // Span markers are only meaningful during MIR instrumentation, + // and have no effect during codegen. + CoverageKind::SpanMarker => {} CoverageKind::CounterIncrement { id } => { func_coverage.mark_counter_id_seen(id); // We need to explicitly drop the `RefMut` before calling into `instrprof_increment`, |
