|
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;
|
@@ -63,11 +64,9 @@ pub fn finalize(cx: &CodegenCx<'_, '_>) {
|
63 | 64 | let mangled_function_name = tcx.symbol_name(instance).name;
|
64 | 65 | let source_hash = function_coverage.source_hash();
|
65 | 66 | let is_used = function_coverage.is_used();
|
66 |
| - let (expressions, counter_regions) = |
67 |
| - function_coverage.get_expressions_and_counter_regions(); |
68 | 67 |
|
69 | 68 | let coverage_mapping_buffer =
|
70 |
| - encode_mappings_for_function(&mut global_file_table, expressions, counter_regions); |
| 69 | + encode_mappings_for_function(&mut global_file_table, &function_coverage); |
71 | 70 |
|
72 | 71 | if coverage_mapping_buffer.is_empty() {
|
73 | 72 | if function_coverage.is_used() {
|
@@ -153,11 +152,12 @@ impl GlobalFileTable {
|
153 | 152 | /// entry. The payload is returned as a vector of bytes.
|
154 | 153 | ///
|
155 | 154 | /// Newly-encountered filenames will be added to the global file table.
|
156 |
| -fn encode_mappings_for_function<'a>( |
| 155 | +fn encode_mappings_for_function( |
157 | 156 | global_file_table: &mut GlobalFileTable,
|
158 |
| - expressions: Vec<CounterExpression>, |
159 |
| - counter_regions: impl Iterator<Item = (Counter, &'a CodeRegion)>, |
| 157 | + function_coverage: &FunctionCoverage<'_>, |
160 | 158 | ) -> Vec<u8> {
|
| 159 | + let (expressions, counter_regions) = function_coverage.get_expressions_and_counter_regions(); |
| 160 | + |
161 | 161 | let mut counter_regions = counter_regions.collect::<Vec<_>>();
|
162 | 162 | if counter_regions.is_empty() {
|
163 | 163 | return Vec::new();
|
|
0 commit comments