about summary refs log tree commit diff
path: root/src/test/codegen/inline-debuginfo.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-10-26 18:50:22 +0000
committerbors <bors@rust-lang.org>2020-10-26 18:50:22 +0000
commit0da6d42f297642a60f2640ec313b879b376b9ad8 (patch)
treed6272e429e289507cfb80fbb588f98ca468a4c7a /src/test/codegen/inline-debuginfo.rs
parent35debd4c111610317346f46d791f32551d449bd8 (diff)
parent2b3f00928c3b0db93c87d462a53c9f0df98f3e27 (diff)
downloadrust-0da6d42f297642a60f2640ec313b879b376b9ad8.tar.gz
rust-0da6d42f297642a60f2640ec313b879b376b9ad8.zip
Auto merge of #68965 - eddyb:mir-inline-scope, r=nagisa,oli-obk
 rustc_mir: track inlined callees in SourceScopeData.

We now record which MIR scopes are the roots of *other* (inlined) functions's scope trees, which allows us to generate the correct debuginfo in codegen, similar to what LLVM inlining generates.
This PR makes the `ui` test `backtrace-debuginfo` pass, if the MIR inliner is turned on by default.

Also, `#[track_caller]` is now correct in the face of MIR inlining (cc `@anp).`

Fixes #76997.

r? `@rust-lang/wg-mir-opt`
Diffstat (limited to 'src/test/codegen/inline-debuginfo.rs')
-rw-r--r--src/test/codegen/inline-debuginfo.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/test/codegen/inline-debuginfo.rs b/src/test/codegen/inline-debuginfo.rs
new file mode 100644
index 00000000000..1546dfa10a3
--- /dev/null
+++ b/src/test/codegen/inline-debuginfo.rs
@@ -0,0 +1,17 @@
+#![crate_type="rlib"]
+// compile-flags: -Copt-level=3 -g
+// ignore-tidy-linelength
+
+#[no_mangle]
+#[inline(always)]
+pub extern "C" fn callee(x: u32) -> u32 {
+    x + 4
+}
+
+// CHECK-LABEL: caller
+// CHECK: call void @llvm.dbg.value(metadata i32 %y, metadata !{{.*}}, metadata !DIExpression(DW_OP_constu, 3, DW_OP_minus, DW_OP_stack_value)), !dbg [[A:!.*]]
+// CHECK: [[A]] = !DILocation(line: {{.*}}, scope: {{.*}}, inlinedAt: {{.*}})
+#[no_mangle]
+pub extern "C" fn caller(y: u32) -> u32 {
+    callee(y - 3)
+}