Skip to content

Commit b956ce7

Browse files
committed
Revert "Create a safe wrapper around LLVMRustDIBuilderCreateSubroutineType"
This reverts commit e19e4e3.
1 parent 13065dd commit b956ce7

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs

+8-10
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ use crate::debuginfo::metadata::type_map::build_type_with_children;
3838
use crate::debuginfo::utils::{WidePtrKind, wide_pointer_kind};
3939
use crate::llvm;
4040
use crate::llvm::debuginfo::{
41-
DICompositeType, DIDescriptor, DIFile, DIFlags, DILexicalBlock, DIScope, DIType,
42-
DebugEmissionKind, DebugNameTableKind,
41+
DIDescriptor, DIFile, DIFlags, DILexicalBlock, DIScope, DIType, DebugEmissionKind,
42+
DebugNameTableKind,
4343
};
4444
use crate::value::Value;
4545

@@ -312,7 +312,12 @@ fn build_subroutine_type_di_node<'ll, 'tcx>(
312312

313313
debug_context(cx).type_map.unique_id_to_di_node.borrow_mut().remove(&unique_type_id);
314314

315-
let fn_di_node = create_subroutine_type(cx, create_DIArray(DIB(cx), &signature_di_nodes[..]));
315+
let fn_di_node = unsafe {
316+
llvm::LLVMRustDIBuilderCreateSubroutineType(
317+
DIB(cx),
318+
create_DIArray(DIB(cx), &signature_di_nodes[..]),
319+
)
320+
};
316321

317322
// This is actually a function pointer, so wrap it in pointer DI.
318323
let name = compute_debuginfo_type_name(cx.tcx, fn_ty, false);
@@ -336,13 +341,6 @@ fn build_subroutine_type_di_node<'ll, 'tcx>(
336341
DINodeCreationResult::new(di_node, false)
337342
}
338343

339-
pub(super) fn create_subroutine_type<'ll>(
340-
cx: &CodegenCx<'ll, '_>,
341-
signature: &'ll DICompositeType,
342-
) -> &'ll DICompositeType {
343-
unsafe { llvm::LLVMRustDIBuilderCreateSubroutineType(DIB(cx), signature) }
344-
}
345-
346344
/// Create debuginfo for `dyn SomeTrait` types. Currently these are empty structs
347345
/// we with the correct type name (e.g. "dyn SomeTrait<Foo, Item=u32> + Sync").
348346
fn build_dyn_type_di_node<'ll, 'tcx>(

compiler/rustc_codegen_llvm/src/debuginfo/mod.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ use std::ptr;
66
use std::sync::Arc;
77

88
use libc::c_uint;
9-
use metadata::create_subroutine_type;
109
use rustc_abi::Size;
1110
use rustc_codegen_ssa::debuginfo::type_names;
1211
use rustc_codegen_ssa::mir::debuginfo::VariableKind::*;
@@ -342,8 +341,10 @@ impl<'ll, 'tcx> DebugInfoCodegenMethods<'tcx> for CodegenCx<'ll, 'tcx> {
342341
let loc = self.lookup_debug_loc(span.lo());
343342
let file_metadata = file_metadata(self, &loc.file);
344343

345-
let function_type_metadata =
346-
create_subroutine_type(self, get_function_signature(self, fn_abi));
344+
let function_type_metadata = unsafe {
345+
let fn_signature = get_function_signature(self, fn_abi);
346+
llvm::LLVMRustDIBuilderCreateSubroutineType(DIB(self), fn_signature)
347+
};
347348

348349
let mut name = String::with_capacity(64);
349350
type_names::push_item_name(tcx, def_id, false, &mut name);

0 commit comments

Comments
 (0)