]> granicus.if.org Git - llvm/commit
[llvm-cov] Avoid over-counting covered lines and regions
authorVedant Kumar <vsk@apple.com>
Fri, 15 Sep 2017 23:00:02 +0000 (23:00 +0000)
committerVedant Kumar <vsk@apple.com>
Fri, 15 Sep 2017 23:00:02 +0000 (23:00 +0000)
commit310c2806731c6a23d9769da3c519cd03251ba638
tree48abd9f6410a9c44a2a3ade125a69d7f2f87d044
parentc94f3924be4121029ef7ca35d323f1ce65a569d8
[llvm-cov] Avoid over-counting covered lines and regions

* Fix an unsigned integer overflow in the logic that computes the
  number of uncovered lines in a function.

* When aggregating region and line coverage summaries, take into account
  that different instantiations may have a different number of regions.

The new test case provides test coverage for both bugs. I also verified
this change by preparing a coverage report for a stage2 build of llc --
the new assertions should detect any outstanding over-counting bugs.

Fixes PR34613.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313417 91177308-0d34-0410-b5e6-96231b3b80d8
test/tools/llvm-cov/Inputs/multiple_objects/header.h [new file with mode: 0644]
test/tools/llvm-cov/Inputs/multiple_objects/merged.profdata [new file with mode: 0644]
test/tools/llvm-cov/Inputs/multiple_objects/use_1.cc [new file with mode: 0644]
test/tools/llvm-cov/Inputs/multiple_objects/use_1.covmapping [new file with mode: 0644]
test/tools/llvm-cov/Inputs/multiple_objects/use_2.cc [new file with mode: 0644]
test/tools/llvm-cov/Inputs/multiple_objects/use_2.covmapping [new file with mode: 0644]
test/tools/llvm-cov/multiple-objects.test [new file with mode: 0644]
tools/llvm-cov/CoverageSummaryInfo.cpp
tools/llvm-cov/CoverageSummaryInfo.h