From 1e4ebb0ccdffe4a8ddb15cb8e95bef3b905f045b Mon Sep 17 00:00:00 2001 From: Kyle Huey Date: Mon, 18 Nov 2024 18:16:22 -0800 Subject: Honor collapse_debuginfo when dealing with MIR-inlined functions inside macros. The test relies on the fact that inlining more than 2^12 calls at the same callsite will trigger a panic (and after the following commit, a warning) due to LLVM limitations but with collapse_debuginfo the callsites should not be the same. --- compiler/rustc_codegen_llvm/src/debuginfo/create_scope_map.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'compiler/rustc_codegen_llvm/src/debuginfo') diff --git a/compiler/rustc_codegen_llvm/src/debuginfo/create_scope_map.rs b/compiler/rustc_codegen_llvm/src/debuginfo/create_scope_map.rs index 4a68bdea85e..2c7ef626d1e 100644 --- a/compiler/rustc_codegen_llvm/src/debuginfo/create_scope_map.rs +++ b/compiler/rustc_codegen_llvm/src/debuginfo/create_scope_map.rs @@ -9,7 +9,7 @@ use rustc_middle::mir::{Body, SourceScope}; use rustc_middle::ty::layout::{FnAbiOf, HasTypingEnv}; use rustc_middle::ty::{self, Instance}; use rustc_session::config::DebugInfo; -use rustc_span::BytePos; +use rustc_span::{BytePos, hygiene}; use super::metadata::file_metadata; use super::utils::DIB; @@ -138,8 +138,7 @@ fn make_mir_scope<'ll, 'tcx>( }; let inlined_at = scope_data.inlined.map(|(_, callsite_span)| { - // FIXME(eddyb) this doesn't account for the macro-related - // `Span` fixups that `rustc_codegen_ssa::mir::debuginfo` does. + let callsite_span = hygiene::walk_chain_collapsed(callsite_span, mir.span); let callsite_scope = parent_scope.adjust_dbg_scope_for_span(cx, callsite_span); let loc = cx.dbg_loc(callsite_scope, parent_scope.inlined_at, callsite_span); -- cgit 1.4.1-3-g733a5