xref: /minix3/external/bsd/llvm/dist/clang/test/CoverageMapping/macroception.c (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -fprofile-instr-generate -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -main-file-name macroception.c %s | FileCheck %s
2*0a6a1f1dSLionel Sambuc 
3*0a6a1f1dSLionel Sambuc #define M2 {
4*0a6a1f1dSLionel Sambuc #define M1 M2
5*0a6a1f1dSLionel Sambuc #define M22 }
6*0a6a1f1dSLionel Sambuc #define M11 M22
7*0a6a1f1dSLionel Sambuc 
8*0a6a1f1dSLionel Sambuc // CHECK-LABEL: main:
9*0a6a1f1dSLionel Sambuc int main() M1       // CHECK-NEXT: Expansion,File 0, [[@LINE]]:12 -> [[@LINE]]:14 = #0 (HasCodeBefore = 0, Expanded file = 2)
10*0a6a1f1dSLionel Sambuc   return 0;         // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+1]]:2 = #0 (HasCodeBefore = 0)
11*0a6a1f1dSLionel Sambuc }
12*0a6a1f1dSLionel Sambuc // CHECK-NEXT: File 1, 3:12 -> 3:13 = #0 (HasCodeBefore = 0)
13*0a6a1f1dSLionel Sambuc // CHECK-NEXT: Expansion,File 2, 4:12 -> 4:14 = #0 (HasCodeBefore = 0, Expanded file = 1)
14*0a6a1f1dSLionel Sambuc 
15*0a6a1f1dSLionel Sambuc 
16*0a6a1f1dSLionel Sambuc // CHECK-LABEL: func2:
17*0a6a1f1dSLionel Sambuc void func2() {      // CHECK-NEXT: File 0, [[@LINE]]:14 -> [[@LINE+1]]:12 = #0 (HasCodeBefore = 0)
18*0a6a1f1dSLionel Sambuc   int x = 0;
19*0a6a1f1dSLionel Sambuc M11                 // CHECK-NEXT: Expansion,File 0, [[@LINE]]:1 -> [[@LINE]]:4 = #0 (HasCodeBefore = 0, Expanded file = 2)
20*0a6a1f1dSLionel Sambuc // CHECK-NEXT: File 1, 5:13 -> 5:14 = #0 (HasCodeBefore = 0)
21*0a6a1f1dSLionel Sambuc // CHECK-NEXT: Expansion,File 2, 6:13 -> 6:16 = #0 (HasCodeBefore = 0, Expanded file = 1)
22*0a6a1f1dSLionel Sambuc 
23*0a6a1f1dSLionel Sambuc // CHECK-LABEL: func3:
24*0a6a1f1dSLionel Sambuc void func3() M1     // CHECK-NEXT: Expansion,File 0, [[@LINE]]:14 -> [[@LINE]]:16 = #0 (HasCodeBefore = 0, Expanded file = 2)
25*0a6a1f1dSLionel Sambuc   int x = 0;        // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE]]:12 = #0 (HasCodeBefore = 0)
26*0a6a1f1dSLionel Sambuc M11                 // CHECK-NEXT: Expansion,File 0, [[@LINE]]:1 -> [[@LINE]]:4 = #0 (HasCodeBefore = 0, Expanded file = 4)
27*0a6a1f1dSLionel Sambuc 
28*0a6a1f1dSLionel Sambuc // CHECK-NEXT: File 1, 3:12 -> 3:13 = #0 (HasCodeBefore = 0)
29*0a6a1f1dSLionel Sambuc // CHECK-NEXT: Expansion,File 2, 4:12 -> 4:14 = #0 (HasCodeBefore = 0, Expanded file = 1)
30*0a6a1f1dSLionel Sambuc // CHECK-NEXT: File 3, 5:13 -> 5:14 = #0 (HasCodeBefore = 0)
31*0a6a1f1dSLionel Sambuc // CHECK-NEXT: Expansion,File 4, 6:13 -> 6:16 = #0 (HasCodeBefore = 0, Expanded file = 3)
32*0a6a1f1dSLionel Sambuc 
33*0a6a1f1dSLionel Sambuc // CHECK-LABEL: func4:
34*0a6a1f1dSLionel Sambuc // CHECK-NEXT: File 0, 3:12 -> 3:13 = #0 (HasCodeBefore = 0)
35*0a6a1f1dSLionel Sambuc // CHECK-NEXT: Expansion,File 1, 4:12 -> 4:14 = #0 (HasCodeBefore = 0, Expanded file = 0)
36*0a6a1f1dSLionel Sambuc void func4() M1 M11
37*0a6a1f1dSLionel Sambuc // CHECK-NEXT: Expansion,File 2, [[@LINE-1]]:14 -> [[@LINE-1]]:16 = #0 (HasCodeBefore = 0, Expanded file = 1)
38*0a6a1f1dSLionel Sambuc // CHECK-NEXT: Expansion,File 2, [[@LINE-2]]:17 -> [[@LINE-2]]:20 = #0 (HasCodeBefore = 0, Expanded file = 4)
39*0a6a1f1dSLionel Sambuc // CHECK-NEXT: File 3, 5:13 -> 5:14 = #0 (HasCodeBefore = 0)
40*0a6a1f1dSLionel Sambuc // CHECK-NEXT: Expansion,File 4, 6:13 -> 6:16 = #0 (HasCodeBefore = 0, Expanded file = 3)
41