Skip to content

Commit abbdb31

Browse files
committed
[clang][CoverageMapping] do not emit gap when either end is an ImplicitValueInitExpr
1 parent 48324f0 commit abbdb31

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

clang/lib/CodeGen/CoverageMappingGen.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1368,9 +1368,12 @@ struct CounterCoverageMappingBuilder
13681368
for (const Stmt *Child : S->children())
13691369
if (Child) {
13701370
// If last statement contains terminate statements, add a gap area
1371-
// between the two statements. Skipping attributed statements, because
1372-
// they don't have valid start location.
1373-
if (LastStmt && HasTerminateStmt && !isa<AttributedStmt>(Child)) {
1371+
// between the two statements. Skipping attributed statements and
1372+
// implicit initializations, because they don't have valid source
1373+
// location.
1374+
if (LastStmt && HasTerminateStmt && !isa<AttributedStmt>(Child) &&
1375+
!isa<ImplicitValueInitExpr>(Child) &&
1376+
!isa<ImplicitValueInitExpr>(LastStmt)) {
13741377
auto Gap = findGapAreaBetween(getEnd(LastStmt), getStart(Child));
13751378
if (Gap)
13761379
fillGapAreaWithCount(Gap->getBegin(), Gap->getEnd(),

0 commit comments

Comments
 (0)