[Coverage] Emit a gap area after if conditions
authorVedant Kumar <vsk@apple.com>
Thu, 9 Nov 2017 02:33:38 +0000 (02:33 +0000)
committerVedant Kumar <vsk@apple.com>
Thu, 9 Nov 2017 02:33:38 +0000 (02:33 +0000)
commit2e8c87590546477736d6744edf8f5cf48bf1ef41
treedb6af1baad05772a59d39d29676d98a8ee272dc5
parentc6721f580df11bb0bd00217a45430d163770a278
[Coverage] Emit a gap area after if conditions

The area immediately after the closing right-paren of an if condition
should have a count equal to the 'then' block's count. Use a gap region
to set this count, so that region highlighting for the 'then' block
remains precise.

This solves a problem we have with wrapped segments. Consider:

  1| if (false)
  2|   foo();

Without a gap area starting after the condition, the wrapped segment
from line 1 would make it look like line 2 is executed, when it's not.

rdar://35373009

llvm-svn: 317758
18 files changed:
clang/lib/CodeGen/CoverageMappingGen.cpp
clang/test/CoverageMapping/break.c
clang/test/CoverageMapping/casts.c
clang/test/CoverageMapping/continue.c
clang/test/CoverageMapping/if.cpp
clang/test/CoverageMapping/includehell.cpp
clang/test/CoverageMapping/label.cpp
clang/test/CoverageMapping/macro-expansion.c
clang/test/CoverageMapping/macro-expressions.cpp
clang/test/CoverageMapping/macroscopes.cpp
clang/test/CoverageMapping/moremacros.c
clang/test/CoverageMapping/objc.m
clang/test/CoverageMapping/preprocessor.c
clang/test/CoverageMapping/return.c
clang/test/CoverageMapping/switch.cpp
clang/test/CoverageMapping/switchmacro.c
clang/test/CoverageMapping/test.c
clang/test/CoverageMapping/trycatch.cpp