Skip to content

Commit 6a9d0e5

Browse files
committed
[llvm-cov] Prevent assertion failure in sumMCDCPairs
Since #112694, MCDCRecord::isCondFolded() has returned true for "partially folded" conditions. Besides, isConditionIndependencePairCovered() returns true if the unfolded condition is satisfied. This might break consistency (CoveredPairs <= NumPairs).
1 parent 42432ad commit 6a9d0e5

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

llvm/tools/llvm-cov/CoverageSummaryInfo.cpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,11 @@ auto sumMCDCPairs(const ArrayRef<MCDCRecord> &Records) {
5353
for (const auto &Record : Records) {
5454
const auto NumConditions = Record.getNumConditions();
5555
for (unsigned C = 0; C < NumConditions; C++) {
56-
if (!Record.isCondFolded(C))
56+
if (!Record.isCondFolded(C)) {
5757
++NumPairs;
58-
if (Record.isConditionIndependencePairCovered(C))
59-
++CoveredPairs;
58+
if (Record.isConditionIndependencePairCovered(C))
59+
++CoveredPairs;
60+
}
6061
}
6162
}
6263
return MCDCCoverageInfo(CoveredPairs, NumPairs);

0 commit comments

Comments
 (0)