Index: test/tools/llvm-cov/showProjectSummary.cpp
===================================================================
--- test/tools/llvm-cov/showProjectSummary.cpp
+++ test/tools/llvm-cov/showProjectSummary.cpp
@@ -24,9 +24,9 @@
// Test html output.
// RUN: llvm-cov show %S/Inputs/showProjectSummary.covmapping -format=html -o %t.dir -instr-profile %t.profdata -filename-equivalence %s
-// RUN: FileCheck -check-prefixes=HTML,HTML-FILE,HTML-HEADER -input-file %t.dir/coverage/tmp/showProjectSummary.cpp.html %s
+// RUN: FileCheck -check-prefixes=HTML,HTML-FILE,HTML-HEADER,HTML-ZERO,HTML-JS -input-file %t.dir/coverage/tmp/showProjectSummary.cpp.html %s
// RUN: llvm-cov show %S/Inputs/showProjectSummary.covmapping -format=html -o %t.dir -instr-profile %t.profdata -project-title "Test Suite" -filename-equivalence %s
-// RUN: FileCheck -check-prefixes=HTML-TITLE,HTML,HTML-FILE,HTML-HEADER -input-file %t.dir/coverage/tmp/showProjectSummary.cpp.html %s
+// RUN: FileCheck -check-prefixes=HTML-TITLE,HTML,HTML-FILE,HTML-HEADER,HTML-ZERO,HTML-JS -input-file %t.dir/coverage/tmp/showProjectSummary.cpp.html %s
// RUN: FileCheck -check-prefixes=HTML-TITLE,HTML -input-file %t.dir/index.html %s
// RUN: llvm-cov show %S/Inputs/showProjectSummary.covmapping -format=html -o %t.dir -instr-profile %t.profdata -project-title "Test Suite" -filename-equivalence -name=main %s
// RUN: FileCheck -check-prefixes=HTML-FUNCTION,HTML-HEADER -input-file %t.dir/functions.html %s
@@ -41,6 +41,10 @@
// HTML-FILE:
Binary:
// HTML-FILE: showProjectSummary.covmapping
// HTML-FUNCTION: Function: main
+// HTML-ZERO: Goto first zero count
// HTML-HEADER: Line No. |
// HTML-HEADER: Count No. |
// HTML-HEADER: Source |
+// HTML-ZERO:
+// HTML-JS-NOT: ";
+
+const char *JSDisableLink = R"(
+function disableLink(link) {
+ link.disabled = true;
+ link.removeAttribute('href');
+}
+)";
+
+const char *JSRemoveZeroLink = R"(
+var zeroLink = document.getElementById("zeroline");
+disableLink(zeroLink);
+)";
+
std::string getPathToStyle(StringRef ViewPath) {
std::string PathToStyle = "";
std::string PathSep = sys::path::get_separator();
@@ -331,8 +347,11 @@
OS << LineBreak << BeginCenteredDiv << BeginTable;
}
-void SourceCoverageViewHTML::renderViewFooter(raw_ostream &OS) {
+void SourceCoverageViewHTML::renderViewFooter(raw_ostream &OS,
+ bool RenderJavaScript) {
OS << EndTable << EndCenteredDiv;
+ if (RenderJavaScript)
+ OS << BeginJavaScript << JSDisableLink << JSRemoveZeroLink << EndJavaScript;
}
void SourceCoverageViewHTML::renderSourceName(raw_ostream &OS, bool WholeFile) {
@@ -341,15 +360,21 @@
std::string SourceFile = isFunctionView() ? "Function: " : "Source: ";
SourceFile += getSourceName().str();
OS << tag("pre", escape(SourceFile, getOptions()));
- // Render the object file name for the view.
- if (WholeFile)
+
+ if (WholeFile) {
+ // Render the object file name for the view.
OS << tag("pre",
escape("Binary: " + getOptions().ObjectFilename, getOptions()));
+ // Render the "Goto First Zero Count" link for the view
+ OS << tag("pre",
+ "Goto first zero count");
+ }
OS << EndSourceNameDiv;
}
-void SourceCoverageViewHTML::renderLinePrefix(raw_ostream &OS, unsigned) {
- OS << "
";
+void SourceCoverageViewHTML::renderLinePrefix(raw_ostream &OS, unsigned,
+ bool IsFirstZeroLine = false) {
+ OS << (IsFirstZeroLine ? "
" : "
");
}
void SourceCoverageViewHTML::renderLineSuffix(raw_ostream &OS, unsigned) {
Index: tools/llvm-cov/SourceCoverageViewText.h
===================================================================
--- tools/llvm-cov/SourceCoverageViewText.h
+++ tools/llvm-cov/SourceCoverageViewText.h
@@ -36,11 +36,11 @@
class SourceCoverageViewText : public SourceCoverageView {
void renderViewHeader(raw_ostream &OS) override;
- void renderViewFooter(raw_ostream &OS) override;
+ void renderViewFooter(raw_ostream &OS, bool RenderJavaScript) override;
void renderSourceName(raw_ostream &OS, bool WholeFile) override;
- void renderLinePrefix(raw_ostream &OS, unsigned ViewDepth) override;
+ void renderLinePrefix(raw_ostream &OS, unsigned ViewDepth, bool IsFirstZeroLine) override;
void renderLineSuffix(raw_ostream &OS, unsigned ViewDepth) override;
Index: tools/llvm-cov/SourceCoverageViewText.cpp
===================================================================
--- tools/llvm-cov/SourceCoverageViewText.cpp
+++ tools/llvm-cov/SourceCoverageViewText.cpp
@@ -61,7 +61,7 @@
void SourceCoverageViewText::renderViewHeader(raw_ostream &) {}
-void SourceCoverageViewText::renderViewFooter(raw_ostream &) {}
+void SourceCoverageViewText::renderViewFooter(raw_ostream &, bool) {}
void SourceCoverageViewText::renderSourceName(raw_ostream &OS, bool WholeFile) {
getOptions().colored_ostream(OS, raw_ostream::CYAN) << getSourceName()
@@ -73,7 +73,8 @@
}
void SourceCoverageViewText::renderLinePrefix(raw_ostream &OS,
- unsigned ViewDepth) {
+ unsigned ViewDepth,
+ bool IsFirstZeroLine = false) {
for (unsigned I = 0; I < ViewDepth; ++I)
OS << " |";
}