1 // RUN: %clang_cc1 -mllvm -emptyline-comment-coverage=false -std=c++11 -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -main-file-name macro-expressions.cpp -w %s | FileCheck %s
6 #define ASSIGN(x, y) x = y
9 #define ARR(T, x, y, z) (T[3]){x, y, z}
11 #define PRI_64_LENGTH_MODIFIER "ll"
12 #define PRIo64 PRI_64_LENGTH_MODIFIER "o"
13 #define PRIu64 PRI_64_LENGTH_MODIFIER "u"
54 // CHECK-NEXT: File 0, [[@LINE+1]]:17 -> {{[0-9]+}}:2 = #0
56 // CHECK-NEXT: File 0, [[@LINE+3]]:7 -> [[@LINE+3]]:8 = #0
57 // CHECK: Gap,File 0, [[@LINE+2]]:9 -> [[@LINE+2]]:10 = #1
58 // CHECK-NEXT: File 0, [[@LINE+1]]:10 -> [[@LINE+1]]:12 = #1
61 // CHECK-NEXT: Expansion,File 0, [[@LINE+3]]:7 -> [[@LINE+3]]:11 = #0
62 // CHECK-NEXT: Gap,File 0, [[@LINE+2]]:15 -> [[@LINE+2]]:16 = #2
63 // CHECK-NEXT: File 0, [[@LINE+1]]:16 -> [[@LINE+1]]:18 = #2
65 // CHECK-NEXT: Expansion,File 0, [[@LINE+3]]:9 -> [[@LINE+3]]:14 = (#0 + #3)
66 // CHECK-NEXT: Gap,File 0, [[@LINE+2]]:19 -> [[@LINE+2]]:20 = #3
67 // CHECK-NEXT: File 0, [[@LINE+1]]:20 -> [[@LINE+1]]:22 = #3
69 // CHECK-NEXT: Expansion,File 0, [[@LINE+5]]:8 -> [[@LINE+5]]:14 = #0
70 // CHECK-NEXT: Expansion,File 0, [[@LINE+4]]:33 -> [[@LINE+4]]:35 = (#0 + #4)
71 // CHECK-NEXT: Expansion,File 0, [[@LINE+3]]:43 -> [[@LINE+3]]:46 = #4
72 // CHECK-NEXT: Gap,File 0, [[@LINE+2]]:50 -> [[@LINE+2]]:51 = #4
73 // CHECK: File 0, [[@LINE+1]]:51 -> [[@LINE+1]]:53 = #4
74 for (ASSIGN(DECL(int, j
), 0); LT(j
, i
); INC(j
)) {}
75 // CHECK-NEXT: Expansion,File 0, [[@LINE+1]]:3 -> [[@LINE+1]]:9 = #0
76 ASSIGN(DECL(int, k
), 0);
77 // CHECK-NEXT: Expansion,File 0, [[@LINE+4]]:10 -> [[@LINE+4]]:12 = (#0 + #5)
78 // CHECK-NEXT: Gap,File 0, [[@LINE+3]]:19 -> [[@LINE+3]]:20 = #5
79 // CHECK-NEXT: File 0, [[@LINE+2]]:20 -> [[@LINE+2]]:31 = #5
80 // CHECK-NEXT: Expansion,File 0, [[@LINE+1]]:22 -> [[@LINE+1]]:25 = #5
81 while (LT(k
, i
)) { INC(k
); }
82 // CHECK-NEXT: File 0, [[@LINE+2]]:6 -> [[@LINE+2]]:8 = (#0 + #6)
83 // CHECK-NEXT: Expansion,File 0, [[@LINE+1]]:16 -> [[@LINE+1]]:21 = (#0 + #6)
84 do {} while (NEXPR(i
));
85 // CHECK-NEXT: Expansion,File 0, [[@LINE+5]]:8 -> [[@LINE+5]]:12 = #0
86 // CHECK-NEXT: Branch,File 0, [[@LINE+4]]:21 -> [[@LINE+4]]:22 = #7, #0
87 // CHECK-NEXT: Expansion,File 0, [[@LINE+3]]:23 -> [[@LINE+3]]:26 = #0
88 // CHECK-NEXT: Gap,File 0, [[@LINE+2]]:41 -> [[@LINE+2]]:42 = #7
89 // CHECK: File 0, [[@LINE+1]]:42 -> [[@LINE+1]]:44 = #7
90 for (DECL(int, j
) : ARR(int, 1, 2, 3)) {}
92 // CHECK-NEXT: File 0, [[@LINE+5]]:10 -> [[@LINE+5]]:11 = #0
93 // CHECK-NEXT: Branch,File 0, [[@LINE+4]]:10 -> [[@LINE+4]]:11 = #8, (#0 - #8)
94 // CHECK-NEXT: Gap,File 0, [[@LINE+3]]:13 -> [[@LINE+3]]:14 = #8
95 // CHECK-NEXT: Expansion,File 0, [[@LINE+2]]:14 -> [[@LINE+2]]:20 = #0
96 // CHECK-NEXT: Expansion,File 0, [[@LINE+1]]:23 -> [[@LINE+1]]:29 = #0
97 (void)(i
? PRIo64
: PRIu64
);
99 // CHECK-NEXT: File 0, [[@LINE+6]]:10 -> [[@LINE+6]]:11 = #0
100 // CHECK: File 0, [[@LINE+5]]:14 -> [[@LINE+5]]:15 = #9
101 // CHECK-NEXT: File 0, [[@LINE+4]]:18 -> [[@LINE+4]]:33 = (#0 - #9)
102 // CHECK-NEXT: Expansion,File 0, [[@LINE+3]]:18 -> [[@LINE+3]]:22 = (#0 - #9)
103 // CHECK: File 0, [[@LINE+2]]:28 -> [[@LINE+2]]:29 = #10
104 // CHECK-NEXT: File 0, [[@LINE+1]]:32 -> [[@LINE+1]]:33 = ((#0 - #9) - #10)
105 (void)(i
? i
: EXPR(i
) ? i
: 0);
106 // CHECK-NEXT: File 0, [[@LINE+5]]:10 -> [[@LINE+5]]:11 = #0
107 // CHECK-NEXT: Branch,File 0, [[@LINE+4]]:10 -> [[@LINE+4]]:11 = #11, (#0 - #11)
108 // CHECK-NEXT: File 0, [[@LINE+3]]:15 -> [[@LINE+3]]:27 = (#0 - #11)
109 // CHECK-NEXT: Expansion,File 0, [[@LINE+2]]:15 -> [[@LINE+2]]:19 = (#0 - #11)
110 // CHECK-NEXT: File 0, [[@LINE+1]]:26 -> [[@LINE+1]]:27 = ((#0 - #11) - #12)
111 (void)(i
?: EXPR(i
) ?: 0);
114 // CHECK-NEXT: File {{[0-9]+}}, 3:17 -> 3:20 = #0
115 // CHECK-NEXT: Branch,File {{[0-9]+}}, 3:17 -> 3:20 = #2, (#0 - #2)
116 // CHECK-NEXT: File {{[0-9]+}}, 4:18 -> 4:22 = (#0 + #3)
117 // CHECK-NEXT: Branch,File {{[0-9]+}}, 4:18 -> 4:22 = #3, #0
118 // CHECK-NEXT: File {{[0-9]+}}, 6:22 -> 6:27 = #0
119 // CHECK-NEXT: File {{[0-9]+}}, 8:16 -> 8:19 = #4
120 // CHECK-NEXT: File {{[0-9]+}}, 7:18 -> 7:23 = (#0 + #4)
121 // CHECK-NEXT: Branch,File {{[0-9]+}}, 7:18 -> 7:23 = #4, #0
122 // CHECK-NEXT: File {{[0-9]+}}, 6:22 -> 6:27 = #0
123 // CHECK-NEXT: File {{[0-9]+}}, 8:16 -> 8:19 = #5
124 // CHECK-NEXT: File {{[0-9]+}}, 7:18 -> 7:23 = (#0 + #5)
125 // CHECK-NEXT: Branch,File {{[0-9]+}}, 7:18 -> 7:23 = #5, #0
126 // CHECK-NEXT: File {{[0-9]+}}, 4:18 -> 4:22 = (#0 + #6)
127 // CHECK-NEXT: Branch,File {{[0-9]+}}, 4:18 -> 4:22 = #6, #0
128 // CHECK-NEXT: File {{[0-9]+}}, 5:20 -> 5:23 = #0
129 // CHECK-NEXT: File {{[0-9]+}}, 9:25 -> 9:40 = #0
130 // CHECK-NEXT: File {{[0-9]+}}, 12:16 -> 12:42 = #0
131 // CHECK-NEXT: Expansion,File {{[0-9]+}}, 12:16 -> 12:38 = #8
132 // CHECK-NEXT: File {{[0-9]+}}, 12:38 -> 12:42 = #8
133 // CHECK-NEXT: File {{[0-9]+}}, 13:16 -> 13:42 = #0
134 // CHECK-NEXT: Expansion,File {{[0-9]+}}, 13:16 -> 13:38 = (#0 - #8)
135 // CHECK-NEXT: File {{[0-9]+}}, 13:38 -> 13:42 = (#0 - #8)
136 // CHECK-NEXT: File {{[0-9]+}}, 3:17 -> 3:20 = (#0 - #9)
137 // CHECK-NEXT: Branch,File {{[0-9]+}}, 3:17 -> 3:20 = #10, ((#0 - #9) - #10)
138 // CHECK-NEXT: File {{[0-9]+}}, 3:17 -> 3:20 = (#0 - #11)
139 // CHECK-NEXT: Branch,File {{[0-9]+}}, 3:17 -> 3:20 = #12, ((#0 - #11) - #12)
140 // CHECK-NEXT: File {{[0-9]+}}, 11:32 -> 11:36 = #8
141 // CHECK-NEXT: File {{[0-9]+}}, 11:32 -> 11:36 = (#0 - #8)
143 // CHECK-NOT: File {{[0-9]+}},
146 int main(int argc
, const char *argv
[]) {