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:
parent
af0bdcc9ae
commit
4bbe59f1bf
@ -24,9 +24,9 @@ int main(int argc, char ** argv) {
|
|||||||
|
|
||||||
// Test html output.
|
// Test html output.
|
||||||
// RUN: llvm-cov show %S/Inputs/showProjectSummary.covmapping -format=html -o %t.dir -instr-profile %t.profdata -filename-equivalence %s
|
// 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: 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: 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: 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
|
// 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: <h4>Created:{{.*}}</h4>
|
||||||
// HTML-FILE: <pre>{{.*}}showProjectSummary.cpp (Binary: showProjectSummary.covmapping)</pre>
|
// HTML-FILE: <pre>{{.*}}showProjectSummary.cpp (Binary: showProjectSummary.covmapping)</pre>
|
||||||
// HTML-FUNCTION: <pre>main</pre>
|
// HTML-FUNCTION: <pre>main</pre>
|
||||||
// HTML-UNCOVEREDLINE: <a href='#L8'>Go to first unexecuted line</a>
|
// HTML-HEADER: <td><pre>Line No.</pre></td>
|
||||||
// HTML-HEADER: <tr><td><span><pre>Line No.</pre></span></td>
|
// HTML-HEADER: <td><pre>Count</pre></td>
|
||||||
// HTML-HEADER: <td><span><pre>Count</pre></span></td>
|
// HTML-HEADER: <td><pre>Source (<a href='#L8'>jump to first uncovered line</a>)</pre></td>
|
||||||
// HTML-HEADER: <td><span><pre>Source</pre></span></td>
|
|
||||||
|
@ -173,14 +173,11 @@ void SourceCoverageView::print(raw_ostream &OS, bool WholeFile,
|
|||||||
|
|
||||||
renderViewHeader(OS);
|
renderViewHeader(OS);
|
||||||
|
|
||||||
unsigned FirstUncoveredLineNo = 0;
|
|
||||||
if (WholeFile)
|
|
||||||
FirstUncoveredLineNo = getFirstUncoveredLineNo();
|
|
||||||
|
|
||||||
if (ShowSourceName)
|
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
|
// We need the expansions and instantiations sorted so we can go through them
|
||||||
// while we iterate lines.
|
// while we iterate lines.
|
||||||
std::sort(ExpansionSubViews.begin(), ExpansionSubViews.end());
|
std::sort(ExpansionSubViews.begin(), ExpansionSubViews.end());
|
||||||
|
@ -196,8 +196,7 @@ protected:
|
|||||||
virtual void renderViewFooter(raw_ostream &OS) = 0;
|
virtual void renderViewFooter(raw_ostream &OS) = 0;
|
||||||
|
|
||||||
/// \brief Render the source name for the view.
|
/// \brief Render the source name for the view.
|
||||||
virtual void renderSourceName(raw_ostream &OS, bool WholeFile,
|
virtual void renderSourceName(raw_ostream &OS, bool WholeFile) = 0;
|
||||||
unsigned FirstUncoveredLineNo) = 0;
|
|
||||||
|
|
||||||
/// \brief Render the line prefix at the given \p ViewDepth.
|
/// \brief Render the line prefix at the given \p ViewDepth.
|
||||||
virtual void renderLinePrefix(raw_ostream &OS, unsigned ViewDepth) = 0;
|
virtual void renderLinePrefix(raw_ostream &OS, unsigned ViewDepth) = 0;
|
||||||
@ -245,8 +244,9 @@ protected:
|
|||||||
/// created time for the view.
|
/// created time for the view.
|
||||||
virtual void renderCellInTitle(raw_ostream &OS, StringRef CellText) = 0;
|
virtual void renderCellInTitle(raw_ostream &OS, StringRef CellText) = 0;
|
||||||
|
|
||||||
/// \brief Render the table header for a given source file
|
/// \brief Render the table header for a given source file.
|
||||||
virtual void renderTableHeader(raw_ostream &OS, unsigned IndentLevel = 0) = 0;
|
virtual void renderTableHeader(raw_ostream &OS, unsigned FirstUncoveredLineNo,
|
||||||
|
unsigned IndentLevel) = 0;
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
|
@ -395,21 +395,11 @@ void SourceCoverageViewHTML::renderViewFooter(raw_ostream &OS) {
|
|||||||
OS << EndTable << EndCenteredDiv;
|
OS << EndTable << EndCenteredDiv;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SourceCoverageViewHTML::renderSourceName(raw_ostream &OS, bool WholeFile,
|
void SourceCoverageViewHTML::renderSourceName(raw_ostream &OS, bool WholeFile) {
|
||||||
unsigned FirstUncoveredLineNo) {
|
|
||||||
OS << BeginSourceNameDiv;
|
OS << BeginSourceNameDiv;
|
||||||
std::string ViewInfo = escape(
|
std::string ViewInfo = escape(
|
||||||
WholeFile ? getVerboseSourceName() : getSourceName(), getOptions());
|
WholeFile ? getVerboseSourceName() : getSourceName(), getOptions());
|
||||||
OS << tag("pre", ViewInfo);
|
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;
|
OS << EndSourceNameDiv;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -608,10 +598,21 @@ void SourceCoverageViewHTML::renderCellInTitle(raw_ostream &OS,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SourceCoverageViewHTML::renderTableHeader(raw_ostream &OS,
|
void SourceCoverageViewHTML::renderTableHeader(raw_ostream &OS,
|
||||||
|
unsigned FirstUncoveredLineNo,
|
||||||
unsigned ViewDepth) {
|
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);
|
renderLinePrefix(OS, ViewDepth);
|
||||||
OS << tag("td", tag("span", tag("pre", escape("Line No.", getOptions()))))
|
OS << tag("td", tag("pre", "Line No.")) << tag("td", tag("pre", "Count"))
|
||||||
<< tag("td", tag("span", tag("pre", escape("Count", getOptions()))))
|
<< SourceLabel;
|
||||||
<< tag("td", tag("span", tag("pre", escape("Source", getOptions()))));
|
|
||||||
renderLineSuffix(OS, ViewDepth);
|
renderLineSuffix(OS, ViewDepth);
|
||||||
}
|
}
|
||||||
|
@ -46,8 +46,7 @@ class SourceCoverageViewHTML : public SourceCoverageView {
|
|||||||
|
|
||||||
void renderViewFooter(raw_ostream &OS) override;
|
void renderViewFooter(raw_ostream &OS) override;
|
||||||
|
|
||||||
void renderSourceName(raw_ostream &OS, bool WholeFile,
|
void renderSourceName(raw_ostream &OS, bool WholeFile) override;
|
||||||
unsigned FirstUncoveredLineNo) override;
|
|
||||||
|
|
||||||
void renderLinePrefix(raw_ostream &OS, unsigned ViewDepth) 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 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:
|
public:
|
||||||
SourceCoverageViewHTML(StringRef SourceName, const MemoryBuffer &File,
|
SourceCoverageViewHTML(StringRef SourceName, const MemoryBuffer &File,
|
||||||
|
@ -66,8 +66,7 @@ void SourceCoverageViewText::renderViewHeader(raw_ostream &) {}
|
|||||||
|
|
||||||
void SourceCoverageViewText::renderViewFooter(raw_ostream &) {}
|
void SourceCoverageViewText::renderViewFooter(raw_ostream &) {}
|
||||||
|
|
||||||
void SourceCoverageViewText::renderSourceName(raw_ostream &OS, bool WholeFile,
|
void SourceCoverageViewText::renderSourceName(raw_ostream &OS, bool WholeFile) {
|
||||||
unsigned FirstUncoveredLineNo) {
|
|
||||||
std::string ViewInfo = WholeFile ? getVerboseSourceName() : getSourceName();
|
std::string ViewInfo = WholeFile ? getVerboseSourceName() : getSourceName();
|
||||||
getOptions().colored_ostream(OS, raw_ostream::CYAN) << ViewInfo << ":\n";
|
getOptions().colored_ostream(OS, raw_ostream::CYAN) << ViewInfo << ":\n";
|
||||||
}
|
}
|
||||||
@ -229,4 +228,5 @@ void SourceCoverageViewText::renderCellInTitle(raw_ostream &OS,
|
|||||||
<< getOptions().CreatedTimeStr << "\n";
|
<< getOptions().CreatedTimeStr << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
void SourceCoverageViewText::renderTableHeader(raw_ostream &, unsigned) {}
|
void SourceCoverageViewText::renderTableHeader(raw_ostream &, unsigned,
|
||||||
|
unsigned) {}
|
||||||
|
@ -39,8 +39,7 @@ class SourceCoverageViewText : public SourceCoverageView {
|
|||||||
|
|
||||||
void renderViewFooter(raw_ostream &OS) override;
|
void renderViewFooter(raw_ostream &OS) override;
|
||||||
|
|
||||||
void renderSourceName(raw_ostream &OS, bool WholeFile,
|
void renderSourceName(raw_ostream &OS, bool WholeFile) override;
|
||||||
unsigned FirstUncoveredLineNo) override;
|
|
||||||
|
|
||||||
void renderLinePrefix(raw_ostream &OS, unsigned ViewDepth) 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 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:
|
public:
|
||||||
SourceCoverageViewText(StringRef SourceName, const MemoryBuffer &File,
|
SourceCoverageViewText(StringRef SourceName, const MemoryBuffer &File,
|
||||||
|
Loading…
Reference in New Issue
Block a user