blob: 380e98b42bb8ce04cf22fe77fcf4fed29fbb3567 [file] [log] [blame]
Sean Eveson9edfeac2017-08-14 10:20:12 +00001// 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
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;
Vedant Kumar43247f02017-11-09 02:33:43 +000010 else // ALL-NEXT: [[@LINE]]| 1| else
Ying Yi6b1f5f82016-08-09 19:53:35 +000011 return 1; // ALL-NEXT: [[@LINE]]| 1| return 1;
12 int j = 1; // ALL-NEXT: [[@LINE]]| 0| int j = 1;
Vedant Kumar43247f02017-11-09 02:33:43 +000013} // 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|}
Justin Bognerb35a72a2014-09-25 00:34:18 +000024
Vedant Kumar0053c0b2016-09-08 00:56:48 +000025 // SHARED: {{^ *(\| )?}}_Z4funcIbEiT_:
Vedant Kumar43247f02017-11-09 02:33:43 +000026 // 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|}
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.
Sean Eveson9edfeac2017-08-14 10:20:12 +000043// 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
Sean Evesonfa8ef352017-09-28 10:07:30 +000044// 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
Vedant Kumar4c010922016-07-06 21:44:05 +000045// RUN: FileCheck -check-prefixes=HTML-SHARED,HTML-ALL -input-file=%t.html.dir/coverage/tmp/showTemplateInstantiations.cpp.html %s
Sean Evesonfa8ef352017-09-28 10:07:30 +000046// RUN: FileCheck -check-prefixes=HTML-SHARED,HTML-FILTER -input-file=%t.html.filtered.dir/coverage/tmp/showTemplateInstantiations.cpp.html %s
Vedant Kumar4c010922016-07-06 21:44:05 +000047
Vedant Kumar43247f02017-11-09 02:33:43 +000048// 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&lt;typename T&gt;
Vedant Kumar4c010922016-07-06 21:44:05 +000051
Vedant Kumar0053c0b2016-09-08 00:56:48 +000052// HTML-ALL: <div class='source-name-title'><pre>_Z4funcIiEiT_</pre></div>
Vedant Kumar4c010922016-07-06 21:44:05 +000053// HTML-FILTER-NOT: <div class='source-name-title'><pre>_Z4funcIiEiT_</pre></div><table>
Vedant Kumar43247f02017-11-09 02:33:43 +000054// 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) {
Vedant Kumar4c010922016-07-06 21:44:05 +000055
Vedant Kumar43247f02017-11-09 02:33:43 +000056// 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) {
Vedant Kumarea1e97b2016-09-15 06:44:48 +000058
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>
Vedant Kumar79554e42017-08-02 23:35:24 +000062
Sean Eveson9edfeac2017-08-14 10:20:12 +000063// 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
Vedant Kumar79554e42017-08-02 23:35:24 +000064// NO_INSTS-NOT: {{^ *}}| _Z4funcIbEiT_:
65// NO_INSTS-NOT: {{^ *}}| _Z4funcIiEiT_:
Vedant Kumar72c3a112017-09-08 18:44:49 +000066
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
Vedant Kumar43247f02017-11-09 02:33:43 +000068// DUMP: InstantiationGroup: Definition at line 7, column 15 with size = 2
Vedant Kumar72c3a112017-09-08 18:44:49 +000069// DUMP: InstantiationGroup: main with size = 1