@@ -22,6 +22,7 @@ use rustc_target::spec::DebuginfoKind;
2222use smallvec:: smallvec;
2323use tracing:: { debug, instrument} ;
2424
25+ pub ( crate ) use self :: type_map:: TypeMap ;
2526use self :: type_map:: { DINodeCreationResult , Stub , UniqueTypeId } ;
2627use super :: CodegenUnitDebugContext ;
2728use super :: namespace:: mangled_name_of_instance;
@@ -30,6 +31,7 @@ use super::utils::{
3031 DIB , create_DIArray, debug_context, get_namespace_for_item, is_node_local_to_unit,
3132} ;
3233use crate :: common:: { AsCCharPtr , CodegenCx } ;
34+ use crate :: debuginfo:: dwarf_const;
3335use crate :: debuginfo:: metadata:: type_map:: build_type_with_children;
3436use crate :: debuginfo:: utils:: { WidePtrKind , wide_pointer_kind} ;
3537use crate :: llvm:: debuginfo:: {
@@ -59,23 +61,6 @@ impl fmt::Debug for llvm::Metadata {
5961 }
6062}
6163
62- // From DWARF 5.
63- // See http://www.dwarfstd.org/ShowIssue.php?issue=140129.1.
64- const DW_LANG_RUST : c_uint = 0x1c ;
65- #[ allow( non_upper_case_globals) ]
66- const DW_ATE_boolean : c_uint = 0x02 ;
67- #[ allow( non_upper_case_globals) ]
68- const DW_ATE_float : c_uint = 0x04 ;
69- #[ allow( non_upper_case_globals) ]
70- const DW_ATE_signed : c_uint = 0x05 ;
71- #[ allow( non_upper_case_globals) ]
72- const DW_ATE_unsigned : c_uint = 0x07 ;
73- #[ allow( non_upper_case_globals) ]
74- const DW_ATE_UTF : c_uint = 0x10 ;
75-
76- #[ allow( non_upper_case_globals) ]
77- const DW_TAG_const_type : c_uint = 0x26 ;
78-
7964pub ( super ) const UNKNOWN_LINE_NUMBER : c_uint = 0 ;
8065pub ( super ) const UNKNOWN_COLUMN_NUMBER : c_uint = 0 ;
8166
@@ -90,8 +75,6 @@ type SmallVec<T> = smallvec::SmallVec<[T; 16]>;
9075mod enums;
9176mod type_map;
9277
93- pub ( crate ) use type_map:: TypeMap ;
94-
9578/// Returns from the enclosing function if the type debuginfo node with the given
9679/// unique ID can be found in the type map.
9780macro_rules! return_if_di_node_created_in_meantime {
@@ -522,7 +505,7 @@ fn recursion_marker_type_di_node<'ll, 'tcx>(cx: &CodegenCx<'ll, 'tcx>) -> &'ll D
522505 name. as_c_char_ptr ( ) ,
523506 name. len ( ) ,
524507 cx. tcx . data_layout . pointer_size . bits ( ) ,
525- DW_ATE_unsigned ,
508+ dwarf_const :: DW_ATE_unsigned ,
526509 )
527510 }
528511 } )
@@ -781,6 +764,8 @@ fn build_basic_type_di_node<'ll, 'tcx>(
781764 // .natvis visualizers (and perhaps other existing native debuggers?)
782765 let cpp_like_debuginfo = cpp_like_debuginfo ( cx. tcx ) ;
783766
767+ use dwarf_const:: { DW_ATE_UTF , DW_ATE_boolean , DW_ATE_float , DW_ATE_signed , DW_ATE_unsigned } ;
768+
784769 let ( name, encoding) = match t. kind ( ) {
785770 ty:: Never => ( "!" , DW_ATE_unsigned ) ,
786771 ty:: Tuple ( elements) if elements. is_empty ( ) => {
@@ -961,7 +946,7 @@ pub(crate) fn build_compile_unit_di_node<'ll, 'tcx>(
961946
962947 let unit_metadata = llvm:: LLVMRustDIBuilderCreateCompileUnit (
963948 debug_context. builder ,
964- DW_LANG_RUST ,
949+ dwarf_const :: DW_LANG_Rust ,
965950 compile_unit_file,
966951 producer. as_c_char_ptr ( ) ,
967952 producer. len ( ) ,
0 commit comments