1 // RUN: %clang_cc1 -mllvm -emptyline-comment-coverage=false -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -main-file-name preprocessor.c %s | FileCheck %s
2 
3 // CHECK: func
func()4 void func() {    // CHECK: File 0, [[@LINE]]:13 -> [[@LINE+5]]:2 = #0
5   int i = 0;
6 #ifdef MACRO     // CHECK-NEXT: Skipped,File 0, [[@LINE]]:1 -> [[@LINE+2]]:7 = 0
7   int x = i;
8 #endif
9 }
10 
11                  // CHECK: main
main()12 int main() {     // CHECK-NEXT: File 0, [[@LINE]]:12 -> {{[0-9]+}}:2 = #0
13   int i = 0;
14 #if 0 // CHECK-NEXT: Skipped,File 0, [[@LINE]]:1 -> [[@LINE+4]]:29 = 0
15   if(i == 0) {
16     i = 1;
17   }
18 #  endif // Mark me skipped!
19 
20 #if 1
21                  // CHECK-NEXT: File 0, [[@LINE+1]]:6 -> [[@LINE+1]]:12 = #0
22   if(i == 0) {   // CHECK: File 0, [[@LINE]]:14 -> [[@LINE+2]]:4 = #1
23     i = 1;
24   }
25 #else            // CHECK-NEXT: Skipped,File 0, [[@LINE]]:1 -> [[@LINE+5]]:7 = 0
26   if(i == 1) {
27     i = 0;
28   }
29 }
30 #endif
31 
32   // CHECK-NEXT: Skipped,File 0, [[@LINE+1]]:1 -> [[@LINE+4]]:24
33 #\
34   if 0
35 #\
36   endif // also skipped
37 
38 #if 1
39   // CHECK-NEXT: Skipped,File 0, [[@LINE+1]]:1 -> [[@LINE+3]]:7
40 #\
41   elif 0
42 #endif
43 
44 #if 1
45   // CHECK-NEXT: Skipped,File 0, [[@LINE+1]]:1 -> [[@LINE+3]]:7
46 #\
47   else
48 #endif
49 
50   // CHECK-NEXT: Skipped,File 0, [[@LINE+1]]:1 -> [[@LINE+4]]:8
51 #\
52   ifdef NOT_DEFINED
53 #\
54   endif
55 
56   // CHECK-NEXT: Skipped,File 0, [[@LINE+1]]:1 -> [[@LINE+4]]:8
57 #\
58   ifndef __FILE__
59 #\
60   endif
61 
62   // CHECK-NEXT: Skipped,File 0, [[@LINE+1]]:1 -> [[@LINE+6]]:26
63 #\
64   ifdef NOT_DEFINED
65 #\
66   \
67    \
68     endif // also skipped
69 
70   return 0;
71 }
72