[llvm] r276409 - [llvm-cov] - Add the coverage of lines in the summary report.
Ying Yi via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 22 05:46:13 PDT 2016
Author: yingyi
Date: Fri Jul 22 07:46:13 2016
New Revision: 276409
URL: http://llvm.org/viewvc/llvm-project?rev=276409&view=rev
Log:
[llvm-cov] - Add the coverage of lines in the summary report.
The llvm-cov ‘report' command displays a summary of the coverage of a binary file.
The summary report currently only includes covered regions and covered functions.
This patch adds the coverage of lines in the summary report.
Differential Revision: https://reviews.llvm.org/D22569
Modified:
llvm/trunk/test/tools/llvm-cov/prevent_false_instantiations.h
llvm/trunk/test/tools/llvm-cov/report.cpp
llvm/trunk/tools/llvm-cov/CoverageReport.cpp
Modified: llvm/trunk/test/tools/llvm-cov/prevent_false_instantiations.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-cov/prevent_false_instantiations.h?rev=276409&r1=276408&r2=276409&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-cov/prevent_false_instantiations.h (original)
+++ llvm/trunk/test/tools/llvm-cov/prevent_false_instantiations.h Fri Jul 22 07:46:13 2016
@@ -1,7 +1,7 @@
// Checks that function instantiations don't go to a wrong file.
// INSTANTIATION-NOT: {{_Z5func[1,2]v}}
-// NAN-NOT: 0{{[ \t]+}}nan%{{[ \t]+}}0{{[ \t]+}}nan%
+// NAN-NOT: {{[ \t]+}}nan%
// RUN: llvm-profdata merge %S/Inputs/prevent_false_instantiations.proftext -o %t.profdata
// RUN: llvm-cov show -format text %S/Inputs/prevent_false_instantiations.covmapping -instr-profile %t.profdata -filename-equivalence %s | FileCheck %s -check-prefix=INSTANTIATION
Modified: llvm/trunk/test/tools/llvm-cov/report.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-cov/report.cpp?rev=276409&r1=276408&r2=276409&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-cov/report.cpp (original)
+++ llvm/trunk/test/tools/llvm-cov/report.cpp Fri Jul 22 07:46:13 2016
@@ -1,11 +1,11 @@
// RUN: llvm-cov report %S/Inputs/report.covmapping -instr-profile %S/Inputs/report.profdata -filename-equivalence 2>&1 | FileCheck %s
// RUN: llvm-cov report %S/Inputs/report.covmapping -instr-profile %S/Inputs/report.profdata -filename-equivalence report.cpp 2>&1 | FileCheck -check-prefix=FILT-NEXT %s
-// CHECK: Filename Regions Miss Cover Functions Executed
+// CHECK: Filename Regions Missed Regions Cover Functions Missed Functions Executed Lines Missed Lines Cover
// CHECK-NEXT: ---
-// CHECK-NEXT: report.cpp 5 2 60.00% 4 75.00%
+// CHECK-NEXT: report.cpp 5 2 60.00% 4 1 75.00% 13 4 69.23%
// CHECK-NEXT: ---
-// CHECK-NEXT: TOTAL 5 2 60.00% 4 75.00%
+// CHECK-NEXT: TOTAL 5 2 60.00% 4 1 75.00% 13 4 69.23%
// FILT: File 'report.cpp':
// FILT-NEXT: Name Regions Miss Cover Lines Miss Cover
Modified: llvm/trunk/tools/llvm-cov/CoverageReport.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-cov/CoverageReport.cpp?rev=276409&r1=276408&r2=276409&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-cov/CoverageReport.cpp (original)
+++ llvm/trunk/tools/llvm-cov/CoverageReport.cpp Fri Jul 22 07:46:13 2016
@@ -88,7 +88,8 @@ static Column column(StringRef Str, unsi
return Column(Str, Width).set(Value);
}
-static size_t FileReportColumns[] = {25, 10, 8, 8, 10, 10};
+// Specify the default column widths.
+static size_t FileReportColumns[] = {25, 12, 18, 10, 12, 18, 10, 12, 18, 10};
static size_t FunctionReportColumns[] = {25, 10, 8, 8, 10, 8, 8};
/// \brief Adjust column widths to fit long file paths and function names.
@@ -136,10 +137,24 @@ void CoverageReport::render(const FileCo
File.RegionCoverage.getPercentCovered()) << '%';
OS << format("%*u", FileReportColumns[4],
(unsigned)File.FunctionCoverage.NumFunctions);
+ OS << format("%*u", FileReportColumns[5],
+ (unsigned)(File.FunctionCoverage.NumFunctions -
+ File.FunctionCoverage.Executed));
Options.colored_ostream(
OS, determineCoveragePercentageColor(File.FunctionCoverage))
- << format("%*.2f", FileReportColumns[5] - 1,
+ << format("%*.2f", FileReportColumns[6] - 1,
File.FunctionCoverage.getPercentCovered()) << '%';
+ OS << format("%*u", FileReportColumns[7],
+ (unsigned)File.LineCoverage.NumLines);
+ Options.colored_ostream(OS, File.LineCoverage.isFullyCovered()
+ ? raw_ostream::GREEN
+ : raw_ostream::RED)
+ << format("%*u", FileReportColumns[8],
+ (unsigned)File.LineCoverage.NotCovered);
+ Options.colored_ostream(OS,
+ determineCoveragePercentageColor(File.LineCoverage))
+ << format("%*.2f", FileReportColumns[9] - 1,
+ File.LineCoverage.getPercentCovered()) << '%';
OS << "\n";
}
@@ -211,10 +226,15 @@ void CoverageReport::renderFileReports(r
adjustColumnWidths(Coverage.get());
OS << column("Filename", FileReportColumns[0])
<< column("Regions", FileReportColumns[1], Column::RightAlignment)
- << column("Miss", FileReportColumns[2], Column::RightAlignment)
+ << column("Missed Regions", FileReportColumns[2], Column::RightAlignment)
<< column("Cover", FileReportColumns[3], Column::RightAlignment)
<< column("Functions", FileReportColumns[4], Column::RightAlignment)
- << column("Executed", FileReportColumns[5], Column::RightAlignment)
+ << column("Missed Functions", FileReportColumns[5],
+ Column::RightAlignment)
+ << column("Executed", FileReportColumns[6], Column::RightAlignment)
+ << column("Lines", FileReportColumns[7], Column::RightAlignment)
+ << column("Missed Lines", FileReportColumns[8], Column::RightAlignment)
+ << column("Cover", FileReportColumns[9], Column::RightAlignment)
<< "\n";
renderDivider(FileReportColumns, OS);
OS << "\n";
More information about the llvm-commits
mailing list