Skip to content

Commit 0285394

Browse files
committed
Don't allocate second if SkipExpr isn't Expr.
1 parent a460885 commit 0285394

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

clang/lib/CodeGen/CoverageMappingGen.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -946,8 +946,12 @@ struct CounterCoverageMappingBuilder
946946
auto ExecCnt = Counter::getCounter(TheMap.first);
947947
auto SkipExpr = Builder.subtract(ParentCnt, ExecCnt);
948948

949-
if (!llvm::EnableSingleByteCoverage)
949+
if (!llvm::EnableSingleByteCoverage || !SkipExpr.isExpression()) {
950+
assert(
951+
!TheMap.getIsCounterPair().second &&
952+
"SkipCnt shouldn't be allocated but refer to an existing counter.");
950953
return {ExecCnt, SkipExpr};
954+
}
951955

952956
// Assign second if second is not assigned yet.
953957
if (!TheMap.getIsCounterPair().second)

0 commit comments

Comments
 (0)