[llvm] [llvm-cov] format cells in code coverage report with 0/0 branches/functions/lines differently (PR #75780)
Hana Dusíková via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 18 16:47:38 PST 2023
https://github.com/hanickadot updated https://github.com/llvm/llvm-project/pull/75780
>From efc86dbfa2a1623a4a984e2008f5c898ffb7f458 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Hana=20Dusi=CC=81kova=CC=81?= <hanicka at hanicka.net>
Date: Mon, 18 Dec 2023 11:11:15 +0100
Subject: [PATCH] [llvm-cov] format cells in report with 0/0
branches/functions/lines differenly (gray instead red) and make the table a
bit nicer
---
.../tools/llvm-cov/SourceCoverageViewHTML.cpp | 24 +++++++++++++++----
1 file changed, 20 insertions(+), 4 deletions(-)
diff --git a/llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp b/llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp
index b43e9e64231e0c..e1aa5e4a05af78 100644
--- a/llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp
+++ b/llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp
@@ -130,10 +130,14 @@ table {
.light-row {
background: #ffffff;
border: 1px solid #dbdbdb;
+ border-left: none;
+ border-right: none;
}
.light-row-bold {
background: #ffffff;
border: 1px solid #dbdbdb;
+ border-left: none;
+ border-right: none;
font-weight: bold;
}
.column-entry {
@@ -147,21 +151,28 @@ table {
text-align: left;
background-color: #ffffd0;
}
-.column-entry-yellow:hover {
+.column-entry-yellow:hover, tr:hover .column-entry-yellow {
background-color: #fffff0;
}
.column-entry-red {
text-align: left;
background-color: #ffd0d0;
}
-.column-entry-red:hover {
+.column-entry-red:hover, tr:hover .column-entry-red {
background-color: #fff0f0;
}
+.column-entry-gray {
+ text-align: left;
+ background-color: #fbfbfb;
+}
+.column-entry-gray:hover, tr:hover .column-entry-gray {
+ background-color: #f0f0f0;
+}
.column-entry-green {
text-align: left;
background-color: #d0ffd0;
}
-.column-entry-green:hover {
+.column-entry-green:hover, tr:hover .column-entry-green {
background-color: #f0fff0;
}
.line-number {
@@ -232,6 +243,9 @@ td:last-child {
tr:hover {
background-color: #f0f0f0;
}
+tr:last-child {
+ border-bottom: none;
+}
)";
const char *EndHeader = "</head>";
@@ -309,7 +323,9 @@ void emitTableRow(raw_ostream &OS, const CoverageViewOptions &Opts,
RSO << '(' << Hit << '/' << Total << ')';
}
const char *CellClass = "column-entry-yellow";
- if (Pctg >= Opts.HighCovWatermark)
+ if (!Total) {
+ CellClass = "column-entry-gray";
+ } else if (Pctg >= Opts.HighCovWatermark)
CellClass = "column-entry-green";
else if (Pctg < Opts.LowCovWatermark)
CellClass = "column-entry-red";
More information about the llvm-commits
mailing list