xref: /minix3/external/bsd/llvm/dist/clang/test/CoverageMapping/macros.c (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -fprofile-instr-generate -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -main-file-name macros.c %s | FileCheck %s
2*0a6a1f1dSLionel Sambuc 
3*0a6a1f1dSLionel Sambuc void bar();
4*0a6a1f1dSLionel Sambuc #define MACRO return; bar()
5*0a6a1f1dSLionel Sambuc #define MACRO_2 bar()
6*0a6a1f1dSLionel Sambuc #define MACRO_1 return; MACRO_2
7*0a6a1f1dSLionel Sambuc 
8*0a6a1f1dSLionel Sambuc                // CHECK: func
func()9*0a6a1f1dSLionel Sambuc void func() {  // CHECK-NEXT: File 0, [[@LINE]]:13 -> [[@LINE+4]]:2 = #0 (HasCodeBefore = 0)
10*0a6a1f1dSLionel Sambuc   int i = 0;
11*0a6a1f1dSLionel Sambuc   MACRO;       // CHECK-NEXT: Expansion,File 0, [[@LINE]]:3 -> [[@LINE]]:8 = #0 (HasCodeBefore = 0, Expanded file = 1)
12*0a6a1f1dSLionel Sambuc   i = 2;       // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE]]:8 = 0 (HasCodeBefore = 0)
13*0a6a1f1dSLionel Sambuc }
14*0a6a1f1dSLionel Sambuc // CHECK-NEXT: File 1, 4:15 -> 4:21 = #0 (HasCodeBefore = 0)
15*0a6a1f1dSLionel Sambuc // CHECK-NEXT: File 1, 4:23 -> 4:28 = 0 (HasCodeBefore = 0)
16*0a6a1f1dSLionel Sambuc 
17*0a6a1f1dSLionel Sambuc                // CHECK-NEXT: func2
func2()18*0a6a1f1dSLionel Sambuc void func2() { // CHECK-NEXT: File 0, [[@LINE]]:14 -> [[@LINE+4]]:2 = #0 (HasCodeBefore = 0)
19*0a6a1f1dSLionel Sambuc   int i = 0;
20*0a6a1f1dSLionel Sambuc   MACRO_1;     // CHECK-NEXT: Expansion,File 0, [[@LINE]]:3 -> [[@LINE]]:10 = #0 (HasCodeBefore = 0, Expanded file = 1)
21*0a6a1f1dSLionel Sambuc   i = 2;       // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE]]:8 = 0 (HasCodeBefore = 0)
22*0a6a1f1dSLionel Sambuc }
23*0a6a1f1dSLionel Sambuc // CHECK-NEXT: File 1, 6:17 -> 6:23 = #0 (HasCodeBefore = 0)
24*0a6a1f1dSLionel Sambuc // CHECK-NEXT: Expansion,File 1, 6:25 -> 6:32 = 0 (HasCodeBefore = 0, Expanded file = 2)
25*0a6a1f1dSLionel Sambuc // CHECK-NEXT: File 2, 5:17 -> 5:22 = 0 (HasCodeBefore = 0)
26*0a6a1f1dSLionel Sambuc 
27