@@ -18,8 +18,15 @@ rustc_index::newtype_index! {
1818rustc_index:: newtype_index! {
1919 #[ derive( HashStable ) ]
2020 #[ 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 { }
2330}
2431
2532rustc_index:: newtype_index! {
@@ -104,24 +111,31 @@ pub enum CoverageKind {
104111 /// Should be erased before codegen (at some point after `InstrumentCoverage`).
105112 BlockMarker { id : BlockMarkerId } ,
106113
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-
113114 /// Marks the first condition of a decision (boolean expression). All
114115 /// conditions in the same decision will reference this id.
115116 ///
116117 /// Has no effect during codegen.
117- MCDCDecisionEntryMarker { id : DecisionMarkerId } ,
118+ MCDCDecisionEntryMarker { id : DecisionId } ,
118119
119120 /// Marks one of the basic blocks following the decision referenced with `id`.
120121 /// the outcome bool designates which branch of the decision it is:
121122 /// `true` for the then block, `false` for the else block.
122123 ///
123124 /// 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 } ,
125139
126140 /// Marks the point in MIR control flow represented by a coverage counter.
127141 ///
@@ -164,15 +178,24 @@ impl Debug for CoverageKind {
164178 match self {
165179 SpanMarker => write ! ( fmt, "SpanMarker" ) ,
166180 BlockMarker { id } => write ! ( fmt, "BlockMarker({:?})" , id. index( ) ) ,
167- MCDCBlockMarker { id, decision_id } => {
168- write ! ( fmt, "MCDCBlockMarker({:?}, {:?})" , id. index( ) , decision_id. index( ) )
169- }
170181 MCDCDecisionEntryMarker { id } => {
171182 write ! ( fmt, "MCDCDecisionEntryMarker({:?})" , id. index( ) )
172183 }
173184 MCDCDecisionOutputMarker { id, outcome } => {
174185 write ! ( fmt, "MCDCDecisionOutputMarker({:?}, {})" , id. index( ) , outcome)
175186 }
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+ }
176199 CounterIncrement { id } => write ! ( fmt, "CounterIncrement({:?})" , id. index( ) ) ,
177200 ExpressionUsed { id } => write ! ( fmt, "ExpressionUsed({:?})" , id. index( ) ) ,
178201 MCDCBitmapRequire { needed_bytes } => {
@@ -300,7 +323,7 @@ pub struct BranchInfo {
300323
301324 /// Associate a span for every decision in the function body.
302325 /// Empty if MCDC coverage is disabled.
303- pub decision_spans : IndexVec < DecisionMarkerId , DecisionSpan > ,
326+ pub decision_spans : IndexVec < DecisionId , DecisionSpan > ,
304327}
305328
306329#[ derive( Clone , Debug ) ]
@@ -319,7 +342,7 @@ pub struct BranchSpan {
319342 pub span : Span ,
320343 /// ID of Decision structure the branch is part of. Only used in
321344 /// the MCDC coverage.
322- pub decision_id : DecisionMarkerId ,
345+ pub decision_id : DecisionId ,
323346 pub true_marker : BlockMarkerId ,
324347 pub false_marker : BlockMarkerId ,
325348}
0 commit comments