@@ -19,7 +19,6 @@ use rustc_target::spec::HasTargetSpec;
1919use tracing:: debug;
2020
2121use crate :: common:: CodegenCx ;
22- use crate :: coverageinfo:: map_data:: FunctionCoverage ;
2322use crate :: coverageinfo:: mapgen:: { GlobalFileTable , VirtualFileMapping , span_file_name} ;
2423use crate :: coverageinfo:: { ffi, llvm_cov} ;
2524use crate :: llvm;
@@ -49,17 +48,17 @@ pub(crate) fn prepare_covfun_record<'tcx>(
4948 tcx : TyCtxt < ' tcx > ,
5049 global_file_table : & mut GlobalFileTable ,
5150 instance : Instance < ' tcx > ,
52- function_coverage : & FunctionCoverage < ' tcx > ,
51+ is_used : bool ,
5352) -> Option < CovfunRecord < ' tcx > > {
5453 let fn_cov_info = tcx. instance_mir ( instance. def ) . function_coverage_info . as_deref ( ) ?;
5554 let ids_info = tcx. coverage_ids_info ( instance. def ) ;
5655
57- let expressions = prepare_expressions ( fn_cov_info, ids_info, function_coverage . is_used ( ) ) ;
56+ let expressions = prepare_expressions ( fn_cov_info, ids_info, is_used) ;
5857
5958 let mut covfun = CovfunRecord {
6059 mangled_function_name : tcx. symbol_name ( instance) . name ,
61- source_hash : function_coverage . source_hash ( ) ,
62- is_used : function_coverage . is_used ( ) ,
60+ source_hash : if is_used { fn_cov_info . function_source_hash } else { 0 } ,
61+ is_used,
6362 virtual_file_mapping : VirtualFileMapping :: default ( ) ,
6463 expressions,
6564 regions : ffi:: Regions :: default ( ) ,
0 commit comments