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.
This commit is contained in:
Kyle Huey 2024-11-18 18:16:22 -08:00
parent b71fb5edc0
commit 1e4ebb0ccd
2 changed files with 4126 additions and 3 deletions

View File

@ -9,7 +9,7 @@ use rustc_middle::mir::{Body, SourceScope};
use rustc_middle::ty::layout::{FnAbiOf, HasTypingEnv}; use rustc_middle::ty::layout::{FnAbiOf, HasTypingEnv};
use rustc_middle::ty::{self, Instance}; use rustc_middle::ty::{self, Instance};
use rustc_session::config::DebugInfo; use rustc_session::config::DebugInfo;
use rustc_span::BytePos; use rustc_span::{BytePos, hygiene};
use super::metadata::file_metadata; use super::metadata::file_metadata;
use super::utils::DIB; use super::utils::DIB;
@ -138,8 +138,7 @@ fn make_mir_scope<'ll, 'tcx>(
}; };
let inlined_at = scope_data.inlined.map(|(_, callsite_span)| { let inlined_at = scope_data.inlined.map(|(_, callsite_span)| {
// FIXME(eddyb) this doesn't account for the macro-related let callsite_span = hygiene::walk_chain_collapsed(callsite_span, mir.span);
// `Span` fixups that `rustc_codegen_ssa::mir::debuginfo` does.
let callsite_scope = parent_scope.adjust_dbg_scope_for_span(cx, callsite_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); let loc = cx.dbg_loc(callsite_scope, parent_scope.inlined_at, callsite_span);

File diff suppressed because it is too large Load Diff