@@ -34,9 +34,9 @@ use super::namespace::mangled_name_of_instance;
3434use super :: type_names:: { compute_debuginfo_type_name, compute_debuginfo_vtable_name} ;
3535use super :: utils:: { DIB , debug_context, get_namespace_for_item, is_node_local_to_unit} ;
3636use crate :: common:: { AsCCharPtr , CodegenCx } ;
37- use crate :: debuginfo:: dwarf_const;
3837use crate :: debuginfo:: metadata:: type_map:: build_type_with_children;
3938use crate :: debuginfo:: utils:: { WidePtrKind , wide_pointer_kind} ;
39+ use crate :: debuginfo:: { DIBuilderExt , dwarf_const} ;
4040use crate :: llvm:: debuginfo:: {
4141 DIBasicType , DIBuilder , DICompositeType , DIDescriptor , DIFile , DIFlags , DILexicalBlock ,
4242 DIScope , DIType , DebugEmissionKind , DebugNameTableKind ,
@@ -1410,23 +1410,18 @@ pub(crate) fn build_global_var_di_node<'ll>(
14101410
14111411 let global_align = cx. align_of ( variable_type) ;
14121412
1413- unsafe {
1414- llvm:: LLVMRustDIBuilderCreateStaticVariable (
1415- DIB ( cx) ,
1416- Some ( var_scope) ,
1417- var_name. as_c_char_ptr ( ) ,
1418- var_name. len ( ) ,
1419- linkage_name. as_c_char_ptr ( ) ,
1420- linkage_name. len ( ) ,
1421- file_metadata,
1422- line_number,
1423- type_di_node,
1424- is_local_to_unit,
1425- global,
1426- None ,
1427- global_align. bits ( ) as u32 ,
1428- ) ;
1429- }
1413+ DIB ( cx) . create_static_variable (
1414+ Some ( var_scope) ,
1415+ var_name,
1416+ linkage_name,
1417+ file_metadata,
1418+ line_number,
1419+ type_di_node,
1420+ is_local_to_unit,
1421+ global, // (value)
1422+ None , // (decl)
1423+ Some ( global_align) ,
1424+ ) ;
14301425}
14311426
14321427/// Generates LLVM debuginfo for a vtable.
@@ -1643,25 +1638,19 @@ pub(crate) fn create_vtable_di_node<'ll, 'tcx>(
16431638 let vtable_name =
16441639 compute_debuginfo_vtable_name ( cx. tcx , ty, poly_trait_ref, VTableNameKind :: GlobalVariable ) ;
16451640 let vtable_type_di_node = build_vtable_type_di_node ( cx, ty, poly_trait_ref) ;
1646- let linkage_name = "" ;
16471641
1648- unsafe {
1649- llvm:: LLVMRustDIBuilderCreateStaticVariable (
1650- DIB ( cx) ,
1651- NO_SCOPE_METADATA ,
1652- vtable_name. as_c_char_ptr ( ) ,
1653- vtable_name. len ( ) ,
1654- linkage_name. as_c_char_ptr ( ) ,
1655- linkage_name. len ( ) ,
1656- unknown_file_metadata ( cx) ,
1657- UNKNOWN_LINE_NUMBER ,
1658- vtable_type_di_node,
1659- true ,
1660- vtable,
1661- None ,
1662- 0 ,
1663- ) ;
1664- }
1642+ DIB ( cx) . create_static_variable (
1643+ NO_SCOPE_METADATA ,
1644+ & vtable_name,
1645+ "" , // (linkage_name)
1646+ unknown_file_metadata ( cx) ,
1647+ UNKNOWN_LINE_NUMBER ,
1648+ vtable_type_di_node,
1649+ true , // (is_local_to_unit)
1650+ vtable, // (value)
1651+ None , // (decl)
1652+ None :: < Align > ,
1653+ ) ;
16651654}
16661655
16671656/// Creates an "extension" of an existing `DIScope` into another file.
0 commit comments