Skip to content

Commit ab84f17

Browse files
committed
Introduce skeleton getSwitchImplicitDefaultCounter()
1 parent 58feee3 commit ab84f17

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

clang/lib/CodeGen/CoverageMappingGen.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -947,6 +947,11 @@ struct CounterCoverageMappingBuilder
947947
return {ExecCnt, Builder.subtract(ParentCnt, ExecCnt)};
948948
}
949949

950+
Counter getSwitchImplicitDefaultCounter(const Stmt *Cond, Counter ParentCount,
951+
Counter CaseCountSum) {
952+
return Builder.subtract(ParentCount, CaseCountSum);
953+
}
954+
950955
bool IsCounterEqual(Counter OutCount, Counter ParentCount) {
951956
if (OutCount == ParentCount)
952957
return true;
@@ -1903,7 +1908,8 @@ struct CounterCoverageMappingBuilder
19031908
// the hidden branch, which will be added later by the CodeGen. This region
19041909
// will be associated with the switch statement's condition.
19051910
if (!HasDefaultCase) {
1906-
Counter DefaultCount = subtractCounters(ParentCount, CaseCountSum);
1911+
Counter DefaultCount = getSwitchImplicitDefaultCounter(
1912+
S->getCond(), ParentCount, CaseCountSum);
19071913
createBranchRegion(S->getCond(), Counter::getZero(), DefaultCount);
19081914
}
19091915
}

0 commit comments

Comments
 (0)