diff options
-rw-r--r-- | llvm/test/tools/llvm-cov/showProjectSummary.cpp | 11 | ||||
-rw-r--r-- | llvm/tools/llvm-cov/SourceCoverageView.cpp | 9 | ||||
-rw-r--r-- | llvm/tools/llvm-cov/SourceCoverageView.h | 8 | ||||
-rw-r--r-- | llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp | 29 | ||||
-rw-r--r-- | llvm/tools/llvm-cov/SourceCoverageViewHTML.h | 6 | ||||
-rw-r--r-- | llvm/tools/llvm-cov/SourceCoverageViewText.cpp | 6 | ||||
-rw-r--r-- | llvm/tools/llvm-cov/SourceCoverageViewText.h | 6 |
7 files changed, 36 insertions, 39 deletions
diff --git a/llvm/test/tools/llvm-cov/showProjectSummary.cpp b/llvm/test/tools/llvm-cov/showProjectSummary.cpp index 99393880f8f..bc559370ddb 100644 --- a/llvm/test/tools/llvm-cov/showProjectSummary.cpp +++ b/llvm/test/tools/llvm-cov/showProjectSummary.cpp @@ -24,9 +24,9 @@ int main(int argc, char ** argv) { // 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,HTML-UNCOVEREDLINE -input-file %t.dir/coverage/tmp/showProjectSummary.cpp.html %s +// RUN: FileCheck -check-prefixes=HTML,HTML-FILE,HTML-HEADER -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,HTML-UNCOVEREDLINE -input-file %t.dir/coverage/tmp/showProjectSummary.cpp.html %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 -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 @@ -35,7 +35,6 @@ int main(int argc, char ** argv) { // HTML: <h4>Created:{{.*}}</h4> // HTML-FILE: <pre>{{.*}}showProjectSummary.cpp (Binary: showProjectSummary.covmapping)</pre> // HTML-FUNCTION: <pre>main</pre> -// HTML-UNCOVEREDLINE: <a href='#L8'>Go to first unexecuted line</a> -// HTML-HEADER: <tr><td><span><pre>Line No.</pre></span></td> -// HTML-HEADER: <td><span><pre>Count</pre></span></td> -// HTML-HEADER: <td><span><pre>Source</pre></span></td> +// HTML-HEADER: <td><pre>Line No.</pre></td> +// HTML-HEADER: <td><pre>Count</pre></td> +// HTML-HEADER: <td><pre>Source (<a href='#L8'>jump to first uncovered line</a>)</pre></td> diff --git a/llvm/tools/llvm-cov/SourceCoverageView.cpp b/llvm/tools/llvm-cov/SourceCoverageView.cpp index 23c86e32dcc..362f48be258 100644 --- a/llvm/tools/llvm-cov/SourceCoverageView.cpp +++ b/llvm/tools/llvm-cov/SourceCoverageView.cpp @@ -173,14 +173,11 @@ void SourceCoverageView::print(raw_ostream &OS, bool WholeFile, renderViewHeader(OS); - unsigned FirstUncoveredLineNo = 0; - if (WholeFile) - FirstUncoveredLineNo = getFirstUncoveredLineNo(); - if (ShowSourceName) - renderSourceName(OS, WholeFile, FirstUncoveredLineNo); + renderSourceName(OS, WholeFile); + + renderTableHeader(OS, getFirstUncoveredLineNo(), ViewDepth); - renderTableHeader(OS, ViewDepth); // We need the expansions and instantiations sorted so we can go through them // while we iterate lines. std::sort(ExpansionSubViews.begin(), ExpansionSubViews.end()); diff --git a/llvm/tools/llvm-cov/SourceCoverageView.h b/llvm/tools/llvm-cov/SourceCoverageView.h index b1bbff8e804..68e8251e9b8 100644 --- a/llvm/tools/llvm-cov/SourceCoverageView.h +++ b/llvm/tools/llvm-cov/SourceCoverageView.h @@ -196,8 +196,7 @@ protected: virtual void renderViewFooter(raw_ostream &OS) = 0; /// \brief Render the source name for the view. - virtual void renderSourceName(raw_ostream &OS, bool WholeFile, - unsigned FirstUncoveredLineNo) = 0; + virtual void renderSourceName(raw_ostream &OS, bool WholeFile) = 0; /// \brief Render the line prefix at the given \p ViewDepth. virtual void renderLinePrefix(raw_ostream &OS, unsigned ViewDepth) = 0; @@ -245,8 +244,9 @@ protected: /// created time for the view. virtual void renderCellInTitle(raw_ostream &OS, StringRef CellText) = 0; - /// \brief Render the table header for a given source file - virtual void renderTableHeader(raw_ostream &OS, unsigned IndentLevel = 0) = 0; + /// \brief Render the table header for a given source file. + virtual void renderTableHeader(raw_ostream &OS, unsigned FirstUncoveredLineNo, + unsigned IndentLevel) = 0; /// @} diff --git a/llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp b/llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp index 8bb51590fde..cfa3078a8b3 100644 --- a/llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp +++ b/llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp @@ -395,21 +395,11 @@ void SourceCoverageViewHTML::renderViewFooter(raw_ostream &OS) { OS << EndTable << EndCenteredDiv; } -void SourceCoverageViewHTML::renderSourceName(raw_ostream &OS, bool WholeFile, - unsigned FirstUncoveredLineNo) { +void SourceCoverageViewHTML::renderSourceName(raw_ostream &OS, bool WholeFile) { OS << BeginSourceNameDiv; std::string ViewInfo = escape( WholeFile ? getVerboseSourceName() : getSourceName(), getOptions()); OS << tag("pre", ViewInfo); - if (WholeFile) { - // Render the "Go to first unexecuted line" link for the view. - if (FirstUncoveredLineNo != 0) { // The file is not fully covered - std::string LinkText = - escape("Go to first unexecuted line", getOptions()); - std::string LinkTarget = "#L" + utostr(uint64_t(FirstUncoveredLineNo)); - OS << tag("pre", a(LinkTarget, LinkText)); - } - } OS << EndSourceNameDiv; } @@ -608,10 +598,21 @@ void SourceCoverageViewHTML::renderCellInTitle(raw_ostream &OS, } void SourceCoverageViewHTML::renderTableHeader(raw_ostream &OS, + unsigned FirstUncoveredLineNo, unsigned ViewDepth) { + std::string SourceLabel; + if (FirstUncoveredLineNo == 0) { + SourceLabel = tag("td", tag("pre", "Source")); + } else { + std::string LinkTarget = "#L" + utostr(uint64_t(FirstUncoveredLineNo)); + SourceLabel = + tag("td", tag("pre", "Source (" + + a(LinkTarget, "jump to first uncovered line") + + ")")); + } + renderLinePrefix(OS, ViewDepth); - OS << tag("td", tag("span", tag("pre", escape("Line No.", getOptions())))) - << tag("td", tag("span", tag("pre", escape("Count", getOptions())))) - << tag("td", tag("span", tag("pre", escape("Source", getOptions())))); + OS << tag("td", tag("pre", "Line No.")) << tag("td", tag("pre", "Count")) + << SourceLabel; renderLineSuffix(OS, ViewDepth); } diff --git a/llvm/tools/llvm-cov/SourceCoverageViewHTML.h b/llvm/tools/llvm-cov/SourceCoverageViewHTML.h index bcf2793666e..b97c1802af8 100644 --- a/llvm/tools/llvm-cov/SourceCoverageViewHTML.h +++ b/llvm/tools/llvm-cov/SourceCoverageViewHTML.h @@ -46,8 +46,7 @@ class SourceCoverageViewHTML : public SourceCoverageView { void renderViewFooter(raw_ostream &OS) override; - void renderSourceName(raw_ostream &OS, bool WholeFile, - unsigned FirstUncoveredLineNo) override; + void renderSourceName(raw_ostream &OS, bool WholeFile) override; void renderLinePrefix(raw_ostream &OS, unsigned ViewDepth) override; @@ -81,7 +80,8 @@ class SourceCoverageViewHTML : public SourceCoverageView { void renderCellInTitle(raw_ostream &OS, StringRef CellText) override; - void renderTableHeader(raw_ostream &OS, unsigned IndentLevel) override; + void renderTableHeader(raw_ostream &OS, unsigned FirstUncoveredLineNo, + unsigned IndentLevel) override; public: SourceCoverageViewHTML(StringRef SourceName, const MemoryBuffer &File, diff --git a/llvm/tools/llvm-cov/SourceCoverageViewText.cpp b/llvm/tools/llvm-cov/SourceCoverageViewText.cpp index b0676cad7b9..3d3045ed0b6 100644 --- a/llvm/tools/llvm-cov/SourceCoverageViewText.cpp +++ b/llvm/tools/llvm-cov/SourceCoverageViewText.cpp @@ -66,8 +66,7 @@ void SourceCoverageViewText::renderViewHeader(raw_ostream &) {} void SourceCoverageViewText::renderViewFooter(raw_ostream &) {} -void SourceCoverageViewText::renderSourceName(raw_ostream &OS, bool WholeFile, - unsigned FirstUncoveredLineNo) { +void SourceCoverageViewText::renderSourceName(raw_ostream &OS, bool WholeFile) { std::string ViewInfo = WholeFile ? getVerboseSourceName() : getSourceName(); getOptions().colored_ostream(OS, raw_ostream::CYAN) << ViewInfo << ":\n"; } @@ -229,4 +228,5 @@ void SourceCoverageViewText::renderCellInTitle(raw_ostream &OS, << getOptions().CreatedTimeStr << "\n"; } -void SourceCoverageViewText::renderTableHeader(raw_ostream &, unsigned) {} +void SourceCoverageViewText::renderTableHeader(raw_ostream &, unsigned, + unsigned) {} diff --git a/llvm/tools/llvm-cov/SourceCoverageViewText.h b/llvm/tools/llvm-cov/SourceCoverageViewText.h index 6fd35f5f286..7fdeef50ea2 100644 --- a/llvm/tools/llvm-cov/SourceCoverageViewText.h +++ b/llvm/tools/llvm-cov/SourceCoverageViewText.h @@ -39,8 +39,7 @@ class SourceCoverageViewText : public SourceCoverageView { void renderViewFooter(raw_ostream &OS) override; - void renderSourceName(raw_ostream &OS, bool WholeFile, - unsigned FirstUncoveredLineNo) override; + void renderSourceName(raw_ostream &OS, bool WholeFile) override; void renderLinePrefix(raw_ostream &OS, unsigned ViewDepth) override; @@ -74,7 +73,8 @@ class SourceCoverageViewText : public SourceCoverageView { void renderCellInTitle(raw_ostream &OS, StringRef CellText) override; - void renderTableHeader(raw_ostream &OS, unsigned IndentLevel) override; + void renderTableHeader(raw_ostream &OS, unsigned FirstUncoveredLineNo, + unsigned IndentLevel) override; public: SourceCoverageViewText(StringRef SourceName, const MemoryBuffer &File, |