]> granicus.if.org Git - llvm/commit
[llvm-cov] Ignore unclosed line segments when setting line counts
authorVedant Kumar <vsk@apple.com>
Fri, 4 Aug 2017 00:36:24 +0000 (00:36 +0000)
committerVedant Kumar <vsk@apple.com>
Fri, 4 Aug 2017 00:36:24 +0000 (00:36 +0000)
commitc7e789c84308f8a46cf12d6439cfa5a0b285ebbc
tree3f3ac531ab6587c0cc12d5b550c3068600e5b22b
parent0f0fd4219273bf727626c98a776d6cdd9d3db820
[llvm-cov] Ignore unclosed line segments when setting line counts

This patch makes a slight change to the way llvm-cov determines line
execution counts. If there are multiple line segments on a line, the
line count is the max count among the regions which start *and* end on
the line. This avoids an issue posed by deferred regions which start on
the same line as a terminated region, e.g:

  if (false)
    return; //< The line count should be 0, even though a new region
            //< starts at the semi-colon.
  foo();

Another change is that counts from line segments which don't correspond
to region entries are considered. This enables the first change, and
corrects an outstanding issue (see the showLineExecutionCounts.cpp test
change).

This is related to D35925.

Testing: check-profile, llvm-cov lit tests

Differential Revision: https://reviews.llvm.org/D36014

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310012 91177308-0d34-0410-b5e6-96231b3b80d8
test/tools/llvm-cov/Inputs/deferred-regions.covmapping [new file with mode: 0644]
test/tools/llvm-cov/Inputs/deferred-regions.profdata [new file with mode: 0644]
test/tools/llvm-cov/deferred-region.cpp [new file with mode: 0644]
test/tools/llvm-cov/showLineExecutionCounts.cpp
tools/llvm-cov/SourceCoverageView.cpp
tools/llvm-cov/SourceCoverageView.h