Skip to content

Commit

Permalink
[llvm-cov] Prevent assertion failure in sumMCDCPairs
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
chapuni committed Jan 28, 2025
1 parent 42432ad commit 6a9d0e5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions llvm/tools/llvm-cov/CoverageSummaryInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,11 @@ auto sumMCDCPairs(const ArrayRef<MCDCRecord> &Records) {
for (const auto &Record : Records) {
const auto NumConditions = Record.getNumConditions();
for (unsigned C = 0; C < NumConditions; C++) {
if (!Record.isCondFolded(C))
if (!Record.isCondFolded(C)) {
++NumPairs;
if (Record.isConditionIndependencePairCovered(C))
++CoveredPairs;
if (Record.isConditionIndependencePairCovered(C))
++CoveredPairs;
}
}
}
return MCDCCoverageInfo(CoveredPairs, NumPairs);
Expand Down

0 comments on commit 6a9d0e5

Please sign in to comment.