xref: /minix3/external/bsd/llvm/dist/clang/test/CoverageMapping/break.c (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -fprofile-instr-generate -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -main-file-name break.c %s | FileCheck %s
2*0a6a1f1dSLionel Sambuc 
main()3*0a6a1f1dSLionel Sambuc int main() {         // CHECK: File 0, [[@LINE]]:12 -> [[@LINE+28]]:2 = #0 (HasCodeBefore = 0)
4*0a6a1f1dSLionel Sambuc   int cnt = 0;       // CHECK-NEXT: File 0, [[@LINE+1]]:9 -> [[@LINE+1]]:18 = #0 (HasCodeBefore = 0)
5*0a6a1f1dSLionel Sambuc   while(cnt < 100) { // CHECK-NEXT: File 0, [[@LINE]]:20 -> [[@LINE+3]]:4 = #1 (HasCodeBefore = 0)
6*0a6a1f1dSLionel Sambuc     break;
7*0a6a1f1dSLionel Sambuc     ++cnt;           // CHECK-NEXT: File 0, [[@LINE]]:5 -> [[@LINE]]:10 = 0 (HasCodeBefore = 0)
8*0a6a1f1dSLionel Sambuc   }                  // CHECK-NEXT: File 0, [[@LINE+1]]:9 -> [[@LINE+1]]:18 = #0 (HasCodeBefore = 0)
9*0a6a1f1dSLionel Sambuc   while(cnt < 100) { // CHECK-NEXT: File 0, [[@LINE]]:20 -> [[@LINE+6]]:4 = #2 (HasCodeBefore = 0)
10*0a6a1f1dSLionel Sambuc     {
11*0a6a1f1dSLionel Sambuc       break;
12*0a6a1f1dSLionel Sambuc       ++cnt;         // CHECK-NEXT: File 0, [[@LINE]]:7 -> [[@LINE+2]]:10 = 0 (HasCodeBefore = 0)
13*0a6a1f1dSLionel Sambuc     }
14*0a6a1f1dSLionel Sambuc     ++cnt;
15*0a6a1f1dSLionel Sambuc   }                  // CHECK-NEXT: File 0, [[@LINE+1]]:9 -> [[@LINE+1]]:18 = ((#0 + #3) - #4) (HasCodeBefore = 0)
16*0a6a1f1dSLionel Sambuc   while(cnt < 100) { // CHECK-NEXT: File 0, [[@LINE]]:20 -> [[@LINE+6]]:4 = #3 (HasCodeBefore = 0)
17*0a6a1f1dSLionel Sambuc     if(cnt == 0) {   // CHECK-NEXT: File 0, [[@LINE]]:18 -> [[@LINE+3]]:6 = #4 (HasCodeBefore = 0)
18*0a6a1f1dSLionel Sambuc       break;
19*0a6a1f1dSLionel Sambuc       ++cnt;         // CHECK-NEXT: File 0, [[@LINE]]:7 -> [[@LINE]]:12 = 0 (HasCodeBefore = 0)
20*0a6a1f1dSLionel Sambuc     }
21*0a6a1f1dSLionel Sambuc     ++cnt;           // CHECK-NEXT: File 0, [[@LINE]]:5 -> [[@LINE]]:10 = (#3 - #4) (HasCodeBefore = 0)
22*0a6a1f1dSLionel Sambuc   }                  // CHECK-NEXT: File 0, [[@LINE+1]]:9 -> [[@LINE+1]]:18 = (#0 + #6) (HasCodeBefore = 0)
23*0a6a1f1dSLionel Sambuc   while(cnt < 100) { // CHECK-NEXT: File 0, [[@LINE]]:20 -> [[@LINE+7]]:4 = #5 (HasCodeBefore = 0)
24*0a6a1f1dSLionel Sambuc     if(cnt == 0) {   // CHECK-NEXT: File 0, [[@LINE]]:18 -> [[@LINE+5]]:10 = #6 (HasCodeBefore = 0)
25*0a6a1f1dSLionel Sambuc       ++cnt;
26*0a6a1f1dSLionel Sambuc     } else {         // CHECK-NEXT: File 0, [[@LINE]]:12 -> [[@LINE+2]]:6 = (#5 - #6) (HasCodeBefore = 0)
27*0a6a1f1dSLionel Sambuc       break;
28*0a6a1f1dSLionel Sambuc     }
29*0a6a1f1dSLionel Sambuc     ++cnt;
30*0a6a1f1dSLionel Sambuc   }
31*0a6a1f1dSLionel Sambuc }
32