Skip to content

Commit d710bee

Browse files
committed
Narrow trait CoverageInfoBuilderMethods down to just one method
This effectively inlines most of `FunctionCx::codegen_coverage` into the LLVM implementation of `CoverageInfoBuilderMethods`.
1 parent ac79ddb commit d710bee

File tree

1 file changed

+2
-27
lines changed

1 file changed

+2
-27
lines changed

src/coverageinfo.rs

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,15 @@
11
use gccjit::RValue;
22
use rustc_codegen_ssa::traits::{CoverageInfoBuilderMethods, CoverageInfoMethods};
33
use rustc_hir::def_id::DefId;
4-
use rustc_middle::mir::coverage::{
5-
CodeRegion,
6-
CounterValueReference,
7-
ExpressionOperandId,
8-
InjectedExpressionId,
9-
Op,
10-
};
4+
use rustc_middle::mir::Coverage;
115
use rustc_middle::ty::Instance;
126

137
use crate::builder::Builder;
148
use crate::context::CodegenCx;
159

1610
impl<'a, 'gcc, 'tcx> CoverageInfoBuilderMethods<'tcx> for Builder<'a, 'gcc, 'tcx> {
17-
fn set_function_source_hash(
18-
&mut self,
19-
_instance: Instance<'tcx>,
20-
_function_source_hash: u64,
21-
) -> bool {
22-
unimplemented!();
23-
}
24-
25-
fn add_coverage_counter(&mut self, _instance: Instance<'tcx>, _id: CounterValueReference, _region: CodeRegion) -> bool {
26-
// TODO(antoyo)
27-
false
28-
}
29-
30-
fn add_coverage_counter_expression(&mut self, _instance: Instance<'tcx>, _id: InjectedExpressionId, _lhs: ExpressionOperandId, _op: Op, _rhs: ExpressionOperandId, _region: Option<CodeRegion>) -> bool {
31-
// TODO(antoyo)
32-
false
33-
}
34-
35-
fn add_coverage_unreachable(&mut self, _instance: Instance<'tcx>, _region: CodeRegion) -> bool {
11+
fn add_coverage(&mut self, _instance: Instance<'tcx>, _coverage: &Coverage) {
3612
// TODO(antoyo)
37-
false
3813
}
3914
}
4015

0 commit comments

Comments
 (0)