@@ -19,7 +19,6 @@ use rustc_target::spec::HasTargetSpec;
19
19
use tracing:: debug;
20
20
21
21
use crate :: common:: CodegenCx ;
22
- use crate :: coverageinfo:: map_data:: FunctionCoverage ;
23
22
use crate :: coverageinfo:: mapgen:: { GlobalFileTable , VirtualFileMapping , span_file_name} ;
24
23
use crate :: coverageinfo:: { ffi, llvm_cov} ;
25
24
use crate :: llvm;
@@ -49,17 +48,17 @@ pub(crate) fn prepare_covfun_record<'tcx>(
49
48
tcx : TyCtxt < ' tcx > ,
50
49
global_file_table : & mut GlobalFileTable ,
51
50
instance : Instance < ' tcx > ,
52
- function_coverage : & FunctionCoverage < ' tcx > ,
51
+ is_used : bool ,
53
52
) -> Option < CovfunRecord < ' tcx > > {
54
53
let fn_cov_info = tcx. instance_mir ( instance. def ) . function_coverage_info . as_deref ( ) ?;
55
54
let ids_info = tcx. coverage_ids_info ( instance. def ) ;
56
55
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) ;
58
57
59
58
let mut covfun = CovfunRecord {
60
59
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,
63
62
virtual_file_mapping : VirtualFileMapping :: default ( ) ,
64
63
expressions,
65
64
regions : ffi:: Regions :: default ( ) ,
0 commit comments