1
- use rustc_middle:: mir:: coverage:: { CounterId , CovTerm , ExpressionId , SourceRegion } ;
2
-
3
- use crate :: coverageinfo:: mapgen:: LocalFileId ;
1
+ use rustc_middle:: mir:: coverage:: { CounterId , CovTerm , ExpressionId } ;
4
2
5
3
/// Must match the layout of `LLVMRustCounterKind`.
6
4
#[ derive( Copy , Clone , Debug ) ]
@@ -126,30 +124,16 @@ pub(crate) struct CoverageSpan {
126
124
/// Local index into the function's local-to-global file ID table.
127
125
/// The value at that index is itself an index into the coverage filename
128
126
/// table in the CGU's `__llvm_covmap` section.
129
- file_id : u32 ,
127
+ pub ( crate ) file_id : u32 ,
130
128
131
129
/// 1-based starting line of the source code span.
132
- start_line : u32 ,
130
+ pub ( crate ) start_line : u32 ,
133
131
/// 1-based starting column of the source code span.
134
- start_col : u32 ,
132
+ pub ( crate ) start_col : u32 ,
135
133
/// 1-based ending line of the source code span.
136
- end_line : u32 ,
134
+ pub ( crate ) end_line : u32 ,
137
135
/// 1-based ending column of the source code span. High bit must be unset.
138
- end_col : u32 ,
139
- }
140
-
141
- impl CoverageSpan {
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 ( ) ;
147
- let & SourceRegion { start_line, start_col, end_line, end_col } = code_region;
148
- // Internally, LLVM uses the high bit of `end_col` to distinguish between
149
- // code regions and gap regions, so it can't be used by the column number.
150
- assert ! ( end_col & ( 1u32 << 31 ) == 0 , "high bit of `end_col` must be unset: {end_col:#X}" ) ;
151
- Self { file_id, start_line, start_col, end_line, end_col }
152
- }
136
+ pub ( crate ) end_col : u32 ,
153
137
}
154
138
155
139
/// Holds tables of the various region types in one struct.
@@ -184,15 +168,15 @@ impl Regions {
184
168
#[ derive( Clone , Debug ) ]
185
169
#[ repr( C ) ]
186
170
pub ( crate ) struct CodeRegion {
187
- pub ( crate ) span : CoverageSpan ,
171
+ pub ( crate ) cov_span : CoverageSpan ,
188
172
pub ( crate ) counter : Counter ,
189
173
}
190
174
191
175
/// Must match the layout of `LLVMRustCoverageBranchRegion`.
192
176
#[ derive( Clone , Debug ) ]
193
177
#[ repr( C ) ]
194
178
pub ( crate ) struct BranchRegion {
195
- pub ( crate ) span : CoverageSpan ,
179
+ pub ( crate ) cov_span : CoverageSpan ,
196
180
pub ( crate ) true_counter : Counter ,
197
181
pub ( crate ) false_counter : Counter ,
198
182
}
@@ -201,7 +185,7 @@ pub(crate) struct BranchRegion {
201
185
#[ derive( Clone , Debug ) ]
202
186
#[ repr( C ) ]
203
187
pub ( crate ) struct MCDCBranchRegion {
204
- pub ( crate ) span : CoverageSpan ,
188
+ pub ( crate ) cov_span : CoverageSpan ,
205
189
pub ( crate ) true_counter : Counter ,
206
190
pub ( crate ) false_counter : Counter ,
207
191
pub ( crate ) mcdc_branch_params : mcdc:: BranchParameters ,
@@ -211,6 +195,6 @@ pub(crate) struct MCDCBranchRegion {
211
195
#[ derive( Clone , Debug ) ]
212
196
#[ repr( C ) ]
213
197
pub ( crate ) struct MCDCDecisionRegion {
214
- pub ( crate ) span : CoverageSpan ,
198
+ pub ( crate ) cov_span : CoverageSpan ,
215
199
pub ( crate ) mcdc_decision_params : mcdc:: DecisionParameters ,
216
200
}
0 commit comments