Skip to content

Commit

Permalink
Honor collapse_debuginfo when dealing with MIR-inlined functions insi…
Browse files Browse the repository at this point in the history
…de 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.
  • Loading branch information
khuey committed Nov 19, 2024
1 parent b71fb5e commit 1e4ebb0
Show file tree
Hide file tree
Showing 2 changed files with 4,126 additions and 3 deletions.
5 changes: 2 additions & 3 deletions compiler/rustc_codegen_llvm/src/debuginfo/create_scope_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);

Expand Down
Loading

0 comments on commit 1e4ebb0

Please sign in to comment.