diff options
| author | bors <bors@rust-lang.org> | 2023-10-09 02:08:13 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-10-09 02:08:13 +0000 |
| commit | 1f48cbc3f8dbd393a7e713a0f90d7c6ec72d58ee (patch) | |
| tree | fa7bc49f059695a91278283752f39e2dd6bbc584 /compiler/rustc_codegen_llvm/src | |
| parent | 37fda989ea8acb1db02748b8478c64e51a515bbd (diff) | |
| parent | 9d211b044d3198f8e2c9a3e5678fafd2a61a5308 (diff) | |
| download | rust-1f48cbc3f8dbd393a7e713a0f90d7c6ec72d58ee.tar.gz rust-1f48cbc3f8dbd393a7e713a0f90d7c6ec72d58ee.zip | |
Auto merge of #116096 - cjgillot:debuginfo-fndef-size, r=nikic
Make FnDef 1-ZST in LLVM debuginfo. Discussed in https://rust-lang.zulipchat.com/#narrow/stream/187780-t-compiler.2Fwg-llvm/topic/LLVM.20HEAD.20llvm.2Edbg.2Edeclare.2Falloca.20size.20mismatch r? `@nikic`
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs b/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs index ed938761694..11874898a5a 100644 --- a/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs +++ b/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs @@ -335,12 +335,20 @@ fn build_subroutine_type_di_node<'ll, 'tcx>( // This is actually a function pointer, so wrap it in pointer DI. let name = compute_debuginfo_type_name(cx.tcx, fn_ty, false); + let (size, align) = match fn_ty.kind() { + ty::FnDef(..) => (0, 1), + ty::FnPtr(..) => ( + cx.tcx.data_layout.pointer_size.bits(), + cx.tcx.data_layout.pointer_align.abi.bits() as u32, + ), + _ => unreachable!(), + }; let di_node = unsafe { llvm::LLVMRustDIBuilderCreatePointerType( DIB(cx), fn_di_node, - cx.tcx.data_layout.pointer_size.bits(), - cx.tcx.data_layout.pointer_align.abi.bits() as u32, + size, + align, 0, // Ignore DWARF address space. name.as_ptr().cast(), name.len(), |
