@@ -22,6 +22,7 @@ use rustc_target::spec::DebuginfoKind;
22
22
use smallvec:: smallvec;
23
23
use tracing:: { debug, instrument} ;
24
24
25
+ pub ( crate ) use self :: type_map:: TypeMap ;
25
26
use self :: type_map:: { DINodeCreationResult , Stub , UniqueTypeId } ;
26
27
use super :: CodegenUnitDebugContext ;
27
28
use super :: namespace:: mangled_name_of_instance;
@@ -30,6 +31,7 @@ use super::utils::{
30
31
DIB , create_DIArray, debug_context, get_namespace_for_item, is_node_local_to_unit,
31
32
} ;
32
33
use crate :: common:: { AsCCharPtr , CodegenCx } ;
34
+ use crate :: debuginfo:: dwarf_const;
33
35
use crate :: debuginfo:: metadata:: type_map:: build_type_with_children;
34
36
use crate :: debuginfo:: utils:: { WidePtrKind , wide_pointer_kind} ;
35
37
use crate :: llvm:: debuginfo:: {
@@ -59,20 +61,6 @@ impl fmt::Debug for llvm::Metadata {
59
61
}
60
62
}
61
63
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
64
pub ( super ) const UNKNOWN_LINE_NUMBER : c_uint = 0 ;
77
65
pub ( super ) const UNKNOWN_COLUMN_NUMBER : c_uint = 0 ;
78
66
@@ -87,8 +75,6 @@ type SmallVec<T> = smallvec::SmallVec<[T; 16]>;
87
75
mod enums;
88
76
mod type_map;
89
77
90
- pub ( crate ) use type_map:: TypeMap ;
91
-
92
78
/// Returns from the enclosing function if the type debuginfo node with the given
93
79
/// unique ID can be found in the type map.
94
80
macro_rules! return_if_di_node_created_in_meantime {
@@ -519,7 +505,7 @@ fn recursion_marker_type_di_node<'ll, 'tcx>(cx: &CodegenCx<'ll, 'tcx>) -> &'ll D
519
505
name. as_c_char_ptr ( ) ,
520
506
name. len ( ) ,
521
507
cx. tcx . data_layout . pointer_size . bits ( ) ,
522
- DW_ATE_unsigned ,
508
+ dwarf_const :: DW_ATE_unsigned ,
523
509
)
524
510
}
525
511
} )
@@ -778,6 +764,8 @@ fn build_basic_type_di_node<'ll, 'tcx>(
778
764
// .natvis visualizers (and perhaps other existing native debuggers?)
779
765
let cpp_like_debuginfo = cpp_like_debuginfo ( cx. tcx ) ;
780
766
767
+ use dwarf_const:: { DW_ATE_UTF , DW_ATE_boolean , DW_ATE_float , DW_ATE_signed , DW_ATE_unsigned } ;
768
+
781
769
let ( name, encoding) = match t. kind ( ) {
782
770
ty:: Never => ( "!" , DW_ATE_unsigned ) ,
783
771
ty:: Tuple ( elements) if elements. is_empty ( ) => {
@@ -958,7 +946,7 @@ pub(crate) fn build_compile_unit_di_node<'ll, 'tcx>(
958
946
959
947
let unit_metadata = llvm:: LLVMRustDIBuilderCreateCompileUnit (
960
948
debug_context. builder ,
961
- DW_LANG_RUST ,
949
+ dwarf_const :: DW_LANG_RUST ,
962
950
compile_unit_file,
963
951
producer. as_c_char_ptr ( ) ,
964
952
producer. len ( ) ,
0 commit comments