1 // RUN: llvm-cov show %S/Inputs/templateInstantiations.covmapping -instr-profile %S/Inputs/templateInstantiations.profdata -filename-equivalence %s | FileCheck -check-prefixes=SHARED,ALL %s
2 // RUN: llvm-cov show %S/Inputs/templateInstantiations.covmapping -instr-profile %S/Inputs/templateInstantiations.profdata -filename-equivalence -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: 2| [[@LINE]]|int func(T x) {
8 if(x) // ALL-NEXT: 2| [[@LINE]]| if(x)
9 return 0; // ALL-NEXT: 1| [[@LINE]]| return 0;
10 else // ALL-NEXT: 2| [[@LINE]]| else
11 return 1; // ALL-NEXT: 1| [[@LINE]]| return 1;
12 int j = 1; // ALL-NEXT: 0| [[@LINE]]| int j = 1;
13 } // ALL-NEXT: 2| [[@LINE]]|}
14
15 // SHARED: {{^ *(\| )?}}_Z4funcIbEiT_:
16 // SHARED-NEXT: 1| [[@LINE-9]]|int func(T x) {
17 // SHARED-NEXT: 1| [[@LINE-9]]| if(x)
18 // SHARED-NEXT: 1| [[@LINE-9]]| return 0;
19 // SHARED-NEXT: 1| [[@LINE-9]]| else
20 // SHARED-NEXT: 0| [[@LINE-9]]| return 1;
21 // SHARED-NEXT: 0| [[@LINE-9]]| int j = 1;
22 // SHARED-NEXT: 1| [[@LINE-9]]|}
23
24 // ALL: {{^ *}}| _Z4funcIiEiT_:
25 // FILTER-NOT: {{^ *(\| )?}} _Z4funcIiEiT_:
26 // ALL-NEXT: 1| [[@LINE-19]]|int func(T x) {
27 // ALL-NEXT: 1| [[@LINE-19]]| if(x)
28 // ALL-NEXT: 0| [[@LINE-19]]| return 0;
29 // ALL-NEXT: 1| [[@LINE-19]]| else
30 // ALL-NEXT: 1| [[@LINE-19]]| return 1;
31 // ALL-NEXT: 0| [[@LINE-19]]| int j = 1;
32 // ALL-NEXT: 1| [[@LINE-19]]|}
33
main()34 int main() { // ALL: 1| [[@LINE]]|int main() {
35 func<int>(0); // ALL-NEXT: 1| [[@LINE]]| func<int>(0);
36 func<bool>(true); // ALL-NEXT: 1| [[@LINE]]| func<bool>(true);
37 return 0; // ALL-NEXT: 1| [[@LINE]]| return 0;
38 } // ALL-NEXT: 1| [[@LINE]]|}
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 -filename-equivalence %s -format html -o %t.html.dir
44 // RUN: llvm-cov show %S/Inputs/templateInstantiations.covmapping -instr-profile %S/Inputs/templateInstantiations.profdata -filename-equivalence -name=_Z4funcIbEiT_ %s -format html -o %t.html.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.dir/functions.html %s
47
48 // HTML-ALL: <td class='uncovered-line'></td><td class='line-number'><pre>[[@LINE-44]]</pre></td><td class='code'><pre>// before
49 // HTML-FILTER-NOT: <td class='uncovered-line'></td><td class='line-number'><pre>[[@LINE-45]]</pre></td><td class='code'><pre>// before
50 // HTML-ALL: <td class='uncovered-line'></td><td class='line-number'><pre>[[@LINE-44]]</pre></td><td class='code'><pre>template<typename T>
51 // HTML-ALL: <td class='covered-line'><pre>2</pre></td><td class='line-number'><pre>[[@LINE-44]]</pre></td><td class='code'><pre>int func(T x) {
52 // HTML-ALL: <td class='covered-line'><pre>2</pre></td><td class='line-number'><pre>[[@LINE-44]]</pre></td><td class='code'><pre> if(x)
53 // HTML-ALL: <td class='covered-line'><pre>1</pre></td><td class='line-number'><pre>[[@LINE-44]]</pre></td><td class='code'><pre> ret
54 // HTML-ALL: <td class='covered-line'><pre>2</pre></td><td class='line-number'><pre>[[@LINE-44]]</pre></td><td class='code'><pre> else
55 // HTML-ALL: <td class='covered-line'><pre>1</pre></td><td class='line-number'><pre>[[@LINE-44]]</pre></td><td class='code'><pre> ret
56 // HTML-ALL: <td class='uncovered-line'><pre>0</pre></td><td class='line-number'><pre>[[@LINE-44]]</pre></td><td class='code'><pre>
57 // HTML-ALL: <td class='covered-line'><pre>2</pre></td><td class='line-number'><pre>[[@LINE-44]]</pre></td><td class='code'><pre>}
58
59 // HTML-SHARED: <div class='source-name-title'><pre>_Z4funcIbEiT_</pre></div><table>
60 // HTML-SHARED: <td class='covered-line'><pre>1</pre></td><td class='line-number'><pre>[[@LINE-53]]</pre></td><td class='code'><pre>int func(T x) {
61 // HTML-SHARED: <td class='covered-line'><pre>1</pre></td><td class='line-number'><pre>[[@LINE-53]]</pre></td><td class='code'><pre> if(x)
62 // HTML-SHARED: <td class='covered-line'><pre>1</pre></td><td class='line-number'><pre>[[@LINE-53]]</pre></td><td class='code'><pre> ret
63 // HTML-SHARED: <td class='covered-line'><pre>1</pre></td><td class='line-number'><pre>[[@LINE-53]]</pre></td><td class='code'><pre> else
64 // HTML-SHARED: <td class='uncovered-line'><pre>0</pre></td><td class='line-number'><pre>[[@LINE-53]]</pre></td><td class='code'><pre>
65 // HTML-SHARED: <td class='uncovered-line'><pre>0</pre></td><td class='line-number'><pre>[[@LINE-53]]</pre></td><td class='code'><pre>
66 // HTML-SHARED: <td class='covered-line'><pre>1</pre></td><td class='line-number'><pre>[[@LINE-53]]</pre></td><td class='code'><pre>}
67
68 // HTML-ALL: <div class='source-name-title'><pre>_Z4funcIiEiT_</pre></div><table>
69 // HTML-FILTER-NOT: <div class='source-name-title'><pre>_Z4funcIiEiT_</pre></div><table>
70 // HTML-ALL: <td class='covered-line'><pre>1</pre></td><td class='line-number'><pre>[[@LINE-63]]</pre></td><td class='code'><pre>int func(T x) {
71 // HTML-ALL: <td class='covered-line'><pre>1</pre></td><td class='line-number'><pre>[[@LINE-63]]</pre></td><td class='code'><pre> if(x)
72 // HTML-ALL: <td class='uncovered-line'><pre>0</pre></td><td class='line-number'><pre>[[@LINE-63]]</pre></td><td class='code'><pre>
73 // HTML-ALL: <td class='covered-line'><pre>1</pre></td><td class='line-number'><pre>[[@LINE-63]]</pre></td><td class='code'><pre> else
74 // HTML-ALL: <td class='covered-line'><pre>1</pre></td><td class='line-number'><pre>[[@LINE-63]]</pre></td><td class='code'><pre> ret
75 // HTML-ALL: <td class='uncovered-line'><pre>0</pre></td><td class='line-number'><pre>[[@LINE-63]]</pre></td><td class='code'><pre>
76 // HTML-ALL: <td class='covered-line'><pre>1</pre></td><td class='line-number'><pre>[[@LINE-63]]</pre></td><td class='code'><pre>}
77
78 // HTML-ALL: td class='covered-line'><pre>1</pre></td><td class='line-number'><pre>[[@LINE-44]]</pre></td><td class='code'><pre>int main() {
79 // HTML-ALL: <td class='covered-line'><pre>1</pre></td><td class='line-number'><pre>[[@LINE-44]]</pre></td><td class='code'><pre> func<int>(0);
80 // HTML-ALL: <td class='covered-line'><pre>1</pre></td><td class='line-number'><pre>[[@LINE-44]]</pre></td><td class='code'><pre> func<bool>(true);
81 // HTML-ALL: <td class='covered-line'><pre>1</pre></td><td class='line-number'><pre>[[@LINE-44]]</pre></td><td class='code'><pre> return 0;
82 // HTML-ALL: <td class='covered-line'><pre>1</pre></td><td class='line-number'><pre>[[@LINE-44]]</pre></td><td class='code'><pre>}
83
84 // HTML-ALL: <td class='uncovered-line'></td><td class='line-number'><pre>[[@LINE-45]]</pre></td><td class='code'><pre>// after
85 // HTML-FILTER-NOT: <td class='uncovered-line'></td><td class='line-number'><pre>[[@LINE-46]]</pre></td><td class='code'><pre>// after
86