David Blaikie | 0b7fad6 | 2014-12-08 21:48:57 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -g -std=c++11 -S -emit-llvm %s -o - | FileCheck %s |
| 2 | |
David Blaikie | 538deff | 2014-12-09 20:52:24 +0000 | [diff] [blame] | 3 | int &src(); |
David Blaikie | 8ec8dfe | 2014-12-09 21:10:43 +0000 | [diff] [blame] | 4 | int *sink(); |
David Blaikie | 538deff | 2014-12-09 20:52:24 +0000 | [diff] [blame] | 5 | __complex float complex_src(); |
David Blaikie | 8ec8dfe | 2014-12-09 21:10:43 +0000 | [diff] [blame] | 6 | __complex float *complex_sink(); |
David Blaikie | 0b7fad6 | 2014-12-08 21:48:57 +0000 | [diff] [blame] | 7 | |
David Blaikie | 8ec8dfe | 2014-12-09 21:10:43 +0000 | [diff] [blame] | 8 | // CHECK-LABEL: define |
David Blaikie | 0b7fad6 | 2014-12-08 21:48:57 +0000 | [diff] [blame] | 9 | void f1() { |
| 10 | #line 100 |
| 11 | * // The store for the assignment should be attributed to the start of the |
David Blaikie | 8ec8dfe | 2014-12-09 21:10:43 +0000 | [diff] [blame] | 12 | // assignment expression here, regardless of the location of subexpressions. |
| 13 | sink() = src(); |
David Blaikie | 73ca569 | 2014-12-09 00:32:22 +0000 | [diff] [blame] | 14 | // CHECK: store {{.*}}, !dbg [[DBG_F1:!.*]] |
David Blaikie | 0b7fad6 | 2014-12-08 21:48:57 +0000 | [diff] [blame] | 15 | } |
| 16 | |
David Blaikie | 73ca569 | 2014-12-09 00:32:22 +0000 | [diff] [blame] | 17 | struct foo { |
| 18 | int i; |
| 19 | int &j; |
David Blaikie | 538deff | 2014-12-09 20:52:24 +0000 | [diff] [blame] | 20 | __complex float k; |
David Blaikie | 73ca569 | 2014-12-09 00:32:22 +0000 | [diff] [blame] | 21 | foo(); |
| 22 | }; |
| 23 | |
David Blaikie | 8ec8dfe | 2014-12-09 21:10:43 +0000 | [diff] [blame] | 24 | // CHECK-LABEL: define |
David Blaikie | 73ca569 | 2014-12-09 00:32:22 +0000 | [diff] [blame] | 25 | foo::foo() |
David Blaikie | 8ec8dfe | 2014-12-09 21:10:43 +0000 | [diff] [blame] | 26 | : |
David Blaikie | 73ca569 | 2014-12-09 00:32:22 +0000 | [diff] [blame] | 27 | #line 200 |
David Blaikie | 8ec8dfe | 2014-12-09 21:10:43 +0000 | [diff] [blame] | 28 | i // CHECK: store i32 {{.*}} !dbg [[DBG_FOO_VALUE:!.*]] |
| 29 | (src()), |
| 30 | j // CHECK: store i32* {{.*}} !dbg [[DBG_FOO_REF:!.*]] |
| 31 | (src()), |
| 32 | k // CHECK: store float {{.*}} !dbg [[DBG_FOO_COMPLEX:!.*]] |
| 33 | (complex_src()) { |
| 34 | } |
| 35 | |
David Blaikie | 93e9cf8 | 2014-12-09 21:32:00 +0000 | [diff] [blame] | 36 | // skip C1 |
| 37 | // CHECK-LABEL: define |
| 38 | |
David Blaikie | 8ec8dfe | 2014-12-09 21:10:43 +0000 | [diff] [blame] | 39 | // CHECK-LABEL: define |
| 40 | void f2() { |
| 41 | #line 300 |
David Blaikie | 93e9cf8 | 2014-12-09 21:32:00 +0000 | [diff] [blame] | 42 | * // CHECK: store float {{.*}} !dbg [[DBG_F2:!.*]] |
David Blaikie | 8ec8dfe | 2014-12-09 21:10:43 +0000 | [diff] [blame] | 43 | complex_sink() = complex_src(); |
David Blaikie | 73ca569 | 2014-12-09 00:32:22 +0000 | [diff] [blame] | 44 | } |
| 45 | |
David Blaikie | 93e9cf8 | 2014-12-09 21:32:00 +0000 | [diff] [blame] | 46 | // CHECK-LABEL: define |
| 47 | void f3() { |
| 48 | #line 400 |
| 49 | * // CHECK: store float {{.*}} !dbg [[DBG_F3:!.*]] |
| 50 | complex_sink() += complex_src(); |
| 51 | } |
| 52 | |
David Blaikie | 7f13881 | 2014-12-09 22:04:13 +0000 | [diff] [blame] | 53 | // CHECK-LABEL: define |
| 54 | void f4() { |
| 55 | #line 500 |
| 56 | auto x // CHECK: store {{.*}} !dbg [[DBG_F4:!.*]] |
| 57 | = src(); |
| 58 | } |
| 59 | |
David Blaikie | 00de22f | 2014-12-09 22:15:02 +0000 | [diff] [blame^] | 60 | // CHECK-LABEL: define |
| 61 | void f5() { |
| 62 | #line 600 |
| 63 | auto x // CHECK: store float {{.*}} !dbg [[DBG_F5:!.*]] |
| 64 | = complex_src(); |
| 65 | } |
| 66 | |
David Blaikie | 73ca569 | 2014-12-09 00:32:22 +0000 | [diff] [blame] | 67 | // CHECK: [[DBG_F1]] = metadata !{i32 100, |
| 68 | // CHECK: [[DBG_FOO_VALUE]] = metadata !{i32 200, |
David Blaikie | 8ec8dfe | 2014-12-09 21:10:43 +0000 | [diff] [blame] | 69 | // CHECK: [[DBG_FOO_REF]] = metadata !{i32 202, |
| 70 | // CHECK: [[DBG_FOO_COMPLEX]] = metadata !{i32 204, |
David Blaikie | 93e9cf8 | 2014-12-09 21:32:00 +0000 | [diff] [blame] | 71 | // CHECK: [[DBG_F2]] = metadata !{i32 300, |
| 72 | // CHECK: [[DBG_F3]] = metadata !{i32 400, |
David Blaikie | 7f13881 | 2014-12-09 22:04:13 +0000 | [diff] [blame] | 73 | // CHECK: [[DBG_F4]] = metadata !{i32 500, |
David Blaikie | 00de22f | 2014-12-09 22:15:02 +0000 | [diff] [blame^] | 74 | // CHECK: [[DBG_F5]] = metadata !{i32 600, |