From 9580a7115d2d75514f0b329a29fafaa3796bd950 Mon Sep 17 00:00:00 2001 From: Michael Woerister Date: Mon, 14 Mar 2022 17:11:58 +0100 Subject: debuginfo: Refactor debuginfo generation for types -- Address review comments. --- compiler/rustc_codegen_llvm/src/debuginfo/metadata/enums/mod.rs | 2 ++ compiler/rustc_codegen_llvm/src/debuginfo/metadata/type_map.rs | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'compiler/rustc_codegen_llvm/src/debuginfo/metadata') diff --git a/compiler/rustc_codegen_llvm/src/debuginfo/metadata/enums/mod.rs b/compiler/rustc_codegen_llvm/src/debuginfo/metadata/enums/mod.rs index 19f0ce54250..1eafa9501c4 100644 --- a/compiler/rustc_codegen_llvm/src/debuginfo/metadata/enums/mod.rs +++ b/compiler/rustc_codegen_llvm/src/debuginfo/metadata/enums/mod.rs @@ -126,6 +126,8 @@ fn tag_base_type<'ll, 'tcx>( // If the niche is the NULL value of a reference, then `discr_enum_ty` will be // a RawPtr. CodeView doesn't know what to do with enums whose base type is a // pointer so we fix this up to just be `usize`. + // DWARF might be able to deal with this but with an integer type we are on + // the safe side there too. cx.data_layout().ptr_sized_integer() } } diff --git a/compiler/rustc_codegen_llvm/src/debuginfo/metadata/type_map.rs b/compiler/rustc_codegen_llvm/src/debuginfo/metadata/type_map.rs index 26f0647f888..8ce44ada887 100644 --- a/compiler/rustc_codegen_llvm/src/debuginfo/metadata/type_map.rs +++ b/compiler/rustc_codegen_llvm/src/debuginfo/metadata/type_map.rs @@ -145,7 +145,6 @@ impl<'ll> DINodeCreationResult<'ll> { } } -#[allow(dead_code)] #[derive(Debug, Copy, Clone, Eq, PartialEq)] pub enum Stub<'ll> { Struct, @@ -233,7 +232,7 @@ pub(super) fn stub<'ll, 'tcx>( /// This function enables creating debuginfo nodes that can recursively refer to themselves. /// It will first insert the given stub into the type map and only then execute the `members` /// and `generics` closures passed in. These closures have access to the stub so they can -/// directly attach fields to them. If build the type of a field transitively refers back +/// directly attach fields to them. If the type of a field transitively refers back /// to the type currently being built, the stub will already be found in the type map, /// which effectively breaks the recursion cycle. pub(super) fn build_type_with_children<'ll, 'tcx>( -- cgit 1.4.1-3-g733a5