llvm-cov: Use the number of executed functions for the function coverage metric.
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
diff --git a/llvm/tools/llvm-cov/CoverageSummaryInfo.cpp b/llvm/tools/llvm-cov/CoverageSummaryInfo.cpp
index 334bc73..dd78ace 100644
--- a/llvm/tools/llvm-cov/CoverageSummaryInfo.cpp
+++ b/llvm/tools/llvm-cov/CoverageSummaryInfo.cpp
@@ -65,7 +65,8 @@
NumLines += LineCount;
}
return FunctionCoverageSummary(
- Function.Name, RegionCoverageInfo(CoveredRegions, NumCodeRegions),
+ Function.Name, Function.ExecutionCount,
+ RegionCoverageInfo(CoveredRegions, NumCodeRegions),
LineCoverageInfo(CoveredLines, 0, NumLines));
}
@@ -74,7 +75,7 @@
ArrayRef<FunctionCoverageSummary> FunctionSummaries) {
size_t NumRegions = 0, CoveredRegions = 0;
size_t NumLines = 0, NonCodeLines = 0, CoveredLines = 0;
- size_t NumFunctionsCovered = 0;
+ size_t NumFunctionsExecuted = 0;
for (const auto &Func : FunctionSummaries) {
CoveredRegions += Func.RegionCoverage.Covered;
NumRegions += Func.RegionCoverage.NumRegions;
@@ -83,13 +84,13 @@
NonCodeLines += Func.LineCoverage.NonCodeLines;
NumLines += Func.LineCoverage.NumLines;
- if (Func.RegionCoverage.isFullyCovered())
- ++NumFunctionsCovered;
+ if (Func.ExecutionCount != 0)
+ ++NumFunctionsExecuted;
}
return FileCoverageSummary(
Name, RegionCoverageInfo(CoveredRegions, NumRegions),
LineCoverageInfo(CoveredLines, NonCodeLines, NumLines),
- FunctionCoverageInfo(NumFunctionsCovered, FunctionSummaries.size()),
+ FunctionCoverageInfo(NumFunctionsExecuted, FunctionSummaries.size()),
FunctionSummaries);
}