File tree Expand file tree Collapse file tree 5 files changed +8
-13
lines changed
include/llvm/ProfileData/Coverage Expand file tree Collapse file tree 5 files changed +8
-13
lines changed Original file line number Diff line number Diff line change @@ -191,10 +191,7 @@ class SourceMappingRegion {
191
191
bool isBranch () const { return FalseCount.has_value (); }
192
192
193
193
bool isMCDCDecision () const {
194
- const auto *DecisionParams =
195
- std::get_if<mcdc::DecisionParameters>(&MCDCParams);
196
- assert (!DecisionParams || DecisionParams->NumConditions > 0 );
197
- return DecisionParams;
194
+ return std::holds_alternative<mcdc::DecisionParameters>(MCDCParams);
198
195
}
199
196
200
197
const auto &getMCDCDecisionParams () const {
Original file line number Diff line number Diff line change @@ -462,10 +462,7 @@ struct MCDCRecord {
462
462
463
463
CounterMappingRegion getDecisionRegion () const { return Region; }
464
464
unsigned getNumConditions () const {
465
- unsigned NumConditions = Region.getDecisionParams ().NumConditions ;
466
- assert (NumConditions != 0 &&
467
- " In MC/DC, NumConditions should never be zero!" );
468
- return NumConditions;
465
+ return Region.getDecisionParams ().NumConditions ;
469
466
}
470
467
unsigned getNumTestVectors () const { return TV.size (); }
471
468
bool isCondFolded (unsigned Condition) const { return Folded[Condition]; }
Original file line number Diff line number Diff line change @@ -33,7 +33,9 @@ struct DecisionParameters {
33
33
34
34
DecisionParameters () = delete ;
35
35
DecisionParameters (unsigned BitmapIdx, unsigned NumConditions)
36
- : BitmapIdx(BitmapIdx), NumConditions(NumConditions) {}
36
+ : BitmapIdx(BitmapIdx), NumConditions(NumConditions) {
37
+ assert (NumConditions > 0 );
38
+ }
37
39
};
38
40
39
41
struct BranchParameters {
@@ -44,7 +46,9 @@ struct BranchParameters {
44
46
45
47
BranchParameters () = delete ;
46
48
BranchParameters (ConditionID ID, const ConditionIDs &Conds)
47
- : ID(ID), Conds(Conds) {}
49
+ : ID(ID), Conds(Conds) {
50
+ assert (ID >= 0 );
51
+ }
48
52
};
49
53
50
54
// / The type of MC/DC-specific parameters.
Original file line number Diff line number Diff line change @@ -338,7 +338,6 @@ class NextIDsBuilder {
338
338
#endif
339
339
for (const auto *Branch : Branches) {
340
340
const auto &BranchParams = Branch->getBranchParams ();
341
- assert (BranchParams.ID >= 0 && " CondID isn't set" );
342
341
assert (SeenIDs.insert (BranchParams.ID ).second && " Duplicate CondID" );
343
342
NextIDs[BranchParams.ID ] = BranchParams.Conds ;
344
343
}
@@ -694,7 +693,6 @@ class MCDCDecisionRecorder {
694
693
assert (Branch.Kind == CounterMappingRegion::MCDCBranchRegion);
695
694
696
695
auto ConditionID = Branch.getBranchParams ().ID ;
697
- assert (ConditionID >= 0 && " ConditionID should be positive" );
698
696
699
697
if (ConditionIDs.contains (ConditionID) ||
700
698
ConditionID >= DecisionParams.NumConditions )
Original file line number Diff line number Diff line change @@ -256,7 +256,6 @@ void CoverageMappingWriter::write(raw_ostream &OS) {
256
256
// They are written as internal values plus 1.
257
257
const auto &BranchParams = I->getBranchParams ();
258
258
ParamsShouldBeNull = false ;
259
- assert (BranchParams.ID >= 0 );
260
259
unsigned ID1 = BranchParams.ID + 1 ;
261
260
unsigned TID1 = BranchParams.Conds [true ] + 1 ;
262
261
unsigned FID1 = BranchParams.Conds [false ] + 1 ;
You can’t perform that action at this time.
0 commit comments