]> git.proxmox.com Git - rustc.git/blob - compiler/rustc_codegen_ssa/src/mir/coverageinfo.rs
New upstream version 1.72.1+dfsg1
[rustc.git] / compiler / rustc_codegen_ssa / src / mir / coverageinfo.rs
1 use crate::traits::*;
2
3 use rustc_middle::mir::Coverage;
4 use rustc_middle::mir::SourceScope;
5
6 use super::FunctionCx;
7
8 impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
9 pub fn codegen_coverage(&self, bx: &mut Bx, coverage: &Coverage, scope: SourceScope) {
10 // Determine the instance that coverage data was originally generated for.
11 let instance = if let Some(inlined) = scope.inlined_instance(&self.mir.source_scopes) {
12 self.monomorphize(inlined)
13 } else {
14 self.instance
15 };
16
17 // Handle the coverage info in a backend-specific way.
18 bx.add_coverage(instance, coverage);
19 }
20 }