Home | History | Annotate | Download | only in CoverageMapping
      1 // RUN: %clang_cc1 -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -main-file-name includehell.cpp %s > %tmapping
      2 
      3 int main() {
      4   int x = 0;
      5 
      6   #include "Inputs/starts_a_scope"
      7     x = x;
      8     #include "Inputs/code.h"
      9     x = x;
     10   #include "Inputs/ends_a_scope"
     11 
     12   #include "Inputs/starts_a_scope"
     13     #include "Inputs/code.h"
     14   #include "Inputs/ends_a_scope"
     15 
     16   #include "Inputs/starts_a_scope"
     17   #include "Inputs/ends_a_scope"
     18 
     19   return 0;
     20 }
     21 
     22 // RUN: FileCheck -input-file %tmapping %s --check-prefix=CHECK-MAIN
     23 // RUN: FileCheck -input-file %tmapping %s --check-prefix=CHECK-START
     24 // RUN: FileCheck -input-file %tmapping %s --check-prefix=CHECK-CODE
     25 // RUN: FileCheck -input-file %tmapping %s --check-prefix=CHECK-END
     26 
     27 // CHECK-MAIN: File [[MAIN:[0-9]]], 3:12 -> 20:2 = #0
     28 // CHECK-MAIN-NEXT: Expansion,File [[MAIN]], 6:12 -> 6:35 = #0
     29 // CHECK-MAIN-NEXT: File [[MAIN]], 6:35 -> 10:33 = #1
     30 // CHECK-MAIN-NEXT: Expansion,File [[MAIN]], 8:14 -> 8:29 = #1
     31 // CHECK-MAIN-NEXT: Expansion,File [[MAIN]], 10:12 -> 10:33 = #1
     32 // CHECK-MAIN-NEXT: Expansion,File [[MAIN]], 12:12 -> 12:35 = #0
     33 // CHECK-MAIN-NEXT: File [[MAIN]], 12:35 -> 14:33 = #5
     34 // CHECK-MAIN-NEXT: Expansion,File [[MAIN]], 13:14 -> 13:29 = #5
     35 // CHECK-MAIN-NEXT: Expansion,File [[MAIN]], 14:12 -> 14:33 = #5
     36 // CHECK-MAIN-NEXT: Expansion,File [[MAIN]], 16:12 -> 16:35 = #0
     37 // CHECK-MAIN-NEXT: File [[MAIN]], 16:35 -> 17:33 = #9
     38 // CHECK-MAIN-NEXT: Expansion,File [[MAIN]], 17:12 -> 17:33 = #9
     39 
     40 // CHECK-START:      File [[START1:[0-9]]], 1:1 -> 5:1 = #0
     41 // CHECK-START-NEXT: File [[START1]], 4:17 -> 4:22 = (#0 + #1)
     42 // CHECK-START-NEXT: File [[START1]], 4:24 -> 4:27 = #1
     43 // CHECK-START-NEXT: File [[START1]], 4:29 -> 5:1 = #1
     44 // CHECK-START:      File [[START2:[0-9]]], 1:1 -> 5:1 = #0
     45 // CHECK-START-NEXT: File [[START2]], 4:17 -> 4:22 = (#0 + #5)
     46 // CHECK-START-NEXT: File [[START2]], 4:24 -> 4:27 = #5
     47 // CHECK-START-NEXT: File [[START2]], 4:29 -> 5:1 = #5
     48 // CHECK-START:      File [[START3:[0-9]]], 1:1 -> 5:1 = #0
     49 // CHECK-START-NEXT: File [[START3]], 4:17 -> 4:22 = (#0 + #9)
     50 // CHECK-START-NEXT: File [[START3]], 4:24 -> 4:27 = #9
     51 // CHECK-START-NEXT: File [[START3]], 4:29 -> 5:1 = #9
     52 
     53 // CHECK-CODE:      File [[CODE1:[0-9]]], 1:1 -> 14:1 = #1
     54 // CHECK-CODE-NEXT: File [[CODE1]], 4:5 -> 4:11 = #1
     55 // CHECK-CODE-NEXT: File [[CODE1]], 4:13 -> 6:2 = #2
     56 // CHECK-CODE-NEXT: File [[CODE1]], 6:8 -> 8:2 = (#1 - #2)
     57 // CHECK-CODE-NEXT: File [[CODE1]], 9:5 -> 9:9 = #1
     58 // CHECK-CODE-NEXT: File [[CODE1]], 9:11 -> 11:2 = #3
     59 // CHECK-CODE-NEXT: File [[CODE1]], 11:8 -> 13:2 = (#1 - #3)
     60 // CHECK-CODE:      File [[CODE2:[0-9]]], 1:1 -> 14:1 = #5
     61 // CHECK-CODE-NEXT: File [[CODE2]], 4:5 -> 4:11 = #5
     62 // CHECK-CODE-NEXT: File [[CODE2]], 4:13 -> 6:2 = #6
     63 // CHECK-CODE-NEXT: File [[CODE2]], 6:8 -> 8:2 = (#5 - #6)
     64 // CHECK-CODE-NEXT: File [[CODE2]], 9:5 -> 9:9 = #5
     65 // CHECK-CODE-NEXT: File [[CODE2]], 9:11 -> 11:2 = #7
     66 // CHECK-CODE-NEXT: File [[CODE2]], 11:8 -> 13:2 = (#5 - #7)
     67 
     68 // CHECK-END:      File [[END1:[0-9]]], 1:1 -> 3:2 = #1
     69 // CHECK-END-NEXT: File [[END1]], 1:1 -> 6:1 = #0
     70 // CHECK-END-NEXT: File [[END1]], 5:5 -> 5:9 = #0
     71 // CHECK-END-NEXT: File [[END1]], 5:11 -> 5:16 = #4
     72 // CHECK-END:      File [[END2:[0-9]]], 1:1 -> 3:2 = #5
     73 // CHECK-END-NEXT: File [[END2]], 1:1 -> 6:1 = #0
     74 // CHECK-END-NEXT: File [[END2]], 5:5 -> 5:9 = #0
     75 // CHECK-END-NEXT: File [[END2]], 5:11 -> 5:16 = #8
     76 // CHECK-END:      File [[END3:[0-9]]], 1:1 -> 3:2 = #9
     77 // CHECK-END-NEXT: File [[END3]], 1:1 -> 6:1 = #0
     78 // CHECK-END-NEXT: File [[END3]], 5:5 -> 5:9 = #0
     79 // CHECK-END-NEXT: File [[END3]], 5:11 -> 5:16 = #10
     80