Home | History | Annotate | Download | only in CoverageMapping
      1 // RUN: %clang_cc1 -fprofile-instr-generate -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -main-file-name test.c %s | FileCheck %s
      2 
      3 void bar();
      4 static void static_func();
      5 
      6                                  // CHECK: main
      7 int main() {                     // CHECK-NEXT: File 0, [[@LINE]]:12 -> [[@LINE+7]]:2 = #0
      8                                  // CHECK-NEXT: File 0, [[@LINE+1]]:18 -> [[@LINE+1]]:24 = (#0 + #1)
      9   for(int i = 0; i < 10; ++i) {  // CHECK-NEXT: File 0, [[@LINE]]:26 -> [[@LINE]]:29 = #1
     10     bar();                       // CHECK-NEXT: File 0, [[@LINE-1]]:31 -> [[@LINE+1]]:4 = #1
     11   }
     12   static_func();
     13   return 0;
     14 }
     15 
     16                                  // CHECK-NEXT: foo
     17 void foo() {                     // CHECK-NEXT: File 0, [[@LINE]]:12 -> [[@LINE+5]]:2 = #0
     18                                  // CHECK-NEXT: File 0, [[@LINE+1]]:6 -> [[@LINE+1]]:7 = #0
     19   if(1) {                        // CHECK-NEXT: File 0, [[@LINE]]:9 -> [[@LINE+2]]:4 = #1
     20     int i = 0;
     21   }
     22 }
     23 
     24                                  // CHECK-NEXT: bar
     25 void bar() {                     // CHECK-NEXT: File 0, [[@LINE]]:12 -> [[@LINE+1]]:2 = #0
     26 }
     27 
     28                                  // CHECK-NEXT: static_func
     29 void static_func() { }           // CHECK: File 0, [[@LINE]]:20 -> [[@LINE]]:23 = #0
     30 
     31                                  // CHECK-NEXT: func
     32 static void func() { }           // CHECK: File 0, [[@LINE]]:20 -> [[@LINE]]:23 = 0
     33