summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-cov/CoverageSummaryInfo.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* [llvm-cov] Move LineCoverageIterator to libCoverage. NFC.Vedant Kumar2017-10-181-53/+0
| | | | | | | | | | | | | LineCoverageIterator makes it easy for clients of coverage data to determine line execution counts for a file or function. The coverage iteration logic is tricky enough that it really pays not to have multiple copies of it. Hopefully having just one implementation in LLVM will make the iteration logic easier to test, reuse, and update. This commit is NFC but I've added a unit test to go along with it just because it's easy to do now. llvm-svn: 316141
* [llvm-cov] Add one correction to r315960 (PR34962)Vedant Kumar2017-10-171-7/+6
| | | | | | | | | In r315960, I accidentally assumed that the first line segment is guaranteed to be the non-gap region entry segment (given that one is present). It can actually be any segment on the line, and the test I checked in demonstrates that. llvm-svn: 315963
* [llvm-cov] Remove workaround in line execution count calculation (PR34962)Vedant Kumar2017-10-161-15/+8
| | | | | | | | | | | | | Gap areas make it possible to correctly determine when to use counts from deferred regions. Before gap areas were introduced, llvm-cov needed to use a heuristic to do this: it ignored counts from segments that start, but do not end, on a line. This heuristic breaks down on a simple example (see PR34962). This patch removes the heuristic and picks counts from any region entry segment which isn't a gap area. llvm-svn: 315960
* [llvm-cov] Factor out logic to iterate over line coverage stats (NFC)Vedant Kumar2017-10-141-23/+25
| | | | | | | | | | There were two copies of the logic needed to construct a line stats object for each line in a range: this patch brings it down to one. In the future, this will make it easier for IDE clients to display coverage in-line in source editors. To do that, we just need to move the new LineCoverageIterator class to libCoverage. llvm-svn: 315789
* [llvm-cov] Make report metrics agree with line exec counts, fixes PR34615Vedant Kumar2017-09-191-41/+67
| | | | | | | | | Use the same logic as the line-oriented coverage view to determine the number of covered lines in a function. Fixes llvm.org/PR34615. llvm-svn: 313604
* [llvm-cov] Fix a bot failure due to r313417Vedant Kumar2017-09-151-3/+3
| | | | | | | | | There's a type mismatch issue with the arguments to a call to std::min introduced in r313417. http://lab.llvm.org:8011/builders/clang-cmake-thumbv7-a15/builds/11174 llvm-svn: 313422
* [llvm-cov] Avoid over-counting covered lines and regionsVedant Kumar2017-09-151-4/+14
| | | | | | | | | | | | | | | | * 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. llvm-svn: 313417
* [llvm-cov] Make some summary info fields private. NFC.Vedant Kumar2017-09-151-4/+2
| | | | | | | | There's a bug in the way the line and region summary objects are merged. It would have been less likely to occur if those objects kept some data private. llvm-svn: 313416
* [llvm-cov] Remove a redundant field. NFC.Vedant Kumar2017-09-151-4/+0
| | | | | | | | | | The "NotCovered" fields in the region and line summary structs are redundant. We should remove them to make the code clearer. As a follow-up, the "NotCovered" entries should be removed from the reports as well. llvm-svn: 313415
* [llvm-cov] Fix a lifetime issueVedant Kumar2017-09-081-1/+1
| | | | | | | This fixes an issue where a std::string was moved to a constructor which accepted a StringRef. llvm-svn: 312816
* [Coverage] Add an API to retrive all instantiations of a function (NFC)Vedant Kumar2017-08-021-10/+27
| | | | | | | | | | | | | | | | | | | | | | | | | The CoverageMapping::getInstantiations() API retrieved all function records corresponding to functions with more than one instantiation (e.g template functions with multiple specializations). However, there was no simple way to determine *which* function a given record was an instantiation of. This was an oversight, since it's useful to aggregate coverage information over all instantiations of a function. llvm-cov works around this by building a mapping of source locations to instantiation sets, but this duplicates logic that libCoverage already has (see FunctionInstantiationSetCollector). This change adds a new API, CoverageMapping::getInstantiationGroups(), which returns a list of InstantiationGroups. A group contains records for each instantiation of some particular function, and also provides utilities to get the total execution count within the group, the source location of the common definition, etc. This lets removes some hacky logic in llvm-cov by reusing FunctionInstantiationSetCollector and makes the CoverageMapping API friendlier for other clients. llvm-svn: 309904
* [llvm-cov] Delete the NonCodeLines field, it was always deadVedant Kumar2016-09-191-1/+1
| | | | llvm-svn: 281882
* [llvm-cov] Track function and instantiation coverage separatelyVedant Kumar2016-09-191-0/+12
| | | | | | | | | | | | | | | | | | | | These are distinct statistics which are useful to look at separately. Example: say you have a template function "foo" with 5 instantiations and only 3 of them are covered. Then this contributes (1/1) to the total function coverage and (3/5) to the total instantiation coverage. I.e, the old "Function Coverage" column has been renamed to "Instantiation Coverage", and the new "Function Coverage" aggregates information from the various instantiations of a function. One benefit of making this switch is that the Line and Region coverage columns will start making sense. Let's continue the example and assume that the 5 instantiations of "foo" cover {2, 4, 6, 8, 10} out of 10 lines respectively. The new line coverage for "foo" is (10/10), not (30/50). The old scenario got confusing because we'd report that there were more lines in a file than what was actually possible. llvm-svn: 281875
* test commitYing Yi2016-07-221-1/+1
| | | | llvm-svn: 276401
* llvm-cov: Simplify coverage reports, fixing PR22575 in the processJustin Bogner2015-02-141-25/+0
| | | | | | | | | | | | | | PR22575 occurred because we were unsafely storing references into a std::vector. If the vector moved because it grew, we'd be left iterating through garbage memory. This avoids the issue by simplifying the logic to gather coverage information as we go, rather than storing it and iterating over it. I'm relying on the existing tests showing that this is semantically NFC, since it's difficult to hit the issue this fixes without relatively large covered programs. llvm-svn: 229215
* llvm-cov: Use the number of executed functions for the function coverage metric.Alex Lorenz2014-09-301-5/+6
| | | | | | | | This commit fixes llvm-cov's function coverage metric by using the number of executed functions instead of the number of fully covered functions. Differential Revision: http://reviews.llvm.org/D5196 llvm-svn: 218672
* llvm-cov: Disentangle the coverage data logic from the display (NFC)Justin Bogner2014-09-201-1/+1
| | | | | | | | | | This splits the logic for actually looking up coverage information from the logic that displays it. These were tangled rather thoroughly so this change is a bit large, but it mostly consists of moving things around. The coverage lookup logic itself now lives in the library, rather than being spread between the library and the tool. llvm-svn: 218184
* llvm-cov: Rename MappingRegion to coverage::CountedRegion (NFC)Justin Bogner2014-09-091-13/+13
| | | | | | | This name was too similar to CoverageMappingRegion, and the type really belongs in the coverage library anyway. llvm-svn: 217416
* llvm-cov: Remove dead codeJustin Bogner2014-09-081-1/+1
| | | | | | | FunctionCoverageMapping::PrettyName was from a version of the tool during review, and isn't actually used currently. llvm-svn: 217398
* llvm-cov: add code coverage tool that's based on coverage mapping format and ↵Alex Lorenz2014-08-221-0/+95
clang's pgo. This commit expands llvm-cov's functionality by adding support for a new code coverage tool that uses LLVM's coverage mapping format and clang's instrumentation based profiling. The gcov compatible tool can be invoked by supplying the 'gcov' command as the first argument, or by modifying the tool's name to end with 'gcov'. Differential Revision: http://reviews.llvm.org/D4445 llvm-svn: 216300
OpenPOWER on IntegriCloud