Skip to content

Commit

Permalink
[llvm-cov] Swapped the line and count columns.
Browse files Browse the repository at this point in the history
In the coverage report, the line and count columns have been swapped to make it more readable.
A follow-up commit in compiler-rt is needed

Differential Revision: https://reviews.llvm.org/D23281

llvm-svn: 278152
  • Loading branch information
MaggieYingYi committed Aug 9, 2016
1 parent 2c17e82 commit 6b1f5f8
Show file tree
Hide file tree
Showing 8 changed files with 142 additions and 142 deletions.
16 changes: 8 additions & 8 deletions llvm/test/tools/llvm-cov/Inputs/instrprof-comdat.h
Expand Up @@ -8,14 +8,14 @@ template <class T> class FOO {
T t;
};

template <class T> T FOO<T>::DoIt(T ti) { // HEADER: 2| [[@LINE]]|template
for (T I = 0; I < ti; I++) { // HEADER: 22| [[@LINE]]| for (T
t += I; // HEADER: 20| [[@LINE]]| t += I;
if (I > ti / 2) // HEADER: 20| [[@LINE]]| if (I > ti
t -= 1; // HEADER: 8| [[@LINE]]| t -= 1;
} // HEADER: 20| [[@LINE]]| }
// HEADER: 2| [[@LINE]]|
return t; // HEADER: 2| [[@LINE]]| return t;
template <class T> T FOO<T>::DoIt(T ti) { // HEADER: [[@LINE]]| 2|template
for (T I = 0; I < ti; I++) { // HEADER: [[@LINE]]| 22| for (T
t += I; // HEADER: [[@LINE]]| 20| t += I;
if (I > ti / 2) // HEADER: [[@LINE]]| 20| if (I > ti
t -= 1; // HEADER: [[@LINE]]| 8| t -= 1;
} // HEADER: [[@LINE]]| 20| }
// HEADER: [[@LINE]]| 2|
return t; // HEADER: [[@LINE]]| 2| return t;
}

// To generate the binaries which correspond to this file, you must first
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/tools/llvm-cov/binary-formats.c
@@ -1,6 +1,6 @@
// Checks for reading various formats.

// CHECK: 100| [[@LINE+1]]|int main
// CHECK: [[@LINE+1]]| 100|int main
int main(int argc, const char *argv[]) {}

// RUN: llvm-profdata merge %S/Inputs/binary-formats.proftext -o %t.profdata
Expand Down
24 changes: 12 additions & 12 deletions llvm/test/tools/llvm-cov/combine_expansions.cpp
Expand Up @@ -5,22 +5,22 @@

#define SIMPLE_OP \
++x
// CHECK: | [[@LINE-2]]|#define SIMPLE_OP
// CHECK-NEXT: 2| [[@LINE-2]]| ++x
// CHECK: [[@LINE-2]]| |#define SIMPLE_OP
// CHECK-NEXT: [[@LINE-2]]| 2| ++x

#define DO_SOMETHING \
{ \
int x = 0; \
SIMPLE_OP; \
}
// CHECK: | [[@LINE-5]]|#define DO_SOMETHING
// CHECK-NEXT: 2| [[@LINE-5]]| {
// CHECK-NEXT: 2| [[@LINE-5]]| int x = 0;
// CHECK-NEXT: 2| [[@LINE-5]]| SIMPLE_OP;
// CHECK-NEXT: 2| [[@LINE-5]]| }
// CHECK: [[@LINE-5]]| |#define DO_SOMETHING
// CHECK-NEXT: [[@LINE-5]]| 2| {
// CHECK-NEXT: [[@LINE-5]]| 2| int x = 0;
// CHECK-NEXT: [[@LINE-5]]| 2| SIMPLE_OP;
// CHECK-NEXT: [[@LINE-5]]| 2| }

int main() { // CHECK: 1| [[@LINE]]|int main() {
DO_SOMETHING; // CHECK-NEXT: 1| [[@LINE]]| DO_SOMETHING;
DO_SOMETHING; // CHECK-NEXT: 1| [[@LINE]]| DO_SOMETHING;
return 0; // CHECK-NEXT: 1| [[@LINE]]| return 0;
} // CHECK-NEXT: 1| [[@LINE]]|}
int main() { // CHECK: [[@LINE]]| 1|int main() {
DO_SOMETHING; // CHECK-NEXT: [[@LINE]]| 1| DO_SOMETHING;
DO_SOMETHING; // CHECK-NEXT: [[@LINE]]| 1| DO_SOMETHING;
return 0; // CHECK-NEXT: [[@LINE]]| 1| return 0;
} // CHECK-NEXT: [[@LINE]]| 1|}
16 changes: 8 additions & 8 deletions llvm/test/tools/llvm-cov/prefer_used_to_unused.h
Expand Up @@ -12,13 +12,13 @@
// RUN: llvm-cov show %S/Inputs/prefer_used_to_unused.covmapping -instr-profile %t.profdata -filename-equivalence %s | FileCheck %s

// Coverage data for this function has a non-zero hash value if it is used in the translation unit.
inline int sampleFunc(int A) { // CHECK: 1| [[@LINE]]|inline int sampleFunc(int A) {
if (A > 0) // CHECK-NEXT: 1| [[@LINE]]| if (A > 0)
return A; // CHECK-NEXT: 1| [[@LINE]]| return A;
return 0; // CHECK-NEXT: 0| [[@LINE]]| return 0;
} // CHECK-NEXT: 1| [[@LINE]]|}
inline int sampleFunc(int A) { // CHECK: [[@LINE]]| 1|inline int sampleFunc(int A) {
if (A > 0) // CHECK-NEXT: [[@LINE]]| 1| if (A > 0)
return A; // CHECK-NEXT: [[@LINE]]| 1| return A;
return 0; // CHECK-NEXT: [[@LINE]]| 0| return 0;
} // CHECK-NEXT: [[@LINE]]| 1|}

// The hash for this function is zero in both cases, either it is used in the translation unit or not.
inline int simpleFunc(int A) { // CHECK: 1| [[@LINE]]|inline int simpleFunc(int A) {
return A; // CHECK-NEXT: 1| [[@LINE]]| return A;
} // CHECK-NEXT: 1| [[@LINE]]|}
inline int simpleFunc(int A) { // CHECK: [[@LINE]]| 1|inline int simpleFunc(int A) {
return A; // CHECK-NEXT: [[@LINE]]| 1| return A;
} // CHECK-NEXT: [[@LINE]]| 1|}
96 changes: 48 additions & 48 deletions llvm/test/tools/llvm-cov/showLineExecutionCounts.cpp
@@ -1,30 +1,30 @@
// Basic handling of line counts.
// RUN: llvm-profdata merge %S/Inputs/lineExecutionCounts.proftext -o %t.profdata

// before any coverage // WHOLE-FILE: | [[@LINE]]|// before
// FILTER-NOT: | [[@LINE-1]]|// before
int main() { // TEXT: 161| [[@LINE]]|int main(
int x = 0; // TEXT: 161| [[@LINE]]| int x
// TEXT: 161| [[@LINE]]|
if (x) { // TEXT: 0| [[@LINE]]| if (x)
x = 0; // TEXT: 0| [[@LINE]]| x = 0
} else { // TEXT: 161| [[@LINE]]| } else
x = 1; // TEXT: 161| [[@LINE]]| x = 1
} // TEXT: 161| [[@LINE]]| }
// TEXT: 161| [[@LINE]]|
for (int i = 0; i < 100; ++i) { // TEXT: 16.2k| [[@LINE]]| for (
x = 1; // TEXT: 16.1k| [[@LINE]]| x = 1
} // TEXT: 16.1k| [[@LINE]]| }
// TEXT: 161| [[@LINE]]|
x = x < 10 ? x + 1 : x - 1; // TEXT: 161| [[@LINE]]| x =
x = x > 10 ? // TEXT: 161| [[@LINE]]| x =
x - 1: // TEXT: 0| [[@LINE]]| x
x + 1; // TEXT: 161| [[@LINE]]| x
// TEXT: 161| [[@LINE]]|
return 0; // TEXT: 161| [[@LINE]]| return
} // TEXT: 161| [[@LINE]]|}
// after coverage // WHOLE-FILE: | [[@LINE]]|// after
// FILTER-NOT: | [[@LINE-1]]|// after
// before any coverage // WHOLE-FILE: [[@LINE]]| |// before
// FILTER-NOT: [[@LINE-1]]| |// before
int main() { // TEXT: [[@LINE]]| 161|int main(
int x = 0; // TEXT: [[@LINE]]| 161| int x
// TEXT: [[@LINE]]| 161|
if (x) { // TEXT: [[@LINE]]| 0| if (x)
x = 0; // TEXT: [[@LINE]]| 0| x = 0
} else { // TEXT: [[@LINE]]| 161| } else
x = 1; // TEXT: [[@LINE]]| 161| x = 1
} // TEXT: [[@LINE]]| 161| }
// TEXT: [[@LINE]]| 161|
for (int i = 0; i < 100; ++i) { // TEXT: [[@LINE]]| 16.2k| for (
x = 1; // TEXT: [[@LINE]]| 16.1k| x = 1
} // TEXT: [[@LINE]]| 16.1k| }
// TEXT: [[@LINE]]| 161|
x = x < 10 ? x + 1 : x - 1; // TEXT: [[@LINE]]| 161| x =
x = x > 10 ? // TEXT: [[@LINE]]| 161| x =
x - 1: // TEXT: [[@LINE]]| 0| x
x + 1; // TEXT: [[@LINE]]| 161| x
// TEXT: [[@LINE]]| 161|
return 0; // TEXT: [[@LINE]]| 161| return
} // TEXT: [[@LINE]]| 161|}
// after coverage // WHOLE-FILE: [[@LINE]]| |// after
// FILTER-NOT: [[@LINE-1]]| |// after

// RUN: llvm-cov show %S/Inputs/lineExecutionCounts.covmapping -instr-profile %t.profdata -filename-equivalence %s | FileCheck -check-prefixes=TEXT,WHOLE-FILE %s
// RUN: llvm-cov show %S/Inputs/lineExecutionCounts.covmapping -instr-profile %t.profdata -filename-equivalence -name=main %s | FileCheck -check-prefixes=TEXT,FILTER %s
Expand All @@ -45,30 +45,30 @@ int main() { // TEXT: 161| [[@LINE]]|int main(
// RUN: FileCheck -check-prefixes=HTML,HTML-WHOLE-FILE -input-file %t.html.dir/coverage/tmp/showLineExecutionCounts.cpp.html %s
// RUN: FileCheck -check-prefixes=HTML,HTML-FILTER -input-file %t.html.dir/functions.html %s
//
// HTML-WHOLE-FILE: <td class='uncovered-line'></td><td class='line-number'><a name='L[[@LINE-44]]'><pre>[[@LINE-44]]</pre></a></td><td class='code'><pre>// before
// HTML-FILTER-NOT: <td class='uncovered-line'></td><td class='line-number'><a name='L[[@LINE-45]]'><pre>[[@LINE-45]]</pre></a></td><td class='code'><pre>// before
// HTML: <td class='covered-line'><pre>161</pre></td><td class='line-number'><a name='L[[@LINE-44]]'><pre>[[@LINE-44]]</pre></a></td><td class='code'><pre>int main() {
// HTML: <td class='covered-line'><pre>161</pre></td><td class='line-number'><a name='L[[@LINE-44]]'><pre>[[@LINE-44]]</pre></a></td><td class='code'><pre> int x = 0
// HTML: <td class='covered-line'><pre>161</pre></td><td class='line-number'><a name='L[[@LINE-44]]'><pre>[[@LINE-44]]</pre></a></td><td class='code'><pre>
// HTML: <td class='uncovered-line'><pre>0</pre></td><td class='line-number'><a name='L[[@LINE-44]]'><pre>[[@LINE-44]]</pre></a></td><td class='code'><pre><span class='red'> if (x) {
// HTML: <td class='uncovered-line'><pre>0</pre></td><td class='line-number'><a name='L[[@LINE-44]]'><pre>[[@LINE-44]]</pre></a></td><td class='code'><pre>
// HTML: <td class='covered-line'><pre>161</pre></td><td class='line-number'><a name='L[[@LINE-44]]'><pre>[[@LINE-44]]</pre></a></td><td class='code'><pre><span class='red'> }</span>
// HTML: <td class='covered-line'><pre>161</pre></td><td class='line-number'><a name='L[[@LINE-44]]'><pre>[[@LINE-44]]</pre></a></td><td class='code'><pre> x = 1;
// HTML: <td class='covered-line'><pre>161</pre></td><td class='line-number'><a name='L[[@LINE-44]]'><pre>[[@LINE-44]]</pre></a></td><td class='code'><pre> }
// HTML: <td class='covered-line'><pre>161</pre></td><td class='line-number'><a name='L[[@LINE-44]]'><pre>[[@LINE-44]]</pre></a></td><td class='code'><pre>
// HTML: <td class='covered-line'><pre>16.2k</pre></td><td class='line-number'><a name='L[[@LINE-44]]'><pre>[[@LINE-44]]</pre></a></td><td class='code'><pre> for (int i = 0; i &lt; 100; ++i)
// HTML: <td class='covered-line'><pre>16.1k</pre></td><td class='line-number'><a name='L[[@LINE-44]]'><pre>[[@LINE-44]]</pre></a></td><td class='code'><pre> x = 1;
// HTML: <td class='covered-line'><pre>16.1k</pre></td><td class='line-number'><a name='L[[@LINE-44]]'><pre>[[@LINE-44]]</pre></a></td><td class='code'><pre> }
// HTML: <td class='covered-line'><pre>161</pre></td><td class='line-number'><a name='L[[@LINE-44]]'><pre>[[@LINE-44]]</pre></a></td><td class='code'><pre>
// HTML: <td class='covered-line'><pre>161</pre></td><td class='line-number'><a name='L[[@LINE-44]]'><pre>[[@LINE-44]]</pre></a></td><td class='code'><pre> x = x &lt; 10
// HTML: <td class='covered-line'><pre>161</pre></td><td class='line-number'><a name='L[[@LINE-44]]'><pre>[[@LINE-44]]</pre></a></td><td class='code'><pre> x = x &gt; 10
// HTML: <td class='uncovered-line'><pre>0</pre></td><td class='line-number'><a name='L[[@LINE-44]]'><pre>[[@LINE-44]]</pre></a></td><td class='code'><pre><span class='red'> x - 1:
// HTML: <td class='covered-line'><pre>161</pre></td><td class='line-number'><a name='L[[@LINE-44]]'><pre>[[@LINE-44]]</pre></a></td><td class='code'><pre> x + 1;
// HTML: <td class='covered-line'><pre>161</pre></td><td class='line-number'><a name='L[[@LINE-44]]'><pre>[[@LINE-44]]</pre></a></td><td class='code'><pre>
// HTML: <td class='covered-line'><pre>161</pre></td><td class='line-number'><a name='L[[@LINE-44]]'><pre>[[@LINE-44]]</pre></a></td><td class='code'><pre> return 0;
// HTML: <td class='covered-line'><pre>161</pre></td><td class='line-number'><a name='L[[@LINE-44]]'><pre>[[@LINE-44]]</pre></a></td><td class='code'><pre>}
// HTML-WHOLE-FILE: <td class='uncovered-line'></td><td class='line-number'><a name='L[[@LINE-44]]'><pre>[[@LINE-44]]</pre></a></td><td class='code'><pre>// after
// HTML-FILTER-NOT: <td class='uncovered-line'></td><td class='line-number'><a name='L[[@LINE-45]]'><pre>[[@LINE-45]]</pre></a></td><td class='code'><pre>// after
// HTML-WHOLE-FILE: <td class='line-number'><a name='L[[@LINE-44]]'><pre>[[@LINE-44]]</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// before
// HTML-FILTER-NOT: <td class='line-number'><a name='L[[@LINE-45]]'><pre>[[@LINE-45]]</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// before
// HTML: <td class='line-number'><a name='L[[@LINE-44]]'><pre>[[@LINE-44]]</pre></a></td><td class='covered-line'><pre>161</pre></td><td class='code'><pre>int main() {
// HTML: <td class='line-number'><a name='L[[@LINE-44]]'><pre>[[@LINE-44]]</pre></a></td><td class='covered-line'><pre>161</pre></td><td class='code'><pre> int x = 0
// HTML: <td class='line-number'><a name='L[[@LINE-44]]'><pre>[[@LINE-44]]</pre></a></td><td class='covered-line'><pre>161</pre></td><td class='code'><pre>
// HTML: <td class='line-number'><a name='L[[@LINE-44]]'><pre>[[@LINE-44]]</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (x) {
// HTML: <td class='line-number'><a name='L[[@LINE-44]]'><pre>[[@LINE-44]]</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>
// HTML: <td class='line-number'><a name='L[[@LINE-44]]'><pre>[[@LINE-44]]</pre></a></td><td class='covered-line'><pre>161</pre></td><td class='code'><pre><span class='red'> }</span>
// HTML: <td class='line-number'><a name='L[[@LINE-44]]'><pre>[[@LINE-44]]</pre></a></td><td class='covered-line'><pre>161</pre></td><td class='code'><pre> x = 1;
// HTML: <td class='line-number'><a name='L[[@LINE-44]]'><pre>[[@LINE-44]]</pre></a></td><td class='covered-line'><pre>161</pre></td><td class='code'><pre> }
// HTML: <td class='line-number'><a name='L[[@LINE-44]]'><pre>[[@LINE-44]]</pre></a></td><td class='covered-line'><pre>161</pre></td><td class='code'><pre>
// HTML: <td class='line-number'><a name='L[[@LINE-44]]'><pre>[[@LINE-44]]</pre></a></td><td class='covered-line'><pre>16.2k</pre></td><td class='code'><pre> for (int i = 0; i &lt; 100; ++i)
// HTML: <td class='line-number'><a name='L[[@LINE-44]]'><pre>[[@LINE-44]]</pre></a></td><td class='covered-line'><pre>16.1k</pre></td><td class='code'><pre> x = 1;
// HTML: <td class='line-number'><a name='L[[@LINE-44]]'><pre>[[@LINE-44]]</pre></a></td><td class='covered-line'><pre>16.1k</pre></td><td class='code'><pre> }
// HTML: <td class='line-number'><a name='L[[@LINE-44]]'><pre>[[@LINE-44]]</pre></a></td><td class='covered-line'><pre>161</pre></td><td class='code'><pre>
// HTML: <td class='line-number'><a name='L[[@LINE-44]]'><pre>[[@LINE-44]]</pre></a></td><td class='covered-line'><pre>161</pre></td><td class='code'><pre> x = x &lt; 10
// HTML: <td class='line-number'><a name='L[[@LINE-44]]'><pre>[[@LINE-44]]</pre></a></td><td class='covered-line'><pre>161</pre></td><td class='code'><pre> x = x &gt; 10
// HTML: <td class='line-number'><a name='L[[@LINE-44]]'><pre>[[@LINE-44]]</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> x - 1:
// HTML: <td class='line-number'><a name='L[[@LINE-44]]'><pre>[[@LINE-44]]</pre></a></td><td class='covered-line'><pre>161</pre></td><td class='code'><pre> x + 1;
// HTML: <td class='line-number'><a name='L[[@LINE-44]]'><pre>[[@LINE-44]]</pre></a></td><td class='covered-line'><pre>161</pre></td><td class='code'><pre>
// HTML: <td class='line-number'><a name='L[[@LINE-44]]'><pre>[[@LINE-44]]</pre></a></td><td class='covered-line'><pre>161</pre></td><td class='code'><pre> return 0;
// HTML: <td class='line-number'><a name='L[[@LINE-44]]'><pre>[[@LINE-44]]</pre></a></td><td class='covered-line'><pre>161</pre></td><td class='code'><pre>}
// HTML-WHOLE-FILE: <td class='line-number'><a name='L[[@LINE-44]]'><pre>[[@LINE-44]]</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// after
// HTML-FILTER-NOT: <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

// RUN: llvm-cov export %S/Inputs/lineExecutionCounts.covmapping -instr-profile %t.profdata -name=main 2>/dev/null > %t.export.json
// RUN: FileCheck -input-file %t.export.json %S/Inputs/lineExecutionCounts.json
Expand Down

0 comments on commit 6b1f5f8

Please sign in to comment.