diff options
author | Vedant Kumar <vsk@apple.com> | 2016-09-19 00:38:23 +0000 |
---|---|---|
committer | Vedant Kumar <vsk@apple.com> | 2016-09-19 00:38:23 +0000 |
commit | e17f26f0669952a967c3981be6569cc0e624dbdb (patch) | |
tree | 2ff2ef5ea7dad593d84e69197ba57a66edd53382 /tools/llvm-cov/SourceCoverageViewHTML.cpp | |
parent | 40817d86f07ddcbbad56538866dd8349b985efa8 (diff) |
[llvm-cov] Track function and instantiation coverage separately
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281875 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-cov/SourceCoverageViewHTML.cpp')
-rw-r--r-- | tools/llvm-cov/SourceCoverageViewHTML.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/tools/llvm-cov/SourceCoverageViewHTML.cpp b/tools/llvm-cov/SourceCoverageViewHTML.cpp index e64f31d546e..1ef3219b103 100644 --- a/tools/llvm-cov/SourceCoverageViewHTML.cpp +++ b/tools/llvm-cov/SourceCoverageViewHTML.cpp @@ -287,8 +287,8 @@ void CoveragePrinterHTML::closeViewFile(OwnedStream OS) { static void emitColumnLabelsForIndex(raw_ostream &OS) { SmallVector<std::string, 4> Columns; Columns.emplace_back(tag("td", "Filename", "column-entry-left")); - for (const char *Label : - {"Function Coverage", "Line Coverage", "Region Coverage"}) + for (const char *Label : {"Function Coverage", "Instantiation Coverage", + "Line Coverage", "Region Coverage"}) Columns.emplace_back(tag("td", Label, "column-entry")); OS << tag("tr", join(Columns.begin(), Columns.end(), "")); } @@ -334,6 +334,9 @@ void CoveragePrinterHTML::emitFileSummary(raw_ostream &OS, StringRef SF, AddCoverageTripleToColumn(FCS.FunctionCoverage.Executed, FCS.FunctionCoverage.NumFunctions, FCS.FunctionCoverage.getPercentCovered()); + AddCoverageTripleToColumn(FCS.InstantiationCoverage.Executed, + FCS.InstantiationCoverage.NumFunctions, + FCS.InstantiationCoverage.getPercentCovered()); AddCoverageTripleToColumn(FCS.LineCoverage.Covered, FCS.LineCoverage.NumLines, FCS.LineCoverage.getPercentCovered()); AddCoverageTripleToColumn(FCS.RegionCoverage.Covered, |