1 // RUN: %clang_cc1 -fprofile-instr-generate -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -main-file-name macros.c %s | FileCheck %s
2
3 #define MACRO return; bar()
4 #define MACRO_2 bar()
5 #define MACRO_1 return; MACRO_2
6
bar()7 void bar() {}
8
9 // CHECK: func
func()10 void func() { // CHECK-NEXT: File 0, [[@LINE]]:13 -> [[@LINE+5]]:2 = #0
11 int i = 0;
12 // CHECK-NEXT: Expansion,File 0, [[@LINE+1]]:3 -> [[@LINE+1]]:8 = #0
13 MACRO; // CHECK-NEXT: File 0, [[@LINE]]:8 -> [[@LINE+2]]:2 = 0
14 i = 2;
15 }
16 // CHECK-NEXT: File 1, 3:15 -> 3:28 = #0
17 // CHECK-NEXT: File 1, 3:23 -> 3:28 = 0
18
19 // CHECK-NEXT: func2
func2()20 void func2() { // CHECK-NEXT: File 0, [[@LINE]]:14 -> [[@LINE+5]]:2 = #0
21 int i = 0;
22 // CHECK-NEXT: Expansion,File 0, [[@LINE+1]]:3 -> [[@LINE+1]]:10 = #0
23 MACRO_1; // CHECK-NEXT: File 0, [[@LINE]]:10 -> [[@LINE+2]]:2 = 0
24 i = 2;
25 }
26 // CHECK-NEXT: File 1, 5:17 -> 5:32 = #0
27 // CHECK-NEXT: File 1, 5:25 -> 5:32 = 0
28 // CHECK-NEXT: Expansion,File 1, 5:25 -> 5:32 = 0
29 // CHECK-NEXT: File 2, 4:17 -> 4:22 = 0
30
31 // CHECK-NEXT: func3
func3()32 void func3() { // CHECK-NEXT: File 0, [[@LINE]]:14 -> [[@LINE+3]]:2 = #0
33 MACRO_2; // CHECK-NEXT: Expansion,File 0, [[@LINE]]:3 -> [[@LINE]]:10 = #0
34 MACRO_2; // CHECK-NEXT: Expansion,File 0, [[@LINE]]:3 -> [[@LINE]]:10 = #0
35 }
36 // CHECK-NEXT: File 1, 4:17 -> 4:22 = #0
37 // CHECK-NEXT: File 2, 4:17 -> 4:22 = #0
38
main(int argc,const char * argv[])39 int main(int argc, const char *argv[]) {
40 func();
41 func2();
42 func3();
43 }
44