[ELF] Reorder SectionBase/InputSectionBase members
[llvm-project.git] / clang / test / CoverageMapping / loops.cpp
blob60bb2a5fbd8d2fbb9b74f85aab3e1d6bdfb5ec72
1 // RUN: %clang_cc1 -mllvm -emptyline-comment-coverage=false -std=c++11 -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -main-file-name loops.cpp %s | FileCheck %s
3 // CHECK: rangedFor
4 void rangedFor() { // CHECK-NEXT: File 0, [[@LINE]]:18 -> {{[0-9]+}}:2 = #0
5 int arr[] = { 1, 2, 3, 4, 5 };
6 int sum = 0; // CHECK-NEXT: Branch,File 0, [[@LINE+2]]:14 -> [[@LINE+2]]:15 = #1, (#0 - #3)
7 // CHECK: Gap,File 0, [[@LINE+1]]:20 -> [[@LINE+1]]:21 = #1
8 for(auto i : arr) { // CHECK: File 0, [[@LINE]]:21 -> [[@LINE+6]]:4 = #1
9 if (i == 3)
10 continue; // CHECK: File 0, [[@LINE]]:7 -> [[@LINE]]:15 = #2
11 sum += i; // CHECK: File 0, [[@LINE]]:5 -> {{[0-9]+}}:4 = (#1 - #2)
12 if (sum >= 7)
13 break; // CHECK: File 0, [[@LINE]]:7 -> [[@LINE]]:12 = #3
16 // CHECK: File 0, [[@LINE+1]]:7 -> [[@LINE+1]]:10 = #0
17 if (sum) {}
20 // CHECK: main:
21 int main() { // CHECK-NEXT: File 0, [[@LINE]]:12 -> {{.*}}:2 = #0
22 // CHECK-NEXT: File 0, [[@LINE+1]]:18 -> [[@LINE+1]]:24 = (#0 + #1)
23 for(int i = 0; i < 10; ++i) // CHECK-NEXT: Branch,File 0, [[@LINE]]:18 -> [[@LINE]]:24 = #1, #0
24 ; // CHECK-NEXT: File 0, [[@LINE-1]]:26 -> [[@LINE-1]]:29 = #1
25 // CHECK-NEXT: Gap,File 0, [[@LINE-2]]:30 -> [[@LINE-1]]:6 = #1
26 // CHECK-NEXT: File 0, [[@LINE-2]]:6 -> [[@LINE-2]]:7 = #1
27 for(int i = 0;
28 i < 10; // CHECK-NEXT: File 0, [[@LINE]]:7 -> [[@LINE]]:13 = (#0 + #2)
29 ++i) // CHECK-NEXT: Branch,File 0, [[@LINE-1]]:7 -> [[@LINE-1]]:13 = #2, #0
30 // CHECK-NEXT: File 0, [[@LINE-1]]:7 -> [[@LINE-1]]:10 = #2
31 { // CHECK-NEXT: Gap,File 0, [[@LINE-2]]:11 -> [[@LINE]]:3 = #2
32 int x = 0; // CHECK-NEXT: File 0, [[@LINE-1]]:3 -> [[@LINE+1]]:4 = #2
34 int j = 0; // CHECK-NEXT: File 0, [[@LINE+2]]:9 -> [[@LINE+2]]:14 = (#0 + #3)
35 // CHECK-NEXT: Branch,File 0, [[@LINE+1]]:9 -> [[@LINE+1]]:14 = #3, #0
36 while(j < 5) ++j; // CHECK-NEXT: Gap,File 0, [[@LINE]]:15 -> [[@LINE]]:16 = #3
37 // CHECK-NEXT: File 0, [[@LINE-1]]:16 -> [[@LINE-1]]:19 = #3
39 do { // CHECK-NEXT: File 0, [[@LINE]]:6 -> [[@LINE+2]]:4 = (#0 + #4)
40 ++j;
41 } while(j < 10); // CHECK-NEXT: File 0, [[@LINE]]:11 -> [[@LINE]]:17 = (#0 + #4)
42 // CHECK-NEXT: Branch,File 0, [[@LINE-1]]:11 -> [[@LINE-1]]:17 = #4, #0
43 j = 0;
44 while // CHECK-NEXT: File 0, [[@LINE+1]]:5 -> [[@LINE+1]]:10 = (#0 + #5)
45 (j < 5) // CHECK-NEXT: Branch,File 0, [[@LINE]]:5 -> [[@LINE]]:10 = #5, #0
46 ++j; // CHECK-NEXT: Gap,File 0, [[@LINE-1]]:11 -> [[@LINE]]:6 = #5
47 do // CHECK-NEXT: File 0, [[@LINE-1]]:6 -> [[@LINE-1]]:9 = #5
48 ++j; // CHECK-NEXT: File 0, [[@LINE]]:5 -> [[@LINE]]:8 = (#0 + #6)
49 while(j < 10); // CHECK-NEXT: File 0, [[@LINE]]:9 -> [[@LINE]]:15 = (#0 + #6)
50 // CHECK-NEXT: Branch,File 0, [[@LINE-1]]:9 -> [[@LINE-1]]:15 = #6, #0
51 rangedFor();
52 return 0;