1 // RUN: %clang_cc1 -mllvm -emptyline-comment-coverage=false -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -fexceptions -fcxx-exceptions -emit-llvm-only -triple %itanium_abi_triple -main-file-name terminate-statements.cpp -I %S/Inputs %s | FileCheck %s
5 return 0; // CHECK: Gap,File 0, [[@LINE-1]]:12 -> [[@LINE]]:3 = 0
12 ; // CHECK: Gap,File 0, [[@LINE]]:6 -> [[@LINE+1]]:3 = (#0 - #1)
13 return 1; // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE]]:11 = (#0 - #1)
17 for (int a
= 1; a
< 9; a
--)
18 return a
; // CHECK: Gap,File 0, [[@LINE]]:14 -> [[@LINE+1]]:3 = (#0 - #1)
19 return 0; // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE]]:11 = (#0 - #1)
26 } // CHECK: File 0, [[@LINE]]:4 -> [[@LINE+1]]:3 = (#0 - #1)
27 return 0; // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE]]:11 = (#0 - #1)
33 } while (i
> 0); // CHECK: Gap,File 0, [[@LINE]]:19 -> [[@LINE+1]]:3 = (0 - #1)
34 return 0; // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE]]:11 = (0 - #1)
38 int arr
[] = {1, 2, 3, 4};
41 } // CHECK: Gap,File 0, [[@LINE]]:4 -> [[@LINE+1]]:3 = (#0 - #1)
42 return 0; // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE]]:11 = (#0 - #1)
50 return 0; // CHECK: Gap,File 0, [[@LINE-1]]:6 -> [[@LINE]]:5 = 0
52 return 0; // CHECK: Gap,File 0, [[@LINE-1]]:4 -> [[@LINE]]:3 = 0
57 return 1; // CHECK: Gap,File 0, [[@LINE]]:14 -> [[@LINE+1]]:3 = (#0 - #1)
58 if (i
== 2) // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+5]]:2 = (#0 - #1)
59 return 2; // CHECK: Gap,File 0, [[@LINE]]:14 -> [[@LINE+1]]:3 = ((#0 - #1) - #2)
60 if (i
== 3) // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+3]]:2 = ((#0 - #1) - #2)
61 return 3; // CHECK: Gap,File 0, [[@LINE]]:14 -> [[@LINE+1]]:3 = (((#0 - #1) - #2) - #3)
62 return 4; // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE]]:11 = (((#0 - #1) - #2) - #3)
67 return 1; // CHECK: Gap,File 0, [[@LINE]]:14 -> [[@LINE+1]]:8 = (#0 - #1)
68 else if (i
== 2) // CHECK-NEXT: File 0, [[@LINE]]:8 -> [[@LINE+1]]:13 = (#0 - #1)
69 return 2; // CHECK: Gap,File 0, [[@LINE]]:14 -> [[@LINE+1]]:3 = ((#0 - #1) - #2)
70 return 3; // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE]]:11 = ((#0 - #1) - #2)
76 if (i
== 2) // CHECK: Gap,File 0, [[@LINE-1]]:14 -> [[@LINE]]:5 = 0
78 } // CHECK: Gap,File 0, [[@LINE]]:4 -> [[@LINE+1]]:3 = ((#0 - #1) - #2)
79 return 0; // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE]]:11 = ((#0 - #1) - #2)
86 return 0; // CHECK: Gap,File 0, [[@LINE]]:14 -> [[@LINE+1]]:3 = #1
87 return 0; // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE]]:11 = #1
98 } // CHECK: Gap,File 0, [[@LINE]]:4 -> [[@LINE+1]]:3 = (#0 - #2)
99 return 1; // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE]]:11 = (#0 - #2)
104 return 0; // CHECK: Gap,File 0, [[@LINE]]:14 -> [[@LINE+1]]:5 = 0
105 if (i
== 2) { // CHECK-NEXT: File 0, [[@LINE]]:5 -> [[@LINE+3]]:4 = 0
108 } // CHECK: Gap,File 0, [[@LINE]]:4 -> [[@LINE+1]]:3 = (#0 - #1)
109 return 0; // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE]]:11 = (#0 - #1)
118 } // CHECK: Gap,File 0, [[@LINE]]:4 -> [[@LINE+1]]:3 = (#0 - #2)
119 return 0; // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE]]:11 = (#0 - #2)
124 return 0; // CHECK: Gap,File 0, [[@LINE]]:14 -> [[@LINE+1]]:5 = 0
125 while (i
< 10) { // CHECK-NEXT: File 0, [[@LINE]]:5 -> [[@LINE+3]]:4 = 0
128 } // CHECK: Gap,File 0, [[@LINE]]:4 -> [[@LINE+1]]:3 = (#0 - #1)
129 return 0; // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE]]:11 = (#0 - #1)
137 return 0; // CHECK-NOT: Gap,File 0, [[@LINE-1]]
143 // CHECK-LABEL: _Z3fooi:
147 } // CHECK-NOT: Gap,File 0, [[@LINE]]:4
148 //< Don't complete the last deferred region in a decl, even though it may
149 //< leave some whitespace marked with the same counter as the final return.
152 // CHECK-LABEL: _Z4foooi:
156 } // CHECK: Gap,File 0, [[@LINE]]:4 -> [[@LINE+2]]:3 = (#0 - #1)
160 } // CHECK-NOT: Gap,File 0, [[@LINE]]:4
164 // CHECK-LABEL: _Z3bazv:
165 void baz() { // CHECK: [[@LINE]]:12 -> [[@LINE+2]]:2
166 return; // CHECK-NOT: File
169 // CHECK-LABEL: _Z4maazv:
172 return; // CHECK: Gap,File 0, [[@LINE]]:12
174 return; // CHECK-NOT: Gap,File 0, [[@LINE]]
177 // CHECK-LABEL: _Z5maaazv:
181 } else { // CHECK: Gap,File 0, [[@LINE]]:4 -> [[@LINE]]:10
182 return; // CHECK-NOT: Gap,File 0, [[@LINE]]
186 // CHECK-LABEL: _Z3bari:
189 return; // CHECK: Gap,File 0, [[@LINE]]:12 -> [[@LINE+2]]:3 = (#0 - #1)
192 return; // CHECK: Gap,File 0, [[@LINE]]:12 -> [[@LINE+2]]:3 = ((#0 - #1) - #2)
197 // CHECK-LABEL: _Z4quuxi:
203 // CHECK: Gap,File 0, [[@LINE-2]]:13 -> [[@LINE+2]]:3 = (#0 - #1)
208 // CHECK: Gap,File 0, [[@LINE-2]]:18 -> [[@LINE+2]]:3 = ((#0 - #1) - #2)
214 // CHECK-NOT: [[@LINE-2]]:{{.*}} -> [[@LINE+2]]
221 // CHECK-LABEL: _Z8weird_ifv:
226 return; // CHECK: Gap,File 0, [[@LINE]]:12 -> [[@LINE+2]]:3 = (#0 - #1)
231 if (i
+ 100 > 0) { // CHECK: [[@LINE]]:20 -> [[@LINE+6]]:4 = #3
232 if (false) // CHECK: [[@LINE+1]]:7 -> [[@LINE+1]]:13 = #4
233 return; // CHECK: Gap,File 0, [[@LINE]]:14 -> [[@LINE+2]]:5 = (#3 - #4)
234 // CHECK: [[@LINE+1]]:5 -> [[@LINE+1]]:11 = (#3 - #4)
237 } // CHECK: Gap,File 0, [[@LINE]]:4 -> [[@LINE+2]]:3 = ((#0 - #1) - #3)
240 return; // CHECK-NOT: Gap,File 0, [[@LINE]]:11
243 // CHECK-LABEL: _Z8for_loopv:
246 return; // CHECK: Gap,File 0, [[@LINE]]:12 -> [[@LINE+2]]:3 = (#0 - #1)
248 for (int i
= 0; i
< 10; ++i
) {
250 continue; // CHECK: Gap,File 0, [[@LINE]]:16 -> [[@LINE+2]]:5 = (#2 - #3)
253 break; // CHECK: Gap,File 0, [[@LINE]]:13 -> [[@LINE+2]]:5 = ((#2 - #3) - #4)
255 int x
= i
; // CHECK: [[@LINE]]:5 -> [[@LINE+1]]:11 = ((#2 - #3) - #4)
256 return; // CHECK-NOT: [[@LINE]]:11 -> [[@LINE+2]]
263 // CHECK-LABEL: _Z10while_loopv:
266 return; // CHECK: Gap,File 0, [[@LINE]]:12 -> [[@LINE+2]]:3 = (#0 - #1)
271 continue; // CHECK: Gap,File 0, [[@LINE]]:16 -> [[@LINE+2]]:5 = (#2 - #3)
275 break; // CHECK: Gap,File 0, [[@LINE]]:15 -> [[@LINE+2]]:7 = (#4 - #5)
281 throw Error(); // CHECK: Gap,File 0, [[@LINE]]:21 -> [[@LINE+2]]:5 = ((#2 - #3) - #7)
285 break; // CHECK-NOT: [[@LINE]]:14 -> [[@LINE+2]]
291 // CHECK-LABEL: _Z5gotosv:
294 goto out
; // CHECK: Gap,File 0, [[@LINE]]:14 -> [[@LINE+2]]:3 = (#0 - #1)
296 return; // CHECK: [[@LINE]]:3 -> [[@LINE]]:9 = (#0 - #1)
299 return; // CHECK-NOT: Gap,File 0, [[@LINE]]:8
302 // CHECK-LABEL: _Z8switchesv:
309 return; // CHECK-NOT: Gap,File 0, [[@LINE]]
313 #include "deferred-region-helper.h"
314 // CHECK-LABEL: _Z13included_funcv:
315 // CHECK: Gap,File 0, 2:13 -> 3:5 = #1
316 // CHECK: Gap,File 0, 3:12 -> 4:3 = (#0 - #1)
318 // CHECK-LABEL: _Z7includev:
323 // CHECK-LABEL: _Z7ornoretv:
324 void abort() __attribute__((noreturn
));
327 ( true || (abort(), 0) ); // CHECK: Gap,File 0, [[@LINE]]:28 -> [[@LINE+1]]:3 = #0
328 ( false || (abort(), 0) ); // CHECK: Gap,File 0, [[@LINE]]:29 -> [[@LINE+1]]:3 = 0
332 // CHECK-LABEL: _Z17abstractcondnoretv:
333 int abstractcondnoret(void) {
334 ( true ? void (0) : abort() ); // CHECK: Gap,File 0, [[@LINE]]:33 -> [[@LINE+1]]:3 = #1
335 ( false ? void (0) : abort() ); // CHECK: Gap,File 0, [[@LINE]]:34 -> [[@LINE+1]]:3 = #2
336 ( true ? abort() : void (0) ); // CHECK: Gap,File 0, [[@LINE]]:33 -> [[@LINE+1]]:3 = (#2 - #3)
337 ( false ? abort() : void (0) ); // CHECK: Gap,File 0, [[@LINE]]:34 -> [[@LINE+1]]:3 = ((#2 - #3) - #4)
341 // CHECK-LABEL: _Z13elsecondnoretv:
342 int elsecondnoret(void) {
344 true ? void (0) : abort();
345 } // CHECK: Gap,File 0, [[@LINE]]:4 -> [[@LINE+1]]:3 = (#1 + #2)