diff options
| author | Zalathar <Zalathar@users.noreply.github.com> | 2024-11-24 18:50:08 +1100 |
|---|---|---|
| committer | Zalathar <Zalathar@users.noreply.github.com> | 2024-11-24 23:46:39 +1100 |
| commit | b9fb1a69d2fe1c146cbdf181cf9e0eaf15935799 (patch) | |
| tree | f7201981d931b6a5e099bc29ea45cc1c3b0c5de8 /compiler/rustc_codegen_llvm/src/coverageinfo/map_data.rs | |
| parent | 87fe7def1284e1c25dc358c693a9add93db5a953 (diff) | |
| download | rust-b9fb1a69d2fe1c146cbdf181cf9e0eaf15935799.tar.gz rust-b9fb1a69d2fe1c146cbdf181cf9e0eaf15935799.zip | |
coverage: Store coverage source regions as `Span` until codegen
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/coverageinfo/map_data.rs')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/coverageinfo/map_data.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/compiler/rustc_codegen_llvm/src/coverageinfo/map_data.rs b/compiler/rustc_codegen_llvm/src/coverageinfo/map_data.rs index e3c0df27883..95746b88ced 100644 --- a/compiler/rustc_codegen_llvm/src/coverageinfo/map_data.rs +++ b/compiler/rustc_codegen_llvm/src/coverageinfo/map_data.rs @@ -3,9 +3,9 @@ use rustc_data_structures::fx::FxIndexSet; use rustc_index::bit_set::BitSet; use rustc_middle::mir::coverage::{ CounterId, CovTerm, Expression, ExpressionId, FunctionCoverageInfo, Mapping, MappingKind, Op, - SourceRegion, }; use rustc_middle::ty::Instance; +use rustc_span::Span; use tracing::{debug, instrument}; use crate::coverageinfo::ffi::{Counter, CounterExpression, ExprKind}; @@ -220,16 +220,16 @@ impl<'tcx> FunctionCoverage<'tcx> { }) } - /// Converts this function's coverage mappings into an intermediate form - /// that will be used by `mapgen` when preparing for FFI. - pub(crate) fn counter_regions( + /// Yields all this function's coverage mappings, after simplifying away + /// unused counters and counter expressions. + pub(crate) fn mapping_spans( &self, - ) -> impl Iterator<Item = (MappingKind, &SourceRegion)> + ExactSizeIterator { + ) -> impl Iterator<Item = (MappingKind, Span)> + ExactSizeIterator + Captures<'_> { self.function_coverage_info.mappings.iter().map(move |mapping| { - let Mapping { kind, source_region } = mapping; + let &Mapping { ref kind, span } = mapping; let kind = kind.map_terms(|term| if self.is_zero_term(term) { CovTerm::Zero } else { term }); - (kind, source_region) + (kind, span) }) } |
