Home | History | Annotate | Download | only in llvm-cov
      1 // RUN: llvm-cov show %S/Inputs/highlightedRanges.covmapping -instr-profile %S/Inputs/highlightedRanges.profdata -dump -filename-equivalence %s 2>&1 | FileCheck %s
      2 
      3 void func() {
      4   return;
      5   int i = 0;                     // CHECK: Highlighted line [[@LINE]], 3 -> ?
      6 }                                // CHECK: Highlighted line [[@LINE]], 1 -> 2
      7 
      8 void func2(int x) {
      9   if(x > 5) {
     10     while(x >= 9) {
     11       return;
     12       --x;                       // CHECK: Highlighted line [[@LINE]], 7 -> ?
     13     }                            // CHECK: Highlighted line [[@LINE]], 1 -> 6
     14     int i = 0;                   // CHECK: Highlighted line [[@LINE]], 5 -> ?
     15   }                              // CHECK: Highlighted line [[@LINE]], 1 -> 4
     16 }
     17 
     18 void test() {
     19   int x = 0;
     20 
     21   if (x) {                       // CHECK: Highlighted line [[@LINE]], 10 -> ?
     22     x = 0;                       // CHECK: Highlighted line [[@LINE]], 1 -> ?
     23   } else {                       // CHECK: Highlighted line [[@LINE]], 1 -> 4
     24     x = 1;
     25   }
     26 
     27                                   // CHECK: Highlighted line [[@LINE+1]], 26 -> 29
     28   for (int i = 0; i < 0; ++i) {   // CHECK: Highlighted line [[@LINE]], 31 -> ?
     29     x = 1;                        // CHECK: Highlighted line [[@LINE]], 1 -> ?
     30   }                               // CHECK: Highlighted line [[@LINE]], 1 -> 4
     31 
     32   x = x < 10 ? x +
     33                1
     34              : x - 1;             // CHECK: Highlighted line [[@LINE]], 16 -> 21
     35   x = x > 10 ? x +                // CHECK: Highlighted line [[@LINE]], 16 -> ?
     36                1                  // CHECK: Highlighted line [[@LINE]], 1 -> 17
     37              : x - 1;
     38 }
     39 
     40 int main() {
     41   test();
     42   func();
     43   func2(9);
     44   return 0;
     45 }
     46