@@ -70,10 +70,13 @@ pub(crate) fn dump_covfun_mappings(
70
70
}
71
71
// If the mapping is a branch region, print both of its arms
72
72
// in resolved form (even if they aren't expressions).
73
- MappingKind :: Branch { r#true, r#false } => {
73
+ MappingKind :: Branch { r#true, r#false }
74
+ | MappingKind :: MCDCBranch { r#true, r#false, .. } => {
74
75
println ! ( " true = {}" , expression_resolver. format_term( r#true) ) ;
75
76
println ! ( " false = {}" , expression_resolver. format_term( r#false) ) ;
76
77
}
78
+
79
+ MappingKind :: MCDCDecision { .. } => { }
77
80
_ => ( ) ,
78
81
}
79
82
}
@@ -159,11 +162,30 @@ impl<'a> Parser<'a> {
159
162
match high {
160
163
0 => unreachable ! ( "zero kind should have already been handled as a code mapping" ) ,
161
164
2 => Ok ( MappingKind :: Skip ) ,
162
- 4 => {
165
+ 4 | 6 => {
163
166
let r#true = self . read_simple_term ( ) ?;
164
167
let r#false = self . read_simple_term ( ) ?;
165
- Ok ( MappingKind :: Branch { r#true, r#false } )
168
+ if high == 6 {
169
+ let condition_id = self . read_uleb128_u32 ( ) ?;
170
+ let true_next_id = self . read_uleb128_u32 ( ) ?;
171
+ let false_next_id = self . read_uleb128_u32 ( ) ?;
172
+ Ok ( MappingKind :: MCDCBranch {
173
+ r#true,
174
+ r#false,
175
+ condition_id,
176
+ true_next_id,
177
+ false_next_id,
178
+ } )
179
+ } else {
180
+ Ok ( MappingKind :: Branch { r#true, r#false } )
181
+ }
166
182
}
183
+ 5 => {
184
+ let bitmap_idx = self . read_uleb128_u32 ( ) ?;
185
+ let conditions_num = self . read_uleb128_u32 ( ) ?;
186
+ Ok ( MappingKind :: MCDCDecision { bitmap_idx, conditions_num } )
187
+ }
188
+
167
189
_ => Err ( anyhow ! ( "unknown mapping kind: {raw_mapping_kind:#x}" ) ) ,
168
190
}
169
191
}
@@ -224,7 +246,28 @@ enum MappingKind {
224
246
// Using raw identifiers here makes the dump output a little bit nicer
225
247
// (via the derived Debug), at the expense of making this tool's source
226
248
// code a little bit uglier.
227
- Branch { r#true : CovTerm , r#false : CovTerm } ,
249
+ Branch {
250
+ r#true : CovTerm ,
251
+ r#false : CovTerm ,
252
+ } ,
253
+ MCDCBranch {
254
+ r#true : CovTerm ,
255
+ r#false : CovTerm ,
256
+ // These attributes are printed in Debug but not used directly.
257
+ #[ allow( dead_code) ]
258
+ condition_id : u32 ,
259
+ #[ allow( dead_code) ]
260
+ true_next_id : u32 ,
261
+ #[ allow( dead_code) ]
262
+ false_next_id : u32 ,
263
+ } ,
264
+ MCDCDecision {
265
+ // These attributes are printed in Debug but not used directly.
266
+ #[ allow( dead_code) ]
267
+ bitmap_idx : u32 ,
268
+ #[ allow( dead_code) ]
269
+ conditions_num : u32 ,
270
+ } ,
228
271
}
229
272
230
273
struct MappingRegion {
0 commit comments