1 // RUN: llvm-cov show %S/Inputs/deferred-regions.covmapping -instr-profile %S/Inputs/deferred-regions.profdata -show-line-counts-or-regions -dump -path-equivalence=/tmp,%S %s 2>%t.markers > %t.out && FileCheck %s -input-file %t.out && FileCheck %s -input-file %t.markers -check-prefix=MARKER 2 3 void foo(int x) { 4 if (x == 0) { // CHECK: [[@LINE]]|{{ +}}2| 5 return; // CHECK-NEXT: [[@LINE]]|{{ +}}1| 6 } 7 8 } // CHECK: [[@LINE]]|{{ +}}1| 9 10 void bar() { 11 return; 12 13 } // CHECK: [[@LINE]]|{{ +}}1| 14 15 void for_loop() { 16 if (false) 17 return; // CHECK: [[@LINE]]|{{ +}}0| 18 19 for (int i = 0; i < 10; ++i) { // CHECK: [[@LINE]]|{{ +}}2| 20 if (i % 2 == 0) // CHECK: [[@LINE]]|{{ +}}2| 21 continue; // CHECK: [[@LINE]]|{{ +}}1| 22 23 if (i % 5 == 0) // CHECK: [[@LINE]]|{{ +}}1| 24 break; // CHECK: [[@LINE]]|{{ +}}0| 25 26 int x = i; 27 return; // CHECK: [[@LINE]]|{{ +}}1| 28 29 } // CHECK: [[@LINE]]|{{ +}}1| 30 } 31 32 struct Error {}; 33 34 void while_loop() { 35 if (false) 36 return; // CHECK: [[@LINE]]|{{ +}}0| 37 38 int x = 0; 39 while (++x < 10) { // CHECK: [[@LINE]]|{{ +}}3| 40 if (x == 1) // CHECK: [[@LINE]]|{{ +}}2| 41 continue; // CHECK: [[@LINE]]|{{ +}}1| 42 43 while (++x < 4) { // CHECK: [[@LINE]]|{{ +}}1| 44 if (x == 3) // CHECK: [[@LINE]]|{{ +}}1| 45 break; // CHECK: [[@LINE]]|{{ +}}1| 46 // CHECK: [[@LINE]]|{{ +}}0| 47 while (++x < 5) {} // CHECK: [[@LINE]]|{{ +}}0| 48 } // CHECK: [[@LINE]]|{{ +}}0| 49 50 if (x == 0) // CHECK: [[@LINE]]|{{ +}}1| 51 throw Error(); // CHECK: [[@LINE]]|{{ +}}0| 52 // CHECK: [[@LINE]]|{{ +}}1| 53 while (++x < 9) { // CHECK: [[@LINE]]|{{ +}}6| 54 if (x == 0) // CHECK: [[@LINE]]|{{ +}}5| 55 break; // CHECK: [[@LINE]]|{{ +}}0| 56 57 } 58 } 59 } 60 61 void gotos() { 62 if (false) // CHECK: [[@LINE]]|{{ +}}1| 63 goto out; // CHECK: [[@LINE]]|{{ +}}0| 64 // CHECK: [[@LINE]]|{{ +}}1| 65 return; // CHECK: [[@LINE]]|{{ +}}1| 66 67 out: // CHECK: [[@LINE]]|{{ +}}0| 68 return; 69 } 70 71 void if_else(bool flag) { 72 if (flag) { // CHECK: [[@LINE]]|{{ +}}2| 73 return; // CHECK: [[@LINE]]|{{ +}}1| 74 } else { // CHECK: [[@LINE]]|{{ +}}1| 75 return; // CHECK: [[@LINE]]|{{ +}}1| 76 } // CHECK: [[@LINE]]|{{ +}}1| 77 } 78 79 int main() { 80 foo(0); 81 foo(1); 82 bar(); 83 for_loop(); 84 while_loop(); 85 gotos(); 86 if_else(true); 87 if_else(false); 88 return 0; 89 } 90 91 // MARKER: Highlighted line 17, 5 -> 11 92 // MARKER-NEXT: Marker at 19:3 = 1 93 // MARKER-NEXT: Marker at 19:27 = 1 94 // MARKER-NEXT: Highlighted line 24, 7 -> 12 95 // MARKER-NEXT: Highlighted line 36, 5 -> 11 96 // MARKER-NEXT: Highlighted line 47, 7 -> 14 97 // MARKER-NEXT: Highlighted line 47, 14 -> 21 98 // MARKER-NEXT: Highlighted line 47, 21 -> 23 99 // MARKER-NEXT: Highlighted line 47, 23 -> 25 100 // MARKER-NEXT: Highlighted line 47, 25 -> ? 101 // MARKER-NEXT: Highlighted line 48, 1 -> 6 102 // MARKER-NEXT: Highlighted line 51, 7 -> 20 103 // MARKER-NEXT: Marker at 53:5 = 1 104 // MARKER-NEXT: Highlighted line 55, 9 -> 14 105 // MARKER-NEXT: Highlighted line 63, 5 -> 13 106 // MARKER-NEXT: Highlighted line 67, 1 -> ? 107 // MARKER-NEXT: Highlighted line 68, 1 -> 8 108