summaryrefslogtreecommitdiffstats
path: root/contrib/llvm/tools/llvm-cov/CoverageReport.cpp
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2015-05-27 20:26:41 +0000
committerdim <dim@FreeBSD.org>2015-05-27 20:26:41 +0000
commit5ef8fd3549d38e883a31881636be3dc2a275de20 (patch)
treebd13a22d9db57ccf3eddbc07b32c18109521d050 /contrib/llvm/tools/llvm-cov/CoverageReport.cpp
parent77794ebe2d5718eb502c93ec32f8ccae4d8a0b7b (diff)
parent782067d0278612ee75d024b9b135c221c327e9e8 (diff)
downloadFreeBSD-src-5ef8fd3549d38e883a31881636be3dc2a275de20.zip
FreeBSD-src-5ef8fd3549d38e883a31881636be3dc2a275de20.tar.gz
Merge llvm trunk r238337 from ^/vendor/llvm/dist, resolve conflicts, and
preserve our customizations, where necessary.
Diffstat (limited to 'contrib/llvm/tools/llvm-cov/CoverageReport.cpp')
-rw-r--r--contrib/llvm/tools/llvm-cov/CoverageReport.cpp40
1 files changed, 27 insertions, 13 deletions
diff --git a/contrib/llvm/tools/llvm-cov/CoverageReport.cpp b/contrib/llvm/tools/llvm-cov/CoverageReport.cpp
index 6ae6ba5..497c2f8 100644
--- a/contrib/llvm/tools/llvm-cov/CoverageReport.cpp
+++ b/contrib/llvm/tools/llvm-cov/CoverageReport.cpp
@@ -12,7 +12,6 @@
//===----------------------------------------------------------------------===//
#include "CoverageReport.h"
-#include "CoverageSummary.h"
#include "RenderingSupport.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Format.h"
@@ -156,14 +155,15 @@ void CoverageReport::render(const FunctionCoverageSummary &Function,
OS << "\n";
}
-void CoverageReport::renderFunctionReports(raw_ostream &OS) {
+void CoverageReport::renderFunctionReports(ArrayRef<std::string> Files,
+ raw_ostream &OS) {
bool isFirst = true;
- for (const auto &File : Summary.getFileSummaries()) {
+ for (StringRef Filename : Files) {
if (isFirst)
isFirst = false;
else
OS << "\n";
- OS << "File '" << File.Name << "':\n";
+ OS << "File '" << Filename << "':\n";
OS << column("Name", FunctionReportColumns[0])
<< column("Regions", FunctionReportColumns[1], Column::RightAlignment)
<< column("Miss", FunctionReportColumns[2], Column::RightAlignment)
@@ -174,13 +174,19 @@ void CoverageReport::renderFunctionReports(raw_ostream &OS) {
OS << "\n";
renderDivider(FunctionReportColumns, OS);
OS << "\n";
- for (const auto &Function : File.FunctionSummaries)
+ FunctionCoverageSummary Totals("TOTAL");
+ for (const auto &F : Coverage->getCoveredFunctions(Filename)) {
+ FunctionCoverageSummary Function = FunctionCoverageSummary::get(F);
+ ++Totals.ExecutionCount;
+ Totals.RegionCoverage += Function.RegionCoverage;
+ Totals.LineCoverage += Function.LineCoverage;
render(Function, OS);
- renderDivider(FunctionReportColumns, OS);
- OS << "\n";
- render(FunctionCoverageSummary("TOTAL", /*ExecutionCount=*/0,
- File.RegionCoverage, File.LineCoverage),
- OS);
+ }
+ if (Totals.ExecutionCount) {
+ renderDivider(FunctionReportColumns, OS);
+ OS << "\n";
+ render(Totals, OS);
+ }
}
}
@@ -194,9 +200,17 @@ void CoverageReport::renderFileReports(raw_ostream &OS) {
<< "\n";
renderDivider(FileReportColumns, OS);
OS << "\n";
- for (const auto &File : Summary.getFileSummaries())
- render(File, OS);
+ FileCoverageSummary Totals("TOTAL");
+ for (StringRef Filename : Coverage->getUniqueSourceFiles()) {
+ FileCoverageSummary Summary(Filename);
+ for (const auto &F : Coverage->getCoveredFunctions(Filename)) {
+ FunctionCoverageSummary Function = FunctionCoverageSummary::get(F);
+ Summary.addFunction(Function);
+ Totals.addFunction(Function);
+ }
+ render(Summary, OS);
+ }
renderDivider(FileReportColumns, OS);
OS << "\n";
- render(Summary.getCombinedFileSummaries(), OS);
+ render(Totals, OS);
}
OpenPOWER on IntegriCloud