1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-18 18:42:46 +02:00

[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.

llvm-svn: 281146
This commit is contained in:
Vedant Kumar 2016-09-10 19:37:26 +00:00
parent af0bdcc9ae
commit 4bbe59f1bf
7 changed files with 36 additions and 39 deletions

View File

@ -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>

View File

@ -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());

View File

@ -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;
/// @}

View File

@ -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);
}

View File

@ -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,

View File

@ -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) {}

View File

@ -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,