[PATCH] D22569: [LLVM-COV] Add the coverage of lines in the summary report.
Ying Yi via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 21 07:13:49 PDT 2016
MaggieYi updated this revision to Diff 64881.
MaggieYi added a comment.
Thanks Vedant. I have updated the patch following your comments.
https://reviews.llvm.org/D22569
Files:
test/tools/llvm-cov/prevent_false_instantiations.h
test/tools/llvm-cov/report.cpp
tools/llvm-cov/CoverageReport.cpp
Index: tools/llvm-cov/CoverageReport.cpp
===================================================================
--- tools/llvm-cov/CoverageReport.cpp
+++ tools/llvm-cov/CoverageReport.cpp
@@ -88,7 +88,8 @@
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 @@
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 @@
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";
Index: test/tools/llvm-cov/report.cpp
===================================================================
--- test/tools/llvm-cov/report.cpp
+++ test/tools/llvm-cov/report.cpp
@@ -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
Index: test/tools/llvm-cov/prevent_false_instantiations.h
===================================================================
--- test/tools/llvm-cov/prevent_false_instantiations.h
+++ test/tools/llvm-cov/prevent_false_instantiations.h
@@ -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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22569.64881.patch
Type: text/x-patch
Size: 4854 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160721/b02b2290/attachment.bin>
More information about the llvm-commits
mailing list