|
1 | 1 | use crate::common::CodegenCx; |
2 | 2 | use crate::coverageinfo; |
3 | | -use crate::coverageinfo::ffi::{Counter, CounterExpression, CounterMappingRegion}; |
| 3 | +use crate::coverageinfo::ffi::CounterMappingRegion; |
| 4 | +use crate::coverageinfo::map_data::FunctionCoverage; |
4 | 5 | use crate::llvm; |
5 | 6 |
|
6 | 7 | use rustc_codegen_ssa::traits::ConstMethods; |
@@ -65,11 +66,9 @@ pub fn finalize(cx: &CodegenCx<'_, '_>) { |
65 | 66 | let mangled_function_name = tcx.symbol_name(instance).name; |
66 | 67 | let source_hash = function_coverage.source_hash(); |
67 | 68 | let is_used = function_coverage.is_used(); |
68 | | - let (expressions, counter_regions) = |
69 | | - function_coverage.get_expressions_and_counter_regions(); |
70 | 69 |
|
71 | 70 | let coverage_mapping_buffer = |
72 | | - encode_mappings_for_function(&mut global_file_table, expressions, counter_regions); |
| 71 | + encode_mappings_for_function(&mut global_file_table, &function_coverage); |
73 | 72 |
|
74 | 73 | if coverage_mapping_buffer.is_empty() { |
75 | 74 | if function_coverage.is_used() { |
@@ -155,11 +154,12 @@ impl GlobalFileTable { |
155 | 154 | /// entry as a `Vec<u8>`. |
156 | 155 | /// |
157 | 156 | /// Newly-encountered filenames will be added to the global file table. |
158 | | -fn encode_mappings_for_function<'a>( |
| 157 | +fn encode_mappings_for_function( |
159 | 158 | global_file_table: &mut GlobalFileTable, |
160 | | - expressions: Vec<CounterExpression>, |
161 | | - counter_regions: impl Iterator<Item = (Counter, &'a CodeRegion)>, |
| 159 | + function_coverage: &FunctionCoverage<'_>, |
162 | 160 | ) -> Vec<u8> { |
| 161 | + let (expressions, counter_regions) = function_coverage.get_expressions_and_counter_regions(); |
| 162 | + |
163 | 163 | let mut counter_regions = counter_regions.collect::<Vec<_>>(); |
164 | 164 | if counter_regions.is_empty() { |
165 | 165 | return Vec::new(); |
|
0 commit comments