Skip to content

Commit

Permalink
[llvm-cov] Don't create 'jump to ...' links in nested views
Browse files Browse the repository at this point in the history
Doing so is pointless, since the whole view is usually visible in a
small amount of space.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281588 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
vedantk committed Sep 15, 2016
1 parent 0bcb8fb commit 2fcbfcf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions test/tools/llvm-cov/showTemplateInstantiations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,7 @@ int main() { // ALL: [[@LINE]]| 1|int main() {

// HTML-ALL: <td class='line-number'><a name='L[[@LINE-45]]'><pre>[[@LINE-45]]</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// after
// HTML-FILTER-NOT: <td class='line-number'><a name='L[[@LINE-46]]'><pre>[[@LINE-46]]</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// after

// RUN: FileCheck -check-prefix=HTML-JUMP -input-file=%t.html.dir/coverage/tmp/showTemplateInstantiations.cpp.html %s
// HTML-JUMP: <pre>Source (<a href='#L{{[0-9]+}}'>jump to first uncovered line</a>)</pre>
// HTML-JUMP-NOT: <pre>Source (<a href='#L{{[0-9]+}}'>jump to first uncovered line</a>)</pre>
2 changes: 1 addition & 1 deletion tools/llvm-cov/SourceCoverageViewHTML.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ void SourceCoverageViewHTML::renderTableHeader(raw_ostream &OS,
unsigned FirstUncoveredLineNo,
unsigned ViewDepth) {
std::string SourceLabel;
if (FirstUncoveredLineNo == 0) {
if (FirstUncoveredLineNo == 0 || ViewDepth > 0) {
SourceLabel = tag("td", tag("pre", "Source"));
} else {
std::string LinkTarget = "#L" + utostr(uint64_t(FirstUncoveredLineNo));
Expand Down

0 comments on commit 2fcbfcf

Please sign in to comment.