diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2023-09-18 16:29:50 +0000 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2023-10-08 16:42:45 +0000 |
| commit | 098fc9715e0f0cc3aa5c6ff0512e389c24d09254 (patch) | |
| tree | 642f4f515bc68180f26ca11b21b3a0341fd5ea43 /compiler/rustc_codegen_llvm/src | |
| parent | 4f4a413fe6931d0ad9d3ac6bd20ff36398961e64 (diff) | |
| download | rust-098fc9715e0f0cc3aa5c6ff0512e389c24d09254.tar.gz rust-098fc9715e0f0cc3aa5c6ff0512e389c24d09254.zip | |
Make FnDef 1-ZST in LLVM debuginfo.
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(), |
