blob: db9576d8b568dea83655c393693a93edcf6f451f [file] [log] [blame]
Vedant Kumarc1561cb2016-06-29 17:47:08 +00001// 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
Justin Bognerb35a72a2014-09-25 00:34:18 +00003
Ying Yi6b1f5f82016-08-09 19:53:35 +00004// before coverage // ALL: [[@LINE]]| |// before
5 // FILTER-NOT:[[@LINE-1]]| |// before
6template<typename T> // ALL: [[@LINE]]| |template<typename T>
7int 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]]| 2| 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]]| 2|}
Justin Bognerb35a72a2014-09-25 00:34:18 +000014
Ying Yi24e91bd2016-09-06 21:41:38 +000015 // SHARED: {{^ *(\| )?}}Function: _Z4funcIbEiT_:
Ying Yi84dc9712016-08-24 14:27:23 +000016 // SHARED: [[@LINE-9]]| 1|int func(T x) {
Ying Yi6b1f5f82016-08-09 19:53:35 +000017 // SHARED-NEXT: [[@LINE-9]]| 1| if(x)
18 // SHARED-NEXT: [[@LINE-9]]| 1| return 0;
19 // SHARED-NEXT: [[@LINE-9]]| 1| else
20 // SHARED-NEXT: [[@LINE-9]]| 0| return 1;
21 // SHARED-NEXT: [[@LINE-9]]| 0| int j = 1;
22 // SHARED-NEXT: [[@LINE-9]]| 1|}
Justin Bognerb35a72a2014-09-25 00:34:18 +000023
Ying Yi24e91bd2016-09-06 21:41:38 +000024 // ALL: {{^ *}}| Function: _Z4funcIiEiT_:
25 // FILTER-NOT: {{^ *(\| )?}}Function: _Z4funcIiEiT_:
Ying Yi84dc9712016-08-24 14:27:23 +000026 // ALL: [[@LINE-19]]| 1|int func(T x) {
Ying Yi6b1f5f82016-08-09 19:53:35 +000027 // ALL-NEXT: [[@LINE-19]]| 1| if(x)
28 // ALL-NEXT: [[@LINE-19]]| 0| return 0;
29 // ALL-NEXT: [[@LINE-19]]| 1| else
30 // ALL-NEXT: [[@LINE-19]]| 1| return 1;
31 // ALL-NEXT: [[@LINE-19]]| 0| int j = 1;
32 // ALL-NEXT: [[@LINE-19]]| 1|}
Justin Bognerb35a72a2014-09-25 00:34:18 +000033
Ying Yi6b1f5f82016-08-09 19:53:35 +000034int 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
Vedant Kumar4c010922016-07-06 21:44:05 +000041
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
Ying Yi6b1f5f82016-08-09 19:53:35 +000048// HTML-ALL: <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
49// 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
50// HTML-ALL: <td class='line-number'><a name='L[[@LINE-44]]'><pre>[[@LINE-44]]</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>template&lt;typename T&gt;
51// HTML-ALL: <td class='line-number'><a name='L[[@LINE-44]]'><pre>[[@LINE-44]]</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre>int func(T x) {
52// HTML-ALL: <td class='line-number'><a name='L[[@LINE-44]]'><pre>[[@LINE-44]]</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> if(x)
53// HTML-ALL: <td class='line-number'><a name='L[[@LINE-44]]'><pre>[[@LINE-44]]</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> ret
54// HTML-ALL: <td class='line-number'><a name='L[[@LINE-44]]'><pre>[[@LINE-44]]</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> else
55// HTML-ALL: <td class='line-number'><a name='L[[@LINE-44]]'><pre>[[@LINE-44]]</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> ret
56// HTML-ALL: <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>
57// HTML-ALL: <td class='line-number'><a name='L[[@LINE-44]]'><pre>[[@LINE-44]]</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre>}
Vedant Kumar4c010922016-07-06 21:44:05 +000058
Ying Yi84dc9712016-08-24 14:27:23 +000059// HTML-SHARED: <div class='source-name-title'><pre>Function: _Z4funcIbEiT_</pre></div>
Ying Yi6b1f5f82016-08-09 19:53:35 +000060// HTML-SHARED: <td class='line-number'><a name='L[[@LINE-53]]'><pre>[[@LINE-53]]</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre>int func(T x) {
61// HTML-SHARED: <td class='line-number'><a name='L[[@LINE-53]]'><pre>[[@LINE-53]]</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> if(x)
62// HTML-SHARED: <td class='line-number'><a name='L[[@LINE-53]]'><pre>[[@LINE-53]]</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> ret
63// HTML-SHARED: <td class='line-number'><a name='L[[@LINE-53]]'><pre>[[@LINE-53]]</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> else
64// HTML-SHARED: <td class='line-number'><a name='L[[@LINE-53]]'><pre>[[@LINE-53]]</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>
65// HTML-SHARED: <td class='line-number'><a name='L[[@LINE-53]]'><pre>[[@LINE-53]]</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>
66// HTML-SHARED: <td class='line-number'><a name='L[[@LINE-53]]'><pre>[[@LINE-53]]</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre>}
Vedant Kumar4c010922016-07-06 21:44:05 +000067
Ying Yi84dc9712016-08-24 14:27:23 +000068// HTML-ALL: <div class='source-name-title'><pre>Function: _Z4funcIiEiT_</pre></div>
Vedant Kumar4c010922016-07-06 21:44:05 +000069// HTML-FILTER-NOT: <div class='source-name-title'><pre>_Z4funcIiEiT_</pre></div><table>
Ying Yi6b1f5f82016-08-09 19:53:35 +000070// HTML-ALL: <td class='line-number'><a name='L[[@LINE-63]]'><pre>[[@LINE-63]]</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre>int func(T x) {
71// HTML-ALL: <td class='line-number'><a name='L[[@LINE-63]]'><pre>[[@LINE-63]]</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> if(x)
72// HTML-ALL: <td class='line-number'><a name='L[[@LINE-63]]'><pre>[[@LINE-63]]</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>
73// HTML-ALL: <td class='line-number'><a name='L[[@LINE-63]]'><pre>[[@LINE-63]]</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> else
74// HTML-ALL: <td class='line-number'><a name='L[[@LINE-63]]'><pre>[[@LINE-63]]</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> ret
75// HTML-ALL: <td class='line-number'><a name='L[[@LINE-63]]'><pre>[[@LINE-63]]</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>
76// HTML-ALL: <td class='line-number'><a name='L[[@LINE-63]]'><pre>[[@LINE-63]]</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre>}
Vedant Kumar4c010922016-07-06 21:44:05 +000077
Ying Yi6b1f5f82016-08-09 19:53:35 +000078// HTML-ALL: <td class='line-number'><a name='L[[@LINE-44]]'><pre>[[@LINE-44]]</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre>int main() {
79// HTML-ALL: <td class='line-number'><a name='L[[@LINE-44]]'><pre>[[@LINE-44]]</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> func&lt;int&gt;(0);
80// HTML-ALL: <td class='line-number'><a name='L[[@LINE-44]]'><pre>[[@LINE-44]]</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> func&lt;bool&gt;(true);
81// HTML-ALL: <td class='line-number'><a name='L[[@LINE-44]]'><pre>[[@LINE-44]]</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return 0;
82// HTML-ALL: <td class='line-number'><a name='L[[@LINE-44]]'><pre>[[@LINE-44]]</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre>}
Vedant Kumar4c010922016-07-06 21:44:05 +000083
Ying Yi6b1f5f82016-08-09 19:53:35 +000084// 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
85// 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