@@ -145,16 +145,17 @@ fn create_mappings<'tcx>(
145145 |BcbMapping { kind : bcb_mapping_kind, span } | {
146146 let kind = match * bcb_mapping_kind {
147147 BcbMappingKind :: Code ( bcb) => MappingKind :: Code ( term_for_bcb ( bcb) ) ,
148- BcbMappingKind :: MCDCBranch { true_bcb , false_bcb , condition_info : None } => {
149- MappingKind :: Branch {
150- true_term : term_for_bcb ( true_bcb ) ,
151- false_term : term_for_bcb ( false_bcb ) ,
152- }
153- }
148+ BcbMappingKind :: MCDCBranch {
149+ true_bcb , false_bcb , condition_info : None , ..
150+ } => MappingKind :: Branch {
151+ true_term : term_for_bcb ( true_bcb ) ,
152+ false_term : term_for_bcb ( false_bcb ) ,
153+ } ,
154154 BcbMappingKind :: MCDCBranch {
155155 true_bcb,
156156 false_bcb,
157157 condition_info : Some ( mcdc_params) ,
158+ ..
158159 } => MappingKind :: MCDCBranch {
159160 true_term : term_for_bcb ( true_bcb) ,
160161 false_term : term_for_bcb ( false_bcb) ,
@@ -246,38 +247,42 @@ fn inject_mcdc_statements<'tcx>(
246247 }
247248
248249 // Inject test vector update first because `inject_statement` always insert new statement at head.
249- for ( end_bcbs, bitmap_idx) in
250+ for ( end_bcbs, bitmap_idx, decision_depth ) in
250251 coverage_spans. mappings . iter ( ) . filter_map ( |mapping| match & mapping. kind {
251- BcbMappingKind :: MCDCDecision { end_bcbs, bitmap_idx, .. } => {
252- Some ( ( end_bcbs, * bitmap_idx) )
252+ BcbMappingKind :: MCDCDecision { end_bcbs, bitmap_idx, decision_depth , .. } => {
253+ Some ( ( end_bcbs, * bitmap_idx, * decision_depth ) )
253254 }
254255 _ => None ,
255256 } )
256257 {
257258 for end in end_bcbs {
258259 let end_bb = basic_coverage_blocks[ * end] . leader_bb ( ) ;
259- inject_statement ( mir_body, CoverageKind :: TestVectorBitmapUpdate { bitmap_idx } , end_bb) ;
260+ inject_statement (
261+ mir_body,
262+ CoverageKind :: TestVectorBitmapUpdate { bitmap_idx, decision_depth } ,
263+ end_bb,
264+ ) ;
260265 }
261266 }
262267
263- for ( true_bcb, false_bcb, condition_id) in
268+ for ( true_bcb, false_bcb, condition_id, decision_depth ) in
264269 coverage_spans. mappings . iter ( ) . filter_map ( |mapping| match mapping. kind {
265- BcbMappingKind :: MCDCBranch { true_bcb, false_bcb, condition_info } => {
266- Some ( ( true_bcb, false_bcb, condition_info?. condition_id ) )
270+ BcbMappingKind :: MCDCBranch { true_bcb, false_bcb, condition_info, decision_depth } => {
271+ Some ( ( true_bcb, false_bcb, condition_info?. condition_id , decision_depth ) )
267272 }
268273 _ => None ,
269274 } )
270275 {
271276 let true_bb = basic_coverage_blocks[ true_bcb] . leader_bb ( ) ;
272277 inject_statement (
273278 mir_body,
274- CoverageKind :: CondBitmapUpdate { id : condition_id, value : true } ,
279+ CoverageKind :: CondBitmapUpdate { id : condition_id, value : true , decision_depth } ,
275280 true_bb,
276281 ) ;
277282 let false_bb = basic_coverage_blocks[ false_bcb] . leader_bb ( ) ;
278283 inject_statement (
279284 mir_body,
280- CoverageKind :: CondBitmapUpdate { id : condition_id, value : false } ,
285+ CoverageKind :: CondBitmapUpdate { id : condition_id, value : false , decision_depth } ,
281286 false_bb,
282287 ) ;
283288 }
0 commit comments