2020-08-15 11:42:13 +00:00
|
|
|
use crate::traits::*;
|
|
|
|
|
2024-03-23 08:13:52 +00:00
|
|
|
use rustc_middle::mir::coverage::CoverageKind;
|
2021-03-13 00:00:00 +00:00
|
|
|
use rustc_middle::mir::SourceScope;
|
2020-08-15 11:42:13 +00:00
|
|
|
|
|
|
|
use super::FunctionCx;
|
|
|
|
|
|
|
|
impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
2024-03-23 08:13:52 +00:00
|
|
|
pub fn codegen_coverage(&self, bx: &mut Bx, kind: &CoverageKind, scope: SourceScope) {
|
2021-03-13 00:00:00 +00:00
|
|
|
// Determine the instance that coverage data was originally generated for.
|
2022-07-03 00:00:00 +00:00
|
|
|
let instance = if let Some(inlined) = scope.inlined_instance(&self.mir.source_scopes) {
|
|
|
|
self.monomorphize(inlined)
|
2021-03-13 00:00:00 +00:00
|
|
|
} else {
|
|
|
|
self.instance
|
|
|
|
};
|
|
|
|
|
2023-07-05 07:39:40 +00:00
|
|
|
// Handle the coverage info in a backend-specific way.
|
2024-03-23 08:13:52 +00:00
|
|
|
bx.add_coverage(instance, kind);
|
2020-08-15 11:42:13 +00:00
|
|
|
}
|
|
|
|
}
|