File tree 2 files changed +9
-3
lines changed
compiler/rustc_codegen_llvm/src/coverageinfo
2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change 1
1
use rustc_middle:: mir:: coverage:: { CounterId , CovTerm , ExpressionId , SourceRegion } ;
2
2
3
+ use crate :: coverageinfo:: mapgen:: LocalFileId ;
4
+
3
5
/// Must match the layout of `LLVMRustCounterKind`.
4
6
#[ derive( Copy , Clone , Debug ) ]
5
7
#[ repr( C ) ]
@@ -137,7 +139,11 @@ pub(crate) struct CoverageSpan {
137
139
}
138
140
139
141
impl CoverageSpan {
140
- pub ( crate ) fn from_source_region ( file_id : u32 , code_region : & SourceRegion ) -> Self {
142
+ pub ( crate ) fn from_source_region (
143
+ local_file_id : LocalFileId ,
144
+ code_region : & SourceRegion ,
145
+ ) -> Self {
146
+ let file_id = local_file_id. as_u32 ( ) ;
141
147
let & SourceRegion { start_line, start_col, end_line, end_col } = code_region;
142
148
// Internally, LLVM uses the high bit of `end_col` to distinguish between
143
149
// code regions and gap regions, so it can't be used by the column number.
Original file line number Diff line number Diff line change @@ -210,7 +210,7 @@ rustc_index::newtype_index! {
210
210
/// An index into a function's list of global file IDs. That underlying list
211
211
/// of local-to-global mappings will be embedded in the function's record in
212
212
/// the `__llvm_covfun` linker section.
213
- struct LocalFileId { }
213
+ pub ( crate ) struct LocalFileId { }
214
214
}
215
215
216
216
/// Holds a mapping from "local" (per-function) file IDs to "global" (per-CGU)
@@ -280,7 +280,7 @@ fn encode_mappings_for_function(
280
280
// form suitable for FFI.
281
281
for ( mapping_kind, region) in counter_regions {
282
282
debug ! ( "Adding counter {mapping_kind:?} to map for {region:?}" ) ;
283
- let span = ffi:: CoverageSpan :: from_source_region ( local_file_id. as_u32 ( ) , region) ;
283
+ let span = ffi:: CoverageSpan :: from_source_region ( local_file_id, region) ;
284
284
match mapping_kind {
285
285
MappingKind :: Code ( term) => {
286
286
code_regions. push ( ffi:: CodeRegion { span, counter : ffi:: Counter :: from_term ( term) } ) ;
You can’t perform that action at this time.
0 commit comments