-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #103071 - wesleywiser:fix_inlined_line_numbers, r=david…
…twco Fix line numbers for MIR inlined code `should_collapse_debuginfo` detects if the specified span is part of a macro expansion however it does this by checking if the span is anything other than a normal (non-expanded) kind, then the span sequence is walked backwards to the root span. This doesn't work when the MIR inliner inlines code as it creates spans with expansion information set to `ExprKind::Inlined` and results in the line number being attributed to the inline callsite rather than the normal line number of the inlined code. Fixes #103068
- Loading branch information
Showing
3 changed files
with
35 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// compile-flags: -O -g | ||
|
||
#![crate_type = "lib"] | ||
|
||
#[inline(always)] | ||
fn foo() { | ||
bar(); | ||
} | ||
|
||
#[inline(never)] | ||
#[no_mangle] | ||
fn bar() { | ||
panic!(); | ||
} | ||
|
||
#[no_mangle] | ||
pub fn example() { | ||
foo(); | ||
} | ||
|
||
// CHECK-LABEL: @example | ||
// CHECK: tail call void @bar(), !dbg [[DBG_ID:![0-9]+]] | ||
// CHECK: [[DBG_ID]] = !DILocation(line: 7, | ||
// CHECK-SAME: inlinedAt: [[INLINE_ID:![0-9]+]]) | ||
// CHECK: [[INLINE_ID]] = !DILocation(line: 18, |