1 // Basic handling of line counts.
2 // RUN: llvm-profdata merge %S/Inputs/lineExecutionCounts.proftext -o %t.profdata
3 
4 // before any coverage              // WHOLE-FILE:    | [[@LINE]]|// before
5                                     // FILTER-NOT:    | [[@LINE-1]]|// before
main()6 int main() {                             // CHECK:   1| [[@LINE]]|int main(
7   int x = 0;                             // CHECK:   1| [[@LINE]]|  int x
8                                          // CHECK:   1| [[@LINE]]|
9   if (x) {                               // CHECK:   0| [[@LINE]]|  if (x)
10     x = 0;                               // CHECK:   0| [[@LINE]]|    x = 0
11   } else {                               // CHECK:   1| [[@LINE]]|  } else
12     x = 1;                               // CHECK:   1| [[@LINE]]|    x = 1
13   }                                      // CHECK:   1| [[@LINE]]|  }
14                                          // CHECK:   1| [[@LINE]]|
15   for (int i = 0; i < 100; ++i) {        // CHECK: 101| [[@LINE]]|  for (
16     x = 1;                               // CHECK: 100| [[@LINE]]|    x = 1
17   }                                      // CHECK: 100| [[@LINE]]|  }
18                                          // CHECK:   1| [[@LINE]]|
19   x = x < 10 ? x + 1 : x - 1;            // CHECK:   1| [[@LINE]]|  x =
20   x = x > 10 ?                           // CHECK:   1| [[@LINE]]|  x =
21         x - 1:                           // CHECK:   0| [[@LINE]]|        x
22         x + 1;                           // CHECK:   1| [[@LINE]]|        x
23                                          // CHECK:   1| [[@LINE]]|
24   return 0;                              // CHECK:   1| [[@LINE]]|  return
25 }                                        // CHECK:   1| [[@LINE]]|}
26 // after coverage                   // WHOLE-FILE:    | [[@LINE]]|// after
27                                     // FILTER-NOT:    | [[@LINE-1]]|// after
28 
29 // RUN: llvm-cov show %S/Inputs/lineExecutionCounts.covmapping -instr-profile %t.profdata -filename-equivalence %s | FileCheck -check-prefix=CHECK -check-prefix=WHOLE-FILE %s
30 // RUN: llvm-cov show %S/Inputs/lineExecutionCounts.covmapping -instr-profile %t.profdata -filename-equivalence -name=main %s | FileCheck -check-prefix=CHECK -check-prefix=FILTER %s
31