aboutsummaryrefslogtreecommitdiff
path: root/test/CodeGenCXX/debug-info-line.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/CodeGenCXX/debug-info-line.cpp')
-rw-r--r--test/CodeGenCXX/debug-info-line.cpp194
1 files changed, 152 insertions, 42 deletions
diff --git a/test/CodeGenCXX/debug-info-line.cpp b/test/CodeGenCXX/debug-info-line.cpp
index 5b84711841f2..0b1b43b86f3c 100644
--- a/test/CodeGenCXX/debug-info-line.cpp
+++ b/test/CodeGenCXX/debug-info-line.cpp
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -gline-tables-only -std=c++11 -fexceptions -fcxx-exceptions -S -emit-llvm %s -o - | FileCheck %s
-// RUN: %clang_cc1 -gline-tables-only -std=c++11 -fexceptions -fcxx-exceptions -S -emit-llvm %s -o - -triple i686-linux-gnu | FileCheck %s
+// RUN: %clang_cc1 -w -gline-tables-only -std=c++11 -fexceptions -fcxx-exceptions -S -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -w -gline-tables-only -std=c++11 -fexceptions -fcxx-exceptions -S -emit-llvm %s -o - -triple i686-linux-gnu | FileCheck %s
// XFAIL: win32
@@ -10,11 +10,11 @@ extern "C" __complex float *complex_sink();
// CHECK-LABEL: define
void f1() {
-#line 100
- * // The store for the assignment should be attributed to the start of the
- // assignment expression here, regardless of the location of subexpressions.
- sink() = src();
+ *sink()
// CHECK: store {{.*}}, !dbg [[DBG_F1:!.*]]
+#line 100
+ = //
+ src();
}
struct foo {
@@ -38,16 +38,20 @@ foo::foo()
// CHECK-LABEL: define {{.*}}f2{{.*}}
void f2() {
+ // CHECK: store float {{.*}} !dbg [[DBG_F2:!.*]]
+ *complex_sink()
#line 300
- * // CHECK: store float {{.*}} !dbg [[DBG_F2:!.*]]
- complex_sink() = complex_src();
+ = //
+ complex_src();
}
// CHECK-LABEL: define
void f3() {
+ // CHECK: store float {{.*}} !dbg [[DBG_F3:!.*]]
+ *complex_sink()
#line 400
- * // CHECK: store float {{.*}} !dbg [[DBG_F3:!.*]]
- complex_sink() += complex_src();
+ += //
+ complex_src();
}
// CHECK-LABEL: define
@@ -70,9 +74,11 @@ agg agg_src();
// CHECK-LABEL: define
void f6() {
agg x;
+ // CHECK: call void @llvm.memcpy{{.*}} !dbg [[DBG_F6:!.*]]
+ x
#line 700
- x // CHECK: call void @llvm.memcpy{{.*}} !dbg [[DBG_F6:!.*]]
- = agg_src();
+ = //
+ agg_src();
}
// CHECK-LABEL: define
@@ -107,7 +113,7 @@ inline void *operator new(decltype(sizeof(1)), void *p) noexcept { return p; }
// CHECK-LABEL: define
void f10() {
void *void_src();
- ( // CHECK: icmp {{.*}} !dbg [[DBG_F10_ICMP:.*]]
+ (
// CHECK: store {{.*}} !dbg [[DBG_F10_STORE:!.*]]
#line 1100
new (void_src()) int(src()));
@@ -135,7 +141,7 @@ struct bar {
// CHECK: invoke{{ }}
// CHECK: invoke{{ }}
// CHECK: to label {{.*}}, !dbg [[DBG_GLBL_DTOR_B:!.*]]
-#line 1500
+#line 1200
bar b[1] = { //
(fn(), //
bar())};
@@ -144,7 +150,7 @@ bar b[1] = { //
__complex double f11() {
__complex double f;
// CHECK: store {{.*}} !dbg [[DBG_F11:!.*]]
-#line 1200
+#line 1300
return f;
}
@@ -153,7 +159,7 @@ void f12() {
int f12_1();
void f12_2(int = f12_1());
// CHECK: call {{(signext )?}}i32 {{.*}} !dbg [[DBG_F12:!.*]]
-#line 1300
+#line 1400
f12_2();
}
@@ -162,27 +168,87 @@ void f13() {
// CHECK: call {{.*}} !dbg [[DBG_F13:!.*]]
#define F13_IMPL 1, src()
1,
-#line 1400
+#line 1500
F13_IMPL;
}
-struct f14 {
- f14(int);
+struct f14_impl {
+ f14_impl(int);
};
// CHECK-LABEL: define
struct f14_use {
-// CHECK: call {{.*}}, !dbg [[DBG_F14_CTOR_CALL:![0-9]*]]
+// CHECK: call {{.*}}f14_impl{{.*}}, !dbg [[DBG_F14_CTOR_CALL:![0-9]*]]
#line 1600
- f14 v
- =
- 1;
+ f14_impl v{//
+ 1};
f14_use();
};
f14_use::f14_use() = default;
// CHECK-LABEL: define
+// CHECK-LABEL: define
+void func(foo);
+void f15(foo *f) {
+ func(
+// CHECK: getelementptr {{.*}}, !dbg [[DBG_F15:![0-9]*]]
+#line 1700
+ f[3]);
+}
+
+// CHECK-LABEL: define
+void f16(__complex float f) {
+ __complex float g = //
+// CHECK: add {{.*}}, !dbg [[DBG_F16:![0-9]*]]
+#line 1800
+ f + 1;
+}
+
+// CHECK-LABEL: define
+void f17(int *x) {
+ 1,
+// CHECK: getelementptr {{.*}}, !dbg [[DBG_F17:![0-9]*]]
+#line 1900
+ x[1];
+}
+
+// CHECK-LABEL: define
+void f18(int a, int b) {
+// CHECK: icmp {{.*}}, !dbg [[DBG_F18_1:![0-9]*]]
+// CHECK: br {{.*}}, !dbg [[DBG_F18_2:![0-9]*]]
+#line 2000
+ if (a //
+ && //
+ b)
+ ;
+}
+
+// CHECK-LABEL: define
+void f19(int a, int b) {
+// CHECK: icmp {{.*}}, !dbg [[DBG_F19_1:![0-9]*]]
+// CHECK: br {{.*}}, !dbg [[DBG_F19_2:![0-9]*]]
+#line 2100
+ if (a //
+ || //
+ b)
+ ;
+}
+
+// CHECK-LABEL: define
+void f20(int a, int b, int c) {
+// CHECK: icmp {{.*}}, !dbg [[DBG_F20_1:![0-9]*]]
+// FIXME: Conditional operator's exprloc should be the '?' not the start of the
+// expression, then this would go in the right place. (but adding getExprLoc to
+// the ConditionalOperator breaks the ARC migration tool - need to investigate
+// further).
+// CHECK: br {{.*}}, !dbg [[DBG_F20_1]]
+#line 2200
+ if (a //
+ ? //
+ b : c)
+ ;
+}
// CHECK-LABEL: define
int f21_a(int = 0);
@@ -193,22 +259,66 @@ void f21() {
f21_b();
}
-// CHECK: [[DBG_F1]] = !MDLocation(line: 100,
-// CHECK: [[DBG_FOO_VALUE]] = !MDLocation(line: 200,
-// CHECK: [[DBG_FOO_REF]] = !MDLocation(line: 202,
-// CHECK: [[DBG_FOO_COMPLEX]] = !MDLocation(line: 204,
-// CHECK: [[DBG_F2]] = !MDLocation(line: 300,
-// CHECK: [[DBG_F3]] = !MDLocation(line: 400,
-// CHECK: [[DBG_F4]] = !MDLocation(line: 500,
-// CHECK: [[DBG_F5]] = !MDLocation(line: 600,
-// CHECK: [[DBG_F6]] = !MDLocation(line: 700,
-// CHECK: [[DBG_F7]] = !MDLocation(line: 800,
-// CHECK: [[DBG_F8]] = !MDLocation(line: 900,
-// CHECK: [[DBG_F9]] = !MDLocation(line: 1000,
-// CHECK: [[DBG_F10_ICMP]] = !MDLocation(line: 1100,
-// CHECK: [[DBG_F10_STORE]] = !MDLocation(line: 1100,
-// CHECK: [[DBG_GLBL_CTOR_B]] = !MDLocation(line: 1500,
-// CHECK: [[DBG_GLBL_DTOR_B]] = !MDLocation(line: 1500,
-// CHECK: [[DBG_F11]] = !MDLocation(line: 1200,
-// CHECK: [[DBG_F12]] = !MDLocation(line: 1300,
-// CHECK: [[DBG_F13]] = !MDLocation(line: 1400,
+// CHECK-LABEL: define
+struct f22_dtor {
+ ~f22_dtor();
+};
+void f22() {
+ {
+ f22_dtor f;
+ src();
+// CHECK: invoke {{.*}}src
+// CHECK: call {{.*}}, !dbg [[DBG_F22:![0-9]*]]
+// CHECK: call {{.*}}, !dbg [[DBG_F22]]
+#line 2400
+ }
+}
+
+// CHECK-LABEL: define
+struct f23_struct {
+};
+f23_struct f23_a();
+void f23_b(f23_struct = f23_a());
+void f23() {
+// CHECK: call {{.*}}f23_a{{.*}}, !dbg [[DBG_F23:![0-9]*]]
+#line 2500
+ f23_b();
+}
+
+// CHECK-LABEL: define
+void f24_a(__complex float = complex_src());
+void f24() {
+// CHECK: call {{.*}}complex_src{{.*}}, !dbg [[DBG_F24:![0-9]*]]
+#line 2600
+ f24_a();
+}
+
+// CHECK: [[DBG_F1]] = !DILocation(line: 100,
+// CHECK: [[DBG_FOO_VALUE]] = !DILocation(line: 200,
+// CHECK: [[DBG_FOO_REF]] = !DILocation(line: 202,
+// CHECK: [[DBG_FOO_COMPLEX]] = !DILocation(line: 204,
+// CHECK: [[DBG_F2]] = !DILocation(line: 300,
+// CHECK: [[DBG_F3]] = !DILocation(line: 400,
+// CHECK: [[DBG_F4]] = !DILocation(line: 500,
+// CHECK: [[DBG_F5]] = !DILocation(line: 600,
+// CHECK: [[DBG_F6]] = !DILocation(line: 700,
+// CHECK: [[DBG_F7]] = !DILocation(line: 800,
+// CHECK: [[DBG_F8]] = !DILocation(line: 900,
+// CHECK: [[DBG_F9]] = !DILocation(line: 1000,
+// CHECK: [[DBG_F10_STORE]] = !DILocation(line: 1100,
+// CHECK: [[DBG_GLBL_CTOR_B]] = !DILocation(line: 1200,
+// CHECK: [[DBG_GLBL_DTOR_B]] = !DILocation(line: 1200,
+// CHECK: [[DBG_F11]] = !DILocation(line: 1300,
+// CHECK: [[DBG_F12]] = !DILocation(line: 1400,
+// CHECK: [[DBG_F13]] = !DILocation(line: 1500,
+// CHECK: [[DBG_F14_CTOR_CALL]] = !DILocation(line: 1600,
+// CHECK: [[DBG_F15]] = !DILocation(line: 1700,
+// CHECK: [[DBG_F16]] = !DILocation(line: 1800,
+// CHECK: [[DBG_F17]] = !DILocation(line: 1900,
+// CHECK: [[DBG_F18_1]] = !DILocation(line: 2000,
+// CHECK: [[DBG_F18_2]] = !DILocation(line: 2001,
+// CHECK: [[DBG_F19_1]] = !DILocation(line: 2100,
+// CHECK: [[DBG_F19_2]] = !DILocation(line: 2101,
+// CHECK: [[DBG_F20_1]] = !DILocation(line: 2200,
+// CHECK: [[DBG_F23]] = !DILocation(line: 2500,
+// CHECK: [[DBG_F24]] = !DILocation(line: 2600,