[PATCH] D36014: [llvm-cov] Ignore unclosed line segments when setting line counts

Vedant Kumar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 28 12:44:17 PDT 2017


vsk created this revision.

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 https://reviews.llvm.org/D35925.

Testing: check-profile, llvm-cov lit tests


https://reviews.llvm.org/D36014

Files:
  test/tools/llvm-cov/Inputs/deferred-regions.covmapping
  test/tools/llvm-cov/Inputs/deferred-regions.profdata
  test/tools/llvm-cov/deferred-region.cpp
  test/tools/llvm-cov/showLineExecutionCounts.cpp
  tools/llvm-cov/SourceCoverageView.cpp
  tools/llvm-cov/SourceCoverageView.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D36014.108695.patch
Type: text/x-patch
Size: 8016 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170728/d84943aa/attachment.bin>


More information about the llvm-commits mailing list