diff options
| author | bors <bors@rust-lang.org> | 2023-08-27 14:06:57 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-08-27 14:06:57 +0000 |
| commit | f0727758d101edc92f970a6617b2f26e826777c7 (patch) | |
| tree | c8e2be379a8cc17d877b675a709363283f3eda31 /compiler/rustc_codegen_ssa | |
| parent | 9558cdaf2e6a44e09e06c141084ca73f9742b623 (diff) | |
| parent | 5529e2f8933e494547423db3a55b215313d5ecde (diff) | |
Auto merge of #115139 - cjgillot:llvm-fragment, r=nikic
Do not forget to pass DWARF fragment information to LLVM. Fixes https://github.com/rust-lang/rust/issues/115113 for the rustc part
Diffstat (limited to 'compiler/rustc_codegen_ssa')
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/mir/debuginfo.rs | 37 |
1 files changed, 28 insertions, 9 deletions
diff --git a/compiler/rustc_codegen_ssa/src/mir/debuginfo.rs b/compiler/rustc_codegen_ssa/src/mir/debuginfo.rs index 564b5da32cc..526c16a59de 100644 --- a/compiler/rustc_codegen_ssa/src/mir/debuginfo.rs +++ b/compiler/rustc_codegen_ssa/src/mir/debuginfo.rs @@ -435,9 +435,23 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { bx.store(place.llval, alloca.llval, alloca.align); // Point the debug info to `*alloca` for the current variable - bx.dbg_var_addr(dbg_var, dbg_loc, alloca.llval, Size::ZERO, &[Size::ZERO], None); + bx.dbg_var_addr( + dbg_var, + dbg_loc, + alloca.llval, + Size::ZERO, + &[Size::ZERO], + var.fragment, + ); } else { - bx.dbg_var_addr(dbg_var, dbg_loc, base.llval, direct_offset, &indirect_offsets, None); + bx.dbg_var_addr( + dbg_var, + dbg_loc, + base.llval, + direct_offset, + &indirect_offsets, + var.fragment, + ); } } @@ -560,17 +574,22 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { } let place = fragment.contents; + let fragment = if fragment_layout.size == Size::ZERO { + // Fragment is a ZST, so does not represent anything. + continue; + } else if fragment_layout.size == var_layout.size { + // Fragment covers entire variable, so as far as + // DWARF is concerned, it's not really a fragment. + None + } else { + Some(fragment_start..fragment_start + fragment_layout.size) + }; + per_local[place.local].push(PerLocalVarDebugInfo { name: var.name, source_info: var.source_info, dbg_var, - fragment: if fragment_layout.size == var_layout.size { - // Fragment covers entire variable, so as far as - // DWARF is concerned, it's not really a fragment. - None - } else { - Some(fragment_start..fragment_start + fragment_layout.size) - }, + fragment, projection: place.projection, }); } |
