diff options
| author | Zalathar <Zalathar@users.noreply.github.com> | 2023-09-04 12:50:51 +1000 |
|---|---|---|
| committer | Zalathar <Zalathar@users.noreply.github.com> | 2023-10-18 21:24:01 +1100 |
| commit | 8efdd4cca61df9adf7f90c40fcc176a2842a9c28 (patch) | |
| tree | f7b05aed82c9246194d6e25a291b7a8c0bffba32 /compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs | |
| parent | 79f935b96c2447c979124628187125a9e381e9dc (diff) | |
| download | rust-8efdd4cca61df9adf7f90c40fcc176a2842a9c28.tar.gz rust-8efdd4cca61df9adf7f90c40fcc176a2842a9c28.zip | |
coverage: Collect a function's coverage mappings into a single list
This is an intermediate step towards being able to store all of a function's mappings in function coverage info.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs b/compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs index a2bf53e605d..cde12b13307 100644 --- a/compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs +++ b/compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs @@ -61,7 +61,7 @@ pub fn finalize(cx: &CodegenCx<'_, '_>) { let mut function_data = Vec::new(); for (instance, mut function_coverage) in function_coverage_map { debug!("Generate function coverage for {}, {:?}", cx.codegen_unit.name(), instance); - function_coverage.simplify_expressions(); + function_coverage.finalize(); let function_coverage = function_coverage; let mangled_function_name = tcx.symbol_name(instance).name; @@ -169,10 +169,11 @@ fn encode_mappings_for_function( let mut virtual_file_mapping = IndexVec::<u32, u32>::new(); let mut mapping_regions = Vec::with_capacity(counter_regions.len()); - // Sort the list of (counter, region) mapping pairs by region, so that they - // can be grouped by filename. Prepare file IDs for each filename, and - // prepare the mapping data so that we can pass it through FFI to LLVM. - counter_regions.sort_by_key(|(_counter, region)| *region); + // Sort and group the list of (counter, region) mapping pairs by filename. + // (Preserve any further ordering imposed by `FunctionCoverage`.) + // Prepare file IDs for each filename, and prepare the mapping data so that + // we can pass it through FFI to LLVM. + counter_regions.sort_by_key(|(_counter, region)| region.file_name); for counter_regions_for_file in counter_regions.group_by(|(_, a), (_, b)| a.file_name == b.file_name) { |
