Home | History | Annotate | Download | only in llvm-cov
      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
      6 int main() {                             // CHECK:   161| [[@LINE]]|int main(
      7   int x = 0;                             // CHECK:   161| [[@LINE]]|  int x
      8                                          // CHECK:   161| [[@LINE]]|
      9   if (x) {                               // CHECK:     0| [[@LINE]]|  if (x)
     10     x = 0;                               // CHECK:     0| [[@LINE]]|    x = 0
     11   } else {                               // CHECK:   161| [[@LINE]]|  } else
     12     x = 1;                               // CHECK:   161| [[@LINE]]|    x = 1
     13   }                                      // CHECK:   161| [[@LINE]]|  }
     14                                          // CHECK:   161| [[@LINE]]|
     15   for (int i = 0; i < 100; ++i) {        // CHECK: 16.2k| [[@LINE]]|  for (
     16     x = 1;                               // CHECK: 16.1k| [[@LINE]]|    x = 1
     17   }                                      // CHECK: 16.1k| [[@LINE]]|  }
     18                                          // CHECK:   161| [[@LINE]]|
     19   x = x < 10 ? x + 1 : x - 1;            // CHECK:   161| [[@LINE]]|  x =
     20   x = x > 10 ?                           // CHECK:   161| [[@LINE]]|  x =
     21         x - 1:                           // CHECK:     0| [[@LINE]]|        x
     22         x + 1;                           // CHECK:   161| [[@LINE]]|        x
     23                                          // CHECK:   161| [[@LINE]]|
     24   return 0;                              // CHECK:   161| [[@LINE]]|  return
     25 }                                        // CHECK:   161| [[@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