@@ -154,17 +154,12 @@ fn build_pointer_or_reference_di_node<'ll, 'tcx>(
154154 "ptr_type={ptr_type}, pointee_type={pointee_type}" ,
155155 ) ;
156156
157- let di_node = unsafe {
158- llvm:: LLVMRustDIBuilderCreatePointerType (
159- DIB ( cx) ,
160- pointee_type_di_node,
161- data_layout. pointer_size . bits ( ) ,
162- data_layout. pointer_align . abi . bits ( ) as u32 ,
163- 0 , // Ignore DWARF address space.
164- ptr_type_debuginfo_name. as_c_char_ptr ( ) ,
165- ptr_type_debuginfo_name. len ( ) ,
166- )
167- } ;
157+ let di_node = DIB ( cx) . create_pointer_type (
158+ pointee_type_di_node,
159+ data_layout. pointer_size ,
160+ data_layout. pointer_align . abi ,
161+ & ptr_type_debuginfo_name,
162+ ) ;
168163
169164 DINodeCreationResult { di_node, already_stored_in_typemap : false }
170165 }
@@ -212,17 +207,12 @@ fn build_pointer_or_reference_di_node<'ll, 'tcx>(
212207
213208 // The data pointer type is a regular, thin pointer, regardless of whether this
214209 // is a slice or a trait object.
215- let data_ptr_type_di_node = unsafe {
216- llvm:: LLVMRustDIBuilderCreatePointerType (
217- DIB ( cx) ,
218- pointee_type_di_node,
219- addr_field. size . bits ( ) ,
220- addr_field. align . abi . bits ( ) as u32 ,
221- 0 , // Ignore DWARF address space.
222- std:: ptr:: null ( ) ,
223- 0 ,
224- )
225- } ;
210+ let data_ptr_type_di_node = DIB ( cx) . create_pointer_type (
211+ pointee_type_di_node,
212+ addr_field. size ,
213+ addr_field. align . abi ,
214+ "" ,
215+ ) ;
226216
227217 smallvec ! [
228218 build_field_di_node(
@@ -302,24 +292,11 @@ fn build_subroutine_type_di_node<'ll, 'tcx>(
302292 // This is actually a function pointer, so wrap it in pointer DI.
303293 let name = compute_debuginfo_type_name ( cx. tcx , fn_ty, false ) ;
304294 let ( size, align) = match fn_ty. kind ( ) {
305- ty:: FnDef ( ..) => ( 0 , 1 ) ,
306- ty:: FnPtr ( ..) => (
307- cx. tcx . data_layout . pointer_size . bits ( ) ,
308- cx. tcx . data_layout . pointer_align . abi . bits ( ) as u32 ,
309- ) ,
295+ ty:: FnDef ( ..) => ( Size :: ZERO , Align :: ONE ) ,
296+ ty:: FnPtr ( ..) => ( cx. tcx . data_layout . pointer_size , cx. tcx . data_layout . pointer_align . abi ) ,
310297 _ => unreachable ! ( ) ,
311298 } ;
312- let di_node = unsafe {
313- llvm:: LLVMRustDIBuilderCreatePointerType (
314- DIB ( cx) ,
315- fn_di_node,
316- size,
317- align,
318- 0 , // Ignore DWARF address space.
319- name. as_c_char_ptr ( ) ,
320- name. len ( ) ,
321- )
322- } ;
299+ let di_node = DIB ( cx) . create_pointer_type ( fn_di_node, size, align, & name) ;
323300
324301 DINodeCreationResult :: new ( di_node, false )
325302}
0 commit comments