[PATCH] D36813: [Coverage] Build sorted and unique segments

Vedant Kumar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 16 19:01:03 PDT 2017


vsk created this revision.

A coverage segment contains a starting line and column, an execution
count, and some other metadata. Clients of the coverage library use
segments to prepare line-oriented reports.

Users of the coverage library depend on segments being unique and sorted
in source order. Currently this is not guaranteed (this is why the clang
change which introduced deferred regions was reverted).

This commit documents the "unique and sorted" condition and asserts that
it holds. It also fixes the SegmentBuilder so that it produces correct
output in some edge cases.

Testing: I've added unit tests for some edge cases. I've also checked
that the new SegmentBuilder implementation is fully covered. Apart from
running check-profile and the llvm-cov tests, I've successfully used a
stage1 llvm-cov to prepare a coverage report for an instrumented clang
binary.


https://reviews.llvm.org/D36813

Files:
  include/llvm/ProfileData/Coverage/CoverageMapping.h
  lib/ProfileData/Coverage/CoverageMapping.cpp
  test/tools/llvm-cov/deferred-region.cpp
  test/tools/llvm-cov/showHighlightedRanges.cpp
  unittests/ProfileData/CoverageMappingTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D36813.111456.patch
Type: text/x-patch
Size: 22987 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170817/f45d3e90/attachment.bin>


More information about the llvm-commits mailing list