Douglas Katzman | 3459ce2 | 2015-10-08 04:24:12 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -w -debug-info-kind=line-tables-only -std=c++11 -fexceptions -fcxx-exceptions -S -emit-llvm %s -o - | FileCheck %s |
| 2 | // RUN: %clang_cc1 -w -debug-info-kind=line-tables-only -std=c++11 -fexceptions -fcxx-exceptions -S -emit-llvm %s -o - -triple i686-linux-gnu | FileCheck %s |
David Blaikie | 66e4197 | 2015-01-14 07:38:27 +0000 | [diff] [blame] | 3 | |
| 4 | // XFAIL: win32 |
David Blaikie | 0b7fad6 | 2014-12-08 21:48:57 +0000 | [diff] [blame] | 5 | |
David Blaikie | 538deff | 2014-12-09 20:52:24 +0000 | [diff] [blame] | 6 | int &src(); |
David Blaikie | 8ec8dfe | 2014-12-09 21:10:43 +0000 | [diff] [blame] | 7 | int *sink(); |
Reid Kleckner | 60e54da | 2014-12-10 00:47:33 +0000 | [diff] [blame] | 8 | extern "C" __complex float complex_src(); |
| 9 | extern "C" __complex float *complex_sink(); |
David Blaikie | 0b7fad6 | 2014-12-08 21:48:57 +0000 | [diff] [blame] | 10 | |
David Blaikie | 8ec8dfe | 2014-12-09 21:10:43 +0000 | [diff] [blame] | 11 | // CHECK-LABEL: define |
David Blaikie | 0b7fad6 | 2014-12-08 21:48:57 +0000 | [diff] [blame] | 12 | void f1() { |
David Blaikie | 9b47966 | 2015-01-25 01:19:10 +0000 | [diff] [blame] | 13 | *sink() |
David Blaikie | 73ca569 | 2014-12-09 00:32:22 +0000 | [diff] [blame] | 14 | // CHECK: store {{.*}}, !dbg [[DBG_F1:!.*]] |
David Blaikie | 9b47966 | 2015-01-25 01:19:10 +0000 | [diff] [blame] | 15 | #line 100 |
| 16 | = // |
| 17 | src(); |
David Blaikie | 0b7fad6 | 2014-12-08 21:48:57 +0000 | [diff] [blame] | 18 | } |
| 19 | |
David Blaikie | 73ca569 | 2014-12-09 00:32:22 +0000 | [diff] [blame] | 20 | struct foo { |
| 21 | int i; |
| 22 | int &j; |
David Blaikie | 538deff | 2014-12-09 20:52:24 +0000 | [diff] [blame] | 23 | __complex float k; |
David Blaikie | 73ca569 | 2014-12-09 00:32:22 +0000 | [diff] [blame] | 24 | foo(); |
| 25 | }; |
| 26 | |
David Blaikie | 8ec8dfe | 2014-12-09 21:10:43 +0000 | [diff] [blame] | 27 | // CHECK-LABEL: define |
David Blaikie | 73ca569 | 2014-12-09 00:32:22 +0000 | [diff] [blame] | 28 | foo::foo() |
David Blaikie | 8ec8dfe | 2014-12-09 21:10:43 +0000 | [diff] [blame] | 29 | : |
David Blaikie | 73ca569 | 2014-12-09 00:32:22 +0000 | [diff] [blame] | 30 | #line 200 |
David Blaikie | 8ec8dfe | 2014-12-09 21:10:43 +0000 | [diff] [blame] | 31 | i // CHECK: store i32 {{.*}} !dbg [[DBG_FOO_VALUE:!.*]] |
| 32 | (src()), |
| 33 | j // CHECK: store i32* {{.*}} !dbg [[DBG_FOO_REF:!.*]] |
| 34 | (src()), |
| 35 | k // CHECK: store float {{.*}} !dbg [[DBG_FOO_COMPLEX:!.*]] |
| 36 | (complex_src()) { |
| 37 | } |
| 38 | |
Reid Kleckner | 60e54da | 2014-12-10 00:47:33 +0000 | [diff] [blame] | 39 | // CHECK-LABEL: define {{.*}}f2{{.*}} |
David Blaikie | 8ec8dfe | 2014-12-09 21:10:43 +0000 | [diff] [blame] | 40 | void f2() { |
David Blaikie | 9b47966 | 2015-01-25 01:19:10 +0000 | [diff] [blame] | 41 | // CHECK: store float {{.*}} !dbg [[DBG_F2:!.*]] |
| 42 | *complex_sink() |
David Blaikie | 8ec8dfe | 2014-12-09 21:10:43 +0000 | [diff] [blame] | 43 | #line 300 |
David Blaikie | 9b47966 | 2015-01-25 01:19:10 +0000 | [diff] [blame] | 44 | = // |
| 45 | complex_src(); |
David Blaikie | 73ca569 | 2014-12-09 00:32:22 +0000 | [diff] [blame] | 46 | } |
| 47 | |
David Blaikie | 93e9cf8 | 2014-12-09 21:32:00 +0000 | [diff] [blame] | 48 | // CHECK-LABEL: define |
| 49 | void f3() { |
David Blaikie | 9b47966 | 2015-01-25 01:19:10 +0000 | [diff] [blame] | 50 | // CHECK: store float {{.*}} !dbg [[DBG_F3:!.*]] |
| 51 | *complex_sink() |
David Blaikie | 93e9cf8 | 2014-12-09 21:32:00 +0000 | [diff] [blame] | 52 | #line 400 |
David Blaikie | 9b47966 | 2015-01-25 01:19:10 +0000 | [diff] [blame] | 53 | += // |
| 54 | complex_src(); |
David Blaikie | 93e9cf8 | 2014-12-09 21:32:00 +0000 | [diff] [blame] | 55 | } |
| 56 | |
David Blaikie | 7f13881 | 2014-12-09 22:04:13 +0000 | [diff] [blame] | 57 | // CHECK-LABEL: define |
| 58 | void f4() { |
| 59 | #line 500 |
| 60 | auto x // CHECK: store {{.*}} !dbg [[DBG_F4:!.*]] |
| 61 | = src(); |
| 62 | } |
| 63 | |
David Blaikie | 00de22f | 2014-12-09 22:15:02 +0000 | [diff] [blame] | 64 | // CHECK-LABEL: define |
| 65 | void f5() { |
| 66 | #line 600 |
| 67 | auto x // CHECK: store float {{.*}} !dbg [[DBG_F5:!.*]] |
| 68 | = complex_src(); |
| 69 | } |
| 70 | |
David Blaikie | d73f3c6 | 2014-12-09 23:33:26 +0000 | [diff] [blame] | 71 | struct agg { int i; }; |
| 72 | agg agg_src(); |
| 73 | |
| 74 | // CHECK-LABEL: define |
| 75 | void f6() { |
| 76 | agg x; |
David Blaikie | 9f7ae2c | 2015-01-25 01:25:37 +0000 | [diff] [blame] | 77 | // CHECK: call void @llvm.memcpy{{.*}} !dbg [[DBG_F6:!.*]] |
| 78 | x |
David Blaikie | d73f3c6 | 2014-12-09 23:33:26 +0000 | [diff] [blame] | 79 | #line 700 |
David Blaikie | 9f7ae2c | 2015-01-25 01:25:37 +0000 | [diff] [blame] | 80 | = // |
| 81 | agg_src(); |
David Blaikie | d73f3c6 | 2014-12-09 23:33:26 +0000 | [diff] [blame] | 82 | } |
| 83 | |
David Blaikie | f0aceb2 | 2014-12-10 01:03:48 +0000 | [diff] [blame] | 84 | // CHECK-LABEL: define |
| 85 | void f7() { |
| 86 | int *src1(); |
| 87 | int src2(); |
| 88 | #line 800 |
| 89 | int x = ( // CHECK: load {{.*}} !dbg [[DBG_F7:!.*]] |
| 90 | src1())[src2()]; |
| 91 | } |
| 92 | |
David Blaikie | d85548d | 2014-12-10 01:16:09 +0000 | [diff] [blame] | 93 | // CHECK-LABEL: define |
| 94 | void f8() { |
| 95 | int src1[1]; |
| 96 | int src2(); |
| 97 | #line 900 |
| 98 | int x = ( // CHECK: load {{.*}} !dbg [[DBG_F8:!.*]] |
| 99 | src1)[src2()]; |
| 100 | } |
| 101 | |
David Blaikie | 7c5da41 | 2014-12-10 01:34:25 +0000 | [diff] [blame] | 102 | // CHECK-LABEL: define |
| 103 | void f9(int i) { |
| 104 | int src1[1][i]; |
| 105 | int src2(); |
| 106 | #line 1000 |
| 107 | auto x = ( // CHECK: getelementptr {{.*}} !dbg [[DBG_F9:!.*]] |
| 108 | src1)[src2()]; |
| 109 | } |
| 110 | |
David Blaikie | 09f12fa | 2014-12-14 18:48:18 +0000 | [diff] [blame] | 111 | inline void *operator new(decltype(sizeof(1)), void *p) noexcept { return p; } |
David Blaikie | a2c1124 | 2014-12-10 19:04:09 +0000 | [diff] [blame] | 112 | |
| 113 | // CHECK-LABEL: define |
| 114 | void f10() { |
| 115 | void *void_src(); |
Richard Smith | 902a023 | 2015-02-14 01:52:20 +0000 | [diff] [blame] | 116 | ( |
David Blaikie | 09f12fa | 2014-12-14 18:48:18 +0000 | [diff] [blame] | 117 | // CHECK: store {{.*}} !dbg [[DBG_F10_STORE:!.*]] |
David Blaikie | a2c1124 | 2014-12-10 19:04:09 +0000 | [diff] [blame] | 118 | #line 1100 |
| 119 | new (void_src()) int(src())); |
| 120 | } |
| 121 | |
David Blaikie | 47d28e0 | 2015-01-14 07:10:46 +0000 | [diff] [blame] | 122 | // noexcept just to simplify the codegen a bit |
| 123 | void fn() noexcept(true); |
| 124 | |
| 125 | struct bar { |
| 126 | bar(); |
| 127 | // noexcept(false) to convolute the global dtor |
| 128 | ~bar() noexcept(false); |
| 129 | }; |
| 130 | // global ctor cleanup |
| 131 | // CHECK-LABEL: define |
| 132 | // CHECK: invoke{{ }} |
| 133 | // CHECK: invoke{{ }} |
| 134 | // CHECK: to label {{.*}}, !dbg [[DBG_GLBL_CTOR_B:!.*]] |
David Blaikie | 66e4197 | 2015-01-14 07:38:27 +0000 | [diff] [blame] | 135 | |
| 136 | // terminate caller |
| 137 | // CHECK-LABEL: define |
| 138 | |
David Blaikie | 47d28e0 | 2015-01-14 07:10:46 +0000 | [diff] [blame] | 139 | // global dtor cleanup |
| 140 | // CHECK-LABEL: define |
| 141 | // CHECK: invoke{{ }} |
| 142 | // CHECK: invoke{{ }} |
| 143 | // CHECK: to label {{.*}}, !dbg [[DBG_GLBL_DTOR_B:!.*]] |
David Blaikie | 71fb83e | 2015-01-16 22:55:09 +0000 | [diff] [blame] | 144 | #line 1200 |
David Blaikie | 47d28e0 | 2015-01-14 07:10:46 +0000 | [diff] [blame] | 145 | bar b[1] = { // |
| 146 | (fn(), // |
| 147 | bar())}; |
| 148 | |
David Blaikie | 66e4197 | 2015-01-14 07:38:27 +0000 | [diff] [blame] | 149 | // CHECK-LABEL: define |
| 150 | __complex double f11() { |
| 151 | __complex double f; |
| 152 | // CHECK: store {{.*}} !dbg [[DBG_F11:!.*]] |
David Blaikie | 71fb83e | 2015-01-16 22:55:09 +0000 | [diff] [blame] | 153 | #line 1300 |
David Blaikie | 66e4197 | 2015-01-14 07:38:27 +0000 | [diff] [blame] | 154 | return f; |
| 155 | } |
| 156 | |
| 157 | // CHECK-LABEL: define |
| 158 | void f12() { |
| 159 | int f12_1(); |
| 160 | void f12_2(int = f12_1()); |
David Blaikie | ea3e51d | 2015-06-29 17:29:50 +0000 | [diff] [blame] | 161 | // CHECK: call {{.*}}{{(signext )?}}i32 {{.*}} !dbg [[DBG_F12:!.*]] |
David Blaikie | 71fb83e | 2015-01-16 22:55:09 +0000 | [diff] [blame] | 162 | #line 1400 |
David Blaikie | 66e4197 | 2015-01-14 07:38:27 +0000 | [diff] [blame] | 163 | f12_2(); |
| 164 | } |
| 165 | |
| 166 | // CHECK-LABEL: define |
| 167 | void f13() { |
| 168 | // CHECK: call {{.*}} !dbg [[DBG_F13:!.*]] |
| 169 | #define F13_IMPL 1, src() |
| 170 | 1, |
David Blaikie | 71fb83e | 2015-01-16 22:55:09 +0000 | [diff] [blame] | 171 | #line 1500 |
David Blaikie | 66e4197 | 2015-01-14 07:38:27 +0000 | [diff] [blame] | 172 | F13_IMPL; |
| 173 | } |
| 174 | |
David Blaikie | 01fb5fb | 2015-01-18 01:48:19 +0000 | [diff] [blame] | 175 | struct f14_impl { |
| 176 | f14_impl(int); |
David Blaikie | 71fb83e | 2015-01-16 22:55:09 +0000 | [diff] [blame] | 177 | }; |
| 178 | |
| 179 | // CHECK-LABEL: define |
David Blaikie | 1c39bbb | 2015-01-18 00:37:04 +0000 | [diff] [blame] | 180 | struct f14_use { |
David Blaikie | 01fb5fb | 2015-01-18 01:48:19 +0000 | [diff] [blame] | 181 | // CHECK: call {{.*}}f14_impl{{.*}}, !dbg [[DBG_F14_CTOR_CALL:![0-9]*]] |
David Blaikie | a81d410 | 2015-01-18 00:12:58 +0000 | [diff] [blame] | 182 | #line 1600 |
David Blaikie | 01fb5fb | 2015-01-18 01:48:19 +0000 | [diff] [blame] | 183 | f14_impl v{// |
| 184 | 1}; |
David Blaikie | 1c39bbb | 2015-01-18 00:37:04 +0000 | [diff] [blame] | 185 | f14_use(); |
| 186 | }; |
| 187 | |
| 188 | f14_use::f14_use() = default; |
David Blaikie | 71fb83e | 2015-01-16 22:55:09 +0000 | [diff] [blame] | 189 | |
| 190 | // CHECK-LABEL: define |
David Blaikie | c659307 | 2015-01-18 01:57:54 +0000 | [diff] [blame] | 191 | // CHECK-LABEL: define |
David Blaikie | 01fb5fb | 2015-01-18 01:48:19 +0000 | [diff] [blame] | 192 | void func(foo); |
| 193 | void f15(foo *f) { |
| 194 | func( |
| 195 | // CHECK: getelementptr {{.*}}, !dbg [[DBG_F15:![0-9]*]] |
| 196 | #line 1700 |
| 197 | f[3]); |
| 198 | } |
David Blaikie | 71fb83e | 2015-01-16 22:55:09 +0000 | [diff] [blame] | 199 | |
David Blaikie | c659307 | 2015-01-18 01:57:54 +0000 | [diff] [blame] | 200 | // CHECK-LABEL: define |
| 201 | void f16(__complex float f) { |
| 202 | __complex float g = // |
| 203 | // CHECK: add {{.*}}, !dbg [[DBG_F16:![0-9]*]] |
| 204 | #line 1800 |
| 205 | f + 1; |
| 206 | } |
| 207 | |
David Blaikie | 2d321fb | 2015-01-24 23:35:17 +0000 | [diff] [blame] | 208 | // CHECK-LABEL: define |
| 209 | void f17(int *x) { |
| 210 | 1, |
| 211 | // CHECK: getelementptr {{.*}}, !dbg [[DBG_F17:![0-9]*]] |
| 212 | #line 1900 |
| 213 | x[1]; |
| 214 | } |
| 215 | |
David Blaikie | 298720d | 2015-01-28 19:50:09 +0000 | [diff] [blame] | 216 | // CHECK-LABEL: define |
| 217 | void f18(int a, int b) { |
| 218 | // CHECK: icmp {{.*}}, !dbg [[DBG_F18_1:![0-9]*]] |
| 219 | // CHECK: br {{.*}}, !dbg [[DBG_F18_2:![0-9]*]] |
| 220 | #line 2000 |
| 221 | if (a // |
| 222 | && // |
| 223 | b) |
| 224 | ; |
| 225 | } |
| 226 | |
| 227 | // CHECK-LABEL: define |
| 228 | void f19(int a, int b) { |
| 229 | // CHECK: icmp {{.*}}, !dbg [[DBG_F19_1:![0-9]*]] |
| 230 | // CHECK: br {{.*}}, !dbg [[DBG_F19_2:![0-9]*]] |
| 231 | #line 2100 |
| 232 | if (a // |
| 233 | || // |
| 234 | b) |
| 235 | ; |
| 236 | } |
| 237 | |
| 238 | // CHECK-LABEL: define |
| 239 | void f20(int a, int b, int c) { |
| 240 | // CHECK: icmp {{.*}}, !dbg [[DBG_F20_1:![0-9]*]] |
| 241 | // FIXME: Conditional operator's exprloc should be the '?' not the start of the |
| 242 | // expression, then this would go in the right place. (but adding getExprLoc to |
| 243 | // the ConditionalOperator breaks the ARC migration tool - need to investigate |
| 244 | // further). |
| 245 | // CHECK: br {{.*}}, !dbg [[DBG_F20_1]] |
| 246 | #line 2200 |
| 247 | if (a // |
| 248 | ? // |
| 249 | b : c) |
| 250 | ; |
| 251 | } |
| 252 | |
David Blaikie | 14177b7 | 2015-02-03 22:37:17 +0000 | [diff] [blame] | 253 | // CHECK-LABEL: define |
| 254 | int f21_a(int = 0); |
| 255 | void f21_b(int = f21_a()); |
| 256 | void f21() { |
| 257 | // CHECK: call {{.*}}f21_b{{.*}}, !dbg [[DBG_F21:![0-9]*]] |
| 258 | #line 2300 |
| 259 | f21_b(); |
| 260 | } |
| 261 | |
David Blaikie | 4d52443 | 2015-02-04 19:47:54 +0000 | [diff] [blame] | 262 | // CHECK-LABEL: define |
| 263 | struct f22_dtor { |
| 264 | ~f22_dtor(); |
| 265 | }; |
| 266 | void f22() { |
| 267 | { |
| 268 | f22_dtor f; |
| 269 | src(); |
NAKAMURA Takumi | b1980e6 | 2015-02-05 01:02:34 +0000 | [diff] [blame] | 270 | // CHECK: invoke {{.*}}src |
David Blaikie | 4d52443 | 2015-02-04 19:47:54 +0000 | [diff] [blame] | 271 | // CHECK: call {{.*}}, !dbg [[DBG_F22:![0-9]*]] |
| 272 | // CHECK: call {{.*}}, !dbg [[DBG_F22]] |
| 273 | #line 2400 |
| 274 | } |
| 275 | } |
| 276 | |
David Blaikie | 2221aba | 2015-02-09 18:47:14 +0000 | [diff] [blame] | 277 | // CHECK-LABEL: define |
| 278 | struct f23_struct { |
| 279 | }; |
| 280 | f23_struct f23_a(); |
| 281 | void f23_b(f23_struct = f23_a()); |
| 282 | void f23() { |
| 283 | // CHECK: call {{.*}}f23_a{{.*}}, !dbg [[DBG_F23:![0-9]*]] |
| 284 | #line 2500 |
| 285 | f23_b(); |
| 286 | } |
| 287 | |
David Blaikie | 20937be | 2015-02-09 18:55:57 +0000 | [diff] [blame] | 288 | // CHECK-LABEL: define |
| 289 | void f24_a(__complex float = complex_src()); |
| 290 | void f24() { |
| 291 | // CHECK: call {{.*}}complex_src{{.*}}, !dbg [[DBG_F24:![0-9]*]] |
| 292 | #line 2600 |
| 293 | f24_a(); |
| 294 | } |
| 295 | |
Duncan P. N. Exon Smith | 9dd4e4e | 2015-04-29 16:40:08 +0000 | [diff] [blame] | 296 | // CHECK: [[DBG_F1]] = !DILocation(line: 100, |
| 297 | // CHECK: [[DBG_FOO_VALUE]] = !DILocation(line: 200, |
| 298 | // CHECK: [[DBG_FOO_REF]] = !DILocation(line: 202, |
| 299 | // CHECK: [[DBG_FOO_COMPLEX]] = !DILocation(line: 204, |
| 300 | // CHECK: [[DBG_F2]] = !DILocation(line: 300, |
| 301 | // CHECK: [[DBG_F3]] = !DILocation(line: 400, |
| 302 | // CHECK: [[DBG_F4]] = !DILocation(line: 500, |
| 303 | // CHECK: [[DBG_F5]] = !DILocation(line: 600, |
| 304 | // CHECK: [[DBG_F6]] = !DILocation(line: 700, |
| 305 | // CHECK: [[DBG_F7]] = !DILocation(line: 800, |
| 306 | // CHECK: [[DBG_F8]] = !DILocation(line: 900, |
| 307 | // CHECK: [[DBG_F9]] = !DILocation(line: 1000, |
| 308 | // CHECK: [[DBG_F10_STORE]] = !DILocation(line: 1100, |
| 309 | // CHECK: [[DBG_GLBL_CTOR_B]] = !DILocation(line: 1200, |
| 310 | // CHECK: [[DBG_GLBL_DTOR_B]] = !DILocation(line: 1200, |
| 311 | // CHECK: [[DBG_F11]] = !DILocation(line: 1300, |
| 312 | // CHECK: [[DBG_F12]] = !DILocation(line: 1400, |
| 313 | // CHECK: [[DBG_F13]] = !DILocation(line: 1500, |
| 314 | // CHECK: [[DBG_F14_CTOR_CALL]] = !DILocation(line: 1600, |
| 315 | // CHECK: [[DBG_F15]] = !DILocation(line: 1700, |
| 316 | // CHECK: [[DBG_F16]] = !DILocation(line: 1800, |
| 317 | // CHECK: [[DBG_F17]] = !DILocation(line: 1900, |
| 318 | // CHECK: [[DBG_F18_1]] = !DILocation(line: 2000, |
| 319 | // CHECK: [[DBG_F18_2]] = !DILocation(line: 2001, |
| 320 | // CHECK: [[DBG_F19_1]] = !DILocation(line: 2100, |
| 321 | // CHECK: [[DBG_F19_2]] = !DILocation(line: 2101, |
| 322 | // CHECK: [[DBG_F20_1]] = !DILocation(line: 2200, |
| 323 | // CHECK: [[DBG_F23]] = !DILocation(line: 2500, |
| 324 | // CHECK: [[DBG_F24]] = !DILocation(line: 2600, |