@@ -17,8 +17,8 @@ use crate::debuginfo::metadata::enums::DiscrResult;
1717use crate :: debuginfo:: metadata:: type_map:: { self , Stub , UniqueTypeId } ;
1818use crate :: debuginfo:: metadata:: {
1919 DINodeCreationResult , NO_GENERICS , NO_SCOPE_METADATA , SmallVec , UNKNOWN_LINE_NUMBER ,
20- build_field_di_node, file_metadata , file_metadata_from_def_id , size_and_align_of , type_di_node ,
21- unknown_file_metadata, visibility_di_flags,
20+ build_field_di_node, create_member_type , file_metadata , file_metadata_from_def_id ,
21+ size_and_align_of , type_di_node , unknown_file_metadata, visibility_di_flags,
2222} ;
2323use crate :: debuginfo:: utils:: DIB ;
2424use crate :: llvm:: debuginfo:: { DIFile , DIFlags , DIType } ;
@@ -820,7 +820,6 @@ fn build_union_fields_for_direct_tag_enum_or_coroutine<'ll, 'tcx>(
820820 . unwrap_or_else ( || ( unknown_file_metadata ( cx) , UNKNOWN_LINE_NUMBER ) ) ;
821821
822822 let field_name = variant_union_field_name ( variant_member_info. variant_index ) ;
823- let ( size, align) = size_and_align_of ( enum_type_and_layout) ;
824823
825824 let variant_struct_type_wrapper = build_variant_struct_wrapper_type_di_node (
826825 cx,
@@ -840,27 +839,23 @@ fn build_union_fields_for_direct_tag_enum_or_coroutine<'ll, 'tcx>(
840839 } ,
841840 ) ;
842841
843- // We use LLVMRustDIBuilderCreateMemberType () member type directly because
842+ // We use create_member_type () member type directly because
844843 // the build_field_di_node() function does not support specifying a source location,
845844 // which is something that we don't do anywhere else.
846- unsafe {
847- llvm:: LLVMRustDIBuilderCreateMemberType (
848- DIB ( cx) ,
849- enum_type_di_node,
850- field_name. as_c_char_ptr ( ) ,
851- field_name. len ( ) ,
852- file_di_node,
853- line_number,
854- // NOTE: We use the size and align of the entire type, not from variant_layout
855- // since the later is sometimes smaller (if it has fewer fields).
856- size. bits ( ) ,
857- align. bits ( ) as u32 ,
858- // Union fields are always at offset zero
859- Size :: ZERO . bits ( ) ,
860- di_flags,
861- variant_struct_type_wrapper,
862- )
863- }
845+ create_member_type (
846+ cx,
847+ enum_type_di_node,
848+ & field_name,
849+ file_di_node,
850+ line_number,
851+ // NOTE: We use the layout of the entire type, not from variant_layout
852+ // since the later is sometimes smaller (if it has fewer fields).
853+ enum_type_and_layout,
854+ // Union fields are always at offset zero
855+ Size :: ZERO ,
856+ di_flags,
857+ variant_struct_type_wrapper,
858+ )
864859 } ) ) ;
865860
866861 assert_eq ! (
0 commit comments