@@ -18,8 +18,15 @@ rustc_index::newtype_index! {
18
18
rustc_index:: newtype_index! {
19
19
#[ derive( HashStable ) ]
20
20
#[ encodable]
21
- #[ debug_format = "DecisionMarkerId({})" ]
22
- pub struct DecisionMarkerId { }
21
+ #[ debug_format = "DecisionId({})" ]
22
+ pub struct DecisionId { }
23
+ }
24
+
25
+ rustc_index:: newtype_index! {
26
+ #[ derive( HashStable ) ]
27
+ #[ encodable]
28
+ #[ debug_format = "ConditionId({})" ]
29
+ pub struct ConditionId { }
23
30
}
24
31
25
32
rustc_index:: newtype_index! {
@@ -104,24 +111,31 @@ pub enum CoverageKind {
104
111
/// Should be erased before codegen (at some point after `InstrumentCoverage`).
105
112
BlockMarker { id : BlockMarkerId } ,
106
113
107
- /// Same as BlockMarker, but carries a reference to its parent decision for
108
- /// MCDC coverage.
109
- ///
110
- /// Has no effect during codegen.
111
- MCDCBlockMarker { id : BlockMarkerId , decision_id : DecisionMarkerId } ,
112
-
113
114
/// Marks the first condition of a decision (boolean expression). All
114
115
/// conditions in the same decision will reference this id.
115
116
///
116
117
/// Has no effect during codegen.
117
- MCDCDecisionEntryMarker { id : DecisionMarkerId } ,
118
+ MCDCDecisionEntryMarker { id : DecisionId } ,
118
119
119
120
/// Marks one of the basic blocks following the decision referenced with `id`.
120
121
/// the outcome bool designates which branch of the decision it is:
121
122
/// `true` for the then block, `false` for the else block.
122
123
///
123
124
/// Has no effect during codegen.
124
- MCDCDecisionOutputMarker { id : DecisionMarkerId , outcome : bool } ,
125
+ MCDCDecisionOutputMarker { id : DecisionId , outcome : bool } ,
126
+
127
+ /// Marks a basic block where a condition evaluation occurs
128
+ /// The block may end with a SwitchInt where the 2 successors BBs have a
129
+ /// MCDCConditionOutcomeMarker statement with a matching ID.
130
+ ///
131
+ /// Has no effect during codegen.
132
+ MCDCConditionEntryMarker { decision_id : DecisionId , id : ConditionId } ,
133
+
134
+ /// Marks a basic block that is branched from a condition evaluation.
135
+ /// The block may have a predecessor with a matching ID.
136
+ ///
137
+ /// Has no effect during codegen.
138
+ MCDCConditionOutputMarker { decision_id : DecisionId , id : ConditionId , outcome : bool } ,
125
139
126
140
/// Marks the point in MIR control flow represented by a coverage counter.
127
141
///
@@ -164,15 +178,24 @@ impl Debug for CoverageKind {
164
178
match self {
165
179
SpanMarker => write ! ( fmt, "SpanMarker" ) ,
166
180
BlockMarker { id } => write ! ( fmt, "BlockMarker({:?})" , id. index( ) ) ,
167
- MCDCBlockMarker { id, decision_id } => {
168
- write ! ( fmt, "MCDCBlockMarker({:?}, {:?})" , id. index( ) , decision_id. index( ) )
169
- }
170
181
MCDCDecisionEntryMarker { id } => {
171
182
write ! ( fmt, "MCDCDecisionEntryMarker({:?})" , id. index( ) )
172
183
}
173
184
MCDCDecisionOutputMarker { id, outcome } => {
174
185
write ! ( fmt, "MCDCDecisionOutputMarker({:?}, {})" , id. index( ) , outcome)
175
186
}
187
+ MCDCConditionEntryMarker { decision_id, id } => {
188
+ write ! ( fmt, "MCDCConditionEntryMarker({:?}, {:?})" , decision_id. index( ) , id. index( ) )
189
+ }
190
+ MCDCConditionOutputMarker { decision_id, id, outcome } => {
191
+ write ! (
192
+ fmt,
193
+ "MCDCConditionOutcomeMarker({:?}, {:?}, {})" ,
194
+ decision_id. index( ) ,
195
+ id. index( ) ,
196
+ outcome
197
+ )
198
+ }
176
199
CounterIncrement { id } => write ! ( fmt, "CounterIncrement({:?})" , id. index( ) ) ,
177
200
ExpressionUsed { id } => write ! ( fmt, "ExpressionUsed({:?})" , id. index( ) ) ,
178
201
MCDCBitmapRequire { needed_bytes } => {
@@ -300,7 +323,7 @@ pub struct BranchInfo {
300
323
301
324
/// Associate a span for every decision in the function body.
302
325
/// Empty if MCDC coverage is disabled.
303
- pub decision_spans : IndexVec < DecisionMarkerId , DecisionSpan > ,
326
+ pub decision_spans : IndexVec < DecisionId , DecisionSpan > ,
304
327
}
305
328
306
329
#[ derive( Clone , Debug ) ]
@@ -319,7 +342,7 @@ pub struct BranchSpan {
319
342
pub span : Span ,
320
343
/// ID of Decision structure the branch is part of. Only used in
321
344
/// the MCDC coverage.
322
- pub decision_id : DecisionMarkerId ,
345
+ pub decision_id : DecisionId ,
323
346
pub true_marker : BlockMarkerId ,
324
347
pub false_marker : BlockMarkerId ,
325
348
}
0 commit comments