@@ -4,7 +4,7 @@ use std::hash::{Hash, Hasher};
4
4
use std:: path:: { Path , PathBuf } ;
5
5
use std:: { iter, ptr} ;
6
6
7
- use libc:: { c_char, c_longlong , c_uint} ;
7
+ use libc:: { c_char, c_uint} ;
8
8
use rustc_abi:: { Align , Size } ;
9
9
use rustc_codegen_ssa:: debuginfo:: type_names:: { VTableNameKind , cpp_like_debuginfo} ;
10
10
use rustc_codegen_ssa:: traits:: * ;
@@ -27,9 +27,7 @@ use self::type_map::{DINodeCreationResult, Stub, UniqueTypeId};
27
27
use super :: CodegenUnitDebugContext ;
28
28
use super :: namespace:: mangled_name_of_instance;
29
29
use super :: type_names:: { compute_debuginfo_type_name, compute_debuginfo_vtable_name} ;
30
- use super :: utils:: {
31
- DIB , create_DIArray, debug_context, get_namespace_for_item, is_node_local_to_unit,
32
- } ;
30
+ use super :: utils:: { DIB , debug_context, get_namespace_for_item, is_node_local_to_unit} ;
33
31
use crate :: common:: { AsCCharPtr , CodegenCx } ;
34
32
use crate :: debuginfo:: metadata:: type_map:: build_type_with_children;
35
33
use crate :: debuginfo:: utils:: { WidePtrKind , wide_pointer_kind} ;
@@ -123,21 +121,26 @@ fn build_fixed_size_array_di_node<'ll, 'tcx>(
123
121
124
122
let ( size, align) = cx. size_and_align_of ( array_type) ;
125
123
126
- let upper_bound = len
127
- . try_to_target_usize ( cx. tcx )
128
- . expect ( "expected monomorphic const in codegen" ) as c_longlong ;
124
+ let upper_bound =
125
+ len. try_to_target_usize ( cx. tcx ) . expect ( "expected monomorphic const in codegen" ) ;
129
126
130
- let subrange =
131
- unsafe { Some ( llvm:: LLVMRustDIBuilderGetOrCreateSubrange ( DIB ( cx) , 0 , upper_bound) ) } ;
127
+ let subrange = unsafe {
128
+ llvm:: LLVMDIBuilderGetOrCreateSubrange (
129
+ DIB ( cx) ,
130
+ /* LowerBound */ 0i64 ,
131
+ /* Count */ upper_bound as i64 ,
132
+ )
133
+ } ;
132
134
133
- let subscripts = create_DIArray ( DIB ( cx ) , & [ subrange] ) ;
135
+ let subscripts = & [ subrange] ;
134
136
let di_node = unsafe {
135
- llvm:: LLVMRustDIBuilderCreateArrayType (
137
+ llvm:: LLVMDIBuilderCreateArrayType (
136
138
DIB ( cx) ,
137
139
size. bits ( ) ,
138
140
align. bits ( ) as u32 ,
139
141
element_type_di_node,
140
- subscripts,
142
+ subscripts. as_ptr ( ) ,
143
+ subscripts. len ( ) as c_uint ,
141
144
)
142
145
} ;
143
146
@@ -182,13 +185,13 @@ fn build_pointer_or_reference_di_node<'ll, 'tcx>(
182
185
) ;
183
186
184
187
let di_node = unsafe {
185
- llvm:: LLVMRustDIBuilderCreatePointerType (
188
+ llvm:: LLVMDIBuilderCreatePointerType (
186
189
DIB ( cx) ,
187
190
pointee_type_di_node,
188
191
data_layout. pointer_size . bits ( ) ,
189
192
data_layout. pointer_align . abi . bits ( ) as u32 ,
190
193
0 , // Ignore DWARF address space.
191
- ptr_type_debuginfo_name. as_c_char_ptr ( ) ,
194
+ ptr_type_debuginfo_name. as_ptr ( ) ,
192
195
ptr_type_debuginfo_name. len ( ) ,
193
196
)
194
197
} ;
@@ -240,7 +243,7 @@ fn build_pointer_or_reference_di_node<'ll, 'tcx>(
240
243
// The data pointer type is a regular, thin pointer, regardless of whether this
241
244
// is a slice or a trait object.
242
245
let data_ptr_type_di_node = unsafe {
243
- llvm:: LLVMRustDIBuilderCreatePointerType (
246
+ llvm:: LLVMDIBuilderCreatePointerType (
244
247
DIB ( cx) ,
245
248
pointee_type_di_node,
246
249
addr_field. size . bits ( ) ,
@@ -325,9 +328,12 @@ fn build_subroutine_type_di_node<'ll, 'tcx>(
325
328
debug_context ( cx) . type_map . unique_id_to_di_node . borrow_mut ( ) . remove ( & unique_type_id) ;
326
329
327
330
let fn_di_node = unsafe {
328
- llvm:: LLVMRustDIBuilderCreateSubroutineType (
331
+ llvm:: LLVMDIBuilderCreateSubroutineType (
329
332
DIB ( cx) ,
330
- create_DIArray ( DIB ( cx) , & signature_di_nodes[ ..] ) ,
333
+ /* File (unused) */ None ,
334
+ signature_di_nodes. as_ptr ( ) ,
335
+ signature_di_nodes. len ( ) as c_uint ,
336
+ DIFlags :: FlagZero ,
331
337
)
332
338
} ;
333
339
@@ -342,13 +348,13 @@ fn build_subroutine_type_di_node<'ll, 'tcx>(
342
348
_ => unreachable ! ( ) ,
343
349
} ;
344
350
let di_node = unsafe {
345
- llvm:: LLVMRustDIBuilderCreatePointerType (
351
+ llvm:: LLVMDIBuilderCreatePointerType (
346
352
DIB ( cx) ,
347
353
fn_di_node,
348
354
size,
349
355
align,
350
356
0 , // Ignore DWARF address space.
351
- name. as_c_char_ptr ( ) ,
357
+ name. as_ptr ( ) ,
352
358
name. len ( ) ,
353
359
)
354
360
} ;
@@ -515,12 +521,13 @@ fn recursion_marker_type_di_node<'ll, 'tcx>(cx: &CodegenCx<'ll, 'tcx>) -> &'ll D
515
521
// FIXME: it might make sense to use an actual pointer type here
516
522
// so that debuggers can show the address.
517
523
let name = "<recur_type>" ;
518
- llvm:: LLVMRustDIBuilderCreateBasicType (
524
+ llvm:: LLVMDIBuilderCreateBasicType (
519
525
DIB ( cx) ,
520
- name. as_c_char_ptr ( ) ,
526
+ name. as_ptr ( ) ,
521
527
name. len ( ) ,
522
528
cx. tcx . data_layout . pointer_size . bits ( ) ,
523
529
DW_ATE_unsigned ,
530
+ DIFlags :: FlagZero ,
524
531
)
525
532
}
526
533
} )
@@ -803,12 +810,13 @@ fn build_basic_type_di_node<'ll, 'tcx>(
803
810
} ;
804
811
805
812
let ty_di_node = unsafe {
806
- llvm:: LLVMRustDIBuilderCreateBasicType (
813
+ llvm:: LLVMDIBuilderCreateBasicType (
807
814
DIB ( cx) ,
808
- name. as_c_char_ptr ( ) ,
815
+ name. as_ptr ( ) ,
809
816
name. len ( ) ,
810
817
cx. size_of ( t) . bits ( ) ,
811
818
encoding,
819
+ DIFlags :: FlagZero ,
812
820
)
813
821
} ;
814
822
@@ -824,14 +832,15 @@ fn build_basic_type_di_node<'ll, 'tcx>(
824
832
} ;
825
833
826
834
let typedef_di_node = unsafe {
827
- llvm:: LLVMRustDIBuilderCreateTypedef (
835
+ llvm:: LLVMDIBuilderCreateTypedef (
828
836
DIB ( cx) ,
829
837
ty_di_node,
830
- typedef_name. as_c_char_ptr ( ) ,
838
+ typedef_name. as_ptr ( ) ,
831
839
typedef_name. len ( ) ,
832
840
unknown_file_metadata ( cx) ,
833
- 0 ,
834
- None ,
841
+ /* LineNo */ 0u32 ,
842
+ /* Scope */ None ,
843
+ /* AlignInBits (optional) */ 0u32 ,
835
844
)
836
845
} ;
837
846
@@ -945,7 +954,7 @@ pub(crate) fn build_compile_unit_di_node<'ll, 'tcx>(
945
954
946
955
unsafe {
947
956
let compile_unit_file = llvm:: LLVMRustDIBuilderCreateFile (
948
- debug_context. builder ,
957
+ debug_context. builder . as_ref ( ) ,
949
958
name_in_debuginfo. as_c_char_ptr ( ) ,
950
959
name_in_debuginfo. len ( ) ,
951
960
work_dir. as_c_char_ptr ( ) ,
@@ -958,7 +967,7 @@ pub(crate) fn build_compile_unit_di_node<'ll, 'tcx>(
958
967
) ;
959
968
960
969
let unit_metadata = llvm:: LLVMRustDIBuilderCreateCompileUnit (
961
- debug_context. builder ,
970
+ debug_context. builder . as_ref ( ) ,
962
971
DW_LANG_RUST ,
963
972
compile_unit_file,
964
973
producer. as_c_char_ptr ( ) ,
@@ -999,10 +1008,10 @@ fn build_field_di_node<'ll, 'tcx>(
999
1008
( unknown_file_metadata ( cx) , UNKNOWN_LINE_NUMBER )
1000
1009
} ;
1001
1010
unsafe {
1002
- llvm:: LLVMRustDIBuilderCreateMemberType (
1011
+ llvm:: LLVMDIBuilderCreateMemberType (
1003
1012
DIB ( cx) ,
1004
1013
owner,
1005
- name. as_c_char_ptr ( ) ,
1014
+ name. as_ptr ( ) ,
1006
1015
name. len ( ) ,
1007
1016
file_metadata,
1008
1017
line_number,
@@ -1630,7 +1639,14 @@ pub(crate) fn extend_scope_to_file<'ll>(
1630
1639
file : & SourceFile ,
1631
1640
) -> & ' ll DILexicalBlock {
1632
1641
let file_metadata = file_metadata ( cx, file) ;
1633
- unsafe { llvm:: LLVMRustDIBuilderCreateLexicalBlockFile ( DIB ( cx) , scope_metadata, file_metadata) }
1642
+ unsafe {
1643
+ llvm:: LLVMDIBuilderCreateLexicalBlockFile (
1644
+ DIB ( cx) ,
1645
+ scope_metadata,
1646
+ file_metadata,
1647
+ /* Discriminator (default) */ 0u32 ,
1648
+ )
1649
+ }
1634
1650
}
1635
1651
1636
1652
fn tuple_field_name ( field_index : usize ) -> Cow < ' static , str > {
0 commit comments