1 // RUN: llvm-cov show %S/Inputs/templateInstantiations.covmapping -instr-profile %S/Inputs/templateInstantiations.profdata -path-equivalence=/tmp,%S %s | FileCheck -check-prefixes=SHARED,ALL %s
2 // RUN: llvm-cov show %S/Inputs/templateInstantiations.covmapping -instr-profile %S/Inputs/templateInstantiations.profdata -path-equivalence=/tmp,%S -name=_Z4funcIbEiT_ %s | FileCheck -check-prefixes=SHARED,FILTER %s
3
4 // before coverage // ALL: [[@LINE]]| |// before
5 // FILTER-NOT:[[@LINE-1]]| |// before
6 template<typename T> // ALL: [[@LINE]]| |template<typename T>
func(T x)7 int func(T x) { // ALL-NEXT: [[@LINE]]| 2|int func(T x) {
8 if(x) // ALL-NEXT: [[@LINE]]| 2| if(x)
9 return 0; // ALL-NEXT: [[@LINE]]| 1| return 0;
10 else // ALL-NEXT: [[@LINE]]| 1| else
11 return 1; // ALL-NEXT: [[@LINE]]| 1| return 1;
12 int j = 1; // ALL-NEXT: [[@LINE]]| 0| int j = 1;
13 } // ALL-NEXT: [[@LINE]]| 0|}
14
15 // ALL: _Z4{{[a-z]+}}IiEiT_:
16 // FILTER-NOT: _Z4{{[a-z]+}}IiEiT_:
17 // ALL: [[@LINE-10]]| 1|int func(T x) {
18 // ALL-NEXT: [[@LINE-10]]| 1| if(x)
19 // ALL-NEXT: [[@LINE-10]]| 0| return 0;
20 // ALL-NEXT: [[@LINE-10]]| 1| else
21 // ALL-NEXT: [[@LINE-10]]| 1| return 1;
22 // ALL-NEXT: [[@LINE-10]]| 0| int j = 1;
23 // ALL-NEXT: [[@LINE-10]]| 0|}
24
25 // SHARED: {{^ *(\| )?}}_Z4funcIbEiT_:
26 // SHARED: [[@LINE-19]]| 1|int func(T x) {
27 // SHARED-NEXT: [[@LINE-19]]| 1| if(x)
28 // SHARED-NEXT: [[@LINE-19]]| 1| return 0;
29 // SHARED-NEXT: [[@LINE-19]]| 0| else
30 // SHARED-NEXT: [[@LINE-19]]| 0| return 1;
31 // SHARED-NEXT: [[@LINE-19]]| 0| int j = 1;
32 // SHARED-NEXT: [[@LINE-19]]| 0|}
33
main()34 int main() { // ALL: [[@LINE]]| 1|int main() {
35 func<int>(0); // ALL-NEXT: [[@LINE]]| 1| func<int>(0);
36 func<bool>(true); // ALL-NEXT: [[@LINE]]| 1| func<bool>(true);
37 return 0; // ALL-NEXT: [[@LINE]]| 1| return 0;
38 } // ALL-NEXT: [[@LINE]]| 1|}
39 // after coverage // ALL-NEXT: [[@LINE]]| |// after
40 // FILTER-NOT:[[@LINE-1]]| |// after
41
42 // Test html output.
43 // RUN: llvm-cov show %S/Inputs/templateInstantiations.covmapping -instr-profile %S/Inputs/templateInstantiations.profdata -path-equivalence=/tmp,%S %s -format html -o %t.html.dir
44 // RUN: llvm-cov show %S/Inputs/templateInstantiations.covmapping -instr-profile %S/Inputs/templateInstantiations.profdata -path-equivalence=/tmp,%S -name=_Z4funcIbEiT_ %s -format html -o %t.html.filtered.dir
45 // RUN: FileCheck -check-prefixes=HTML-SHARED,HTML-ALL -input-file=%t.html.dir/coverage/tmp/showTemplateInstantiations.cpp.html %s
46 // RUN: FileCheck -check-prefixes=HTML-SHARED,HTML-FILTER -input-file=%t.html.filtered.dir/coverage/tmp/showTemplateInstantiations.cpp.html %s
47
48 // HTML-ALL: <td class='line-number'><a name='L4' href='#L4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// before
49 // HTML-FILTER-NOT: <td class='line-number'><a name='L4' href='#L4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// before
50 // HTML-ALL: <td class='line-number'><a name='L6' href='#L6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>template<typename T>
51
52 // HTML-ALL: <div class='source-name-title'><pre>_Z4funcIiEiT_</pre></div>
53 // HTML-FILTER-NOT: <div class='source-name-title'><pre>_Z4funcIiEiT_</pre></div><table>
54 // HTML-ALL: <td class='line-number'><a name='L7' href='#L7'><pre>7</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre>int func(T x) {
55
56 // HTML-SHARED: <div class='source-name-title'><pre>_Z4funcIbEiT_</pre></div>
57 // HTML-SHARED: <td class='line-number'><a name='L7' href='#L7'><pre>7</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre>int func(T x) {
58
59 // RUN: FileCheck -check-prefix=HTML-JUMP -input-file=%t.html.dir/coverage/tmp/showTemplateInstantiations.cpp.html %s
60 // HTML-JUMP: <pre>Source (<a href='#L{{[0-9]+}}'>jump to first uncovered line</a>)</pre>
61 // HTML-JUMP-NOT: <pre>Source (<a href='#L{{[0-9]+}}'>jump to first uncovered line</a>)</pre>
62
63 // RUN: llvm-cov show %S/Inputs/templateInstantiations.covmapping -instr-profile %S/Inputs/templateInstantiations.profdata -show-instantiations=false -path-equivalence=/tmp,%S %s | FileCheck -check-prefix=NO_INSTS %s
64 // NO_INSTS-NOT: {{^ *}}| _Z4funcIbEiT_:
65 // NO_INSTS-NOT: {{^ *}}| _Z4funcIiEiT_:
66
67 // RUN: llvm-cov report %S/Inputs/templateInstantiations.covmapping -dump -instr-profile %S/Inputs/templateInstantiations.profdata -path-equivalence=/tmp,%S %s | FileCheck -check-prefix=DUMP %s
68 // DUMP: InstantiationGroup: Definition at line 7, column 15 with size = 2
69 // DUMP: InstantiationGroup: main with size = 1
70