[llvm] r281146 - [llvm-cov] Move the 'jump to first unexecuted line' link
Vedant Kumar via llvm-commits
llvm-commits at lists.llvm.org
Sat Sep 10 12:37:26 PDT 2016
Author: vedantk
Date: Sat Sep 10 14:37:26 2016
New Revision: 281146
URL: http://llvm.org/viewvc/llvm-project?rev=281146&view=rev
Log:
[llvm-cov] Move the 'jump to first unexecuted line' link
Having it in the same row as the source name is jarring. Move it next to
the "Source" column label.
Modified:
llvm/trunk/test/tools/llvm-cov/showProjectSummary.cpp
llvm/trunk/tools/llvm-cov/SourceCoverageView.cpp
llvm/trunk/tools/llvm-cov/SourceCoverageView.h
llvm/trunk/tools/llvm-cov/SourceCoverageViewHTML.cpp
llvm/trunk/tools/llvm-cov/SourceCoverageViewHTML.h
llvm/trunk/tools/llvm-cov/SourceCoverageViewText.cpp
llvm/trunk/tools/llvm-cov/SourceCoverageViewText.h
Modified: llvm/trunk/test/tools/llvm-cov/showProjectSummary.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-cov/showProjectSummary.cpp?rev=281146&r1=281145&r2=281146&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-cov/showProjectSummary.cpp (original)
+++ llvm/trunk/test/tools/llvm-cov/showProjectSummary.cpp Sat Sep 10 14:37:26 2016
@@ -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>
Modified: llvm/trunk/tools/llvm-cov/SourceCoverageView.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-cov/SourceCoverageView.cpp?rev=281146&r1=281145&r2=281146&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-cov/SourceCoverageView.cpp (original)
+++ llvm/trunk/tools/llvm-cov/SourceCoverageView.cpp Sat Sep 10 14:37:26 2016
@@ -173,14 +173,11 @@ void SourceCoverageView::print(raw_ostre
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());
Modified: llvm/trunk/tools/llvm-cov/SourceCoverageView.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-cov/SourceCoverageView.h?rev=281146&r1=281145&r2=281146&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-cov/SourceCoverageView.h (original)
+++ llvm/trunk/tools/llvm-cov/SourceCoverageView.h Sat Sep 10 14:37:26 2016
@@ -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;
/// @}
Modified: llvm/trunk/tools/llvm-cov/SourceCoverageViewHTML.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-cov/SourceCoverageViewHTML.cpp?rev=281146&r1=281145&r2=281146&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-cov/SourceCoverageViewHTML.cpp (original)
+++ llvm/trunk/tools/llvm-cov/SourceCoverageViewHTML.cpp Sat Sep 10 14:37:26 2016
@@ -395,21 +395,11 @@ void SourceCoverageViewHTML::renderViewF
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::renderCellI
}
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);
}
Modified: llvm/trunk/tools/llvm-cov/SourceCoverageViewHTML.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-cov/SourceCoverageViewHTML.h?rev=281146&r1=281145&r2=281146&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-cov/SourceCoverageViewHTML.h (original)
+++ llvm/trunk/tools/llvm-cov/SourceCoverageViewHTML.h Sat Sep 10 14:37:26 2016
@@ -46,8 +46,7 @@ class SourceCoverageViewHTML : public So
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 So
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,
Modified: llvm/trunk/tools/llvm-cov/SourceCoverageViewText.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-cov/SourceCoverageViewText.cpp?rev=281146&r1=281145&r2=281146&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-cov/SourceCoverageViewText.cpp (original)
+++ llvm/trunk/tools/llvm-cov/SourceCoverageViewText.cpp Sat Sep 10 14:37:26 2016
@@ -66,8 +66,7 @@ void SourceCoverageViewText::renderViewH
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::renderCellI
<< getOptions().CreatedTimeStr << "\n";
}
-void SourceCoverageViewText::renderTableHeader(raw_ostream &, unsigned) {}
+void SourceCoverageViewText::renderTableHeader(raw_ostream &, unsigned,
+ unsigned) {}
Modified: llvm/trunk/tools/llvm-cov/SourceCoverageViewText.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-cov/SourceCoverageViewText.h?rev=281146&r1=281145&r2=281146&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-cov/SourceCoverageViewText.h (original)
+++ llvm/trunk/tools/llvm-cov/SourceCoverageViewText.h Sat Sep 10 14:37:26 2016
@@ -39,8 +39,7 @@ class SourceCoverageViewText : public So
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 So
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,
More information about the llvm-commits
mailing list