diff options
| author | Zalathar <Zalathar@users.noreply.github.com> | 2023-10-03 21:40:50 +1100 |
|---|---|---|
| committer | Zalathar <Zalathar@users.noreply.github.com> | 2023-10-22 20:37:37 +1100 |
| commit | e985ae5a459e7bc4ac68a926f2560621aea30a6c (patch) | |
| tree | b01c1b54e3131dedab1e5c9ac8f033cad5a35ac3 /compiler/rustc_codegen_llvm/src/coverageinfo/map_data.rs | |
| parent | 86b55cccffa6f8c49747335a43abb04376d1e06f (diff) | |
| download | rust-e985ae5a459e7bc4ac68a926f2560621aea30a6c.tar.gz rust-e985ae5a459e7bc4ac68a926f2560621aea30a6c.zip | |
coverage: Build the global file table ahead of time
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/coverageinfo/map_data.rs')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/coverageinfo/map_data.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/compiler/rustc_codegen_llvm/src/coverageinfo/map_data.rs b/compiler/rustc_codegen_llvm/src/coverageinfo/map_data.rs index 2914f310f03..93a8a4b1d5e 100644 --- a/compiler/rustc_codegen_llvm/src/coverageinfo/map_data.rs +++ b/compiler/rustc_codegen_llvm/src/coverageinfo/map_data.rs @@ -7,6 +7,7 @@ use rustc_middle::mir::coverage::{ CodeRegion, CounterId, CovTerm, Expression, ExpressionId, FunctionCoverageInfo, Mapping, Op, }; use rustc_middle::ty::Instance; +use rustc_span::Symbol; /// Holds all of the coverage mapping data associated with a function instance, /// collected during traversal of `Coverage` statements in the function's MIR. @@ -189,6 +190,11 @@ impl<'tcx> FunctionCoverage<'tcx> { if self.is_used { self.function_coverage_info.function_source_hash } else { 0 } } + /// Returns an iterator over all filenames used by this function's mappings. + pub(crate) fn all_file_names(&self) -> impl Iterator<Item = Symbol> + Captures<'_> { + self.function_coverage_info.mappings.iter().map(|mapping| mapping.code_region.file_name) + } + /// Convert this function's coverage expression data into a form that can be /// passed through FFI to LLVM. pub(crate) fn counter_expressions( |
