Skip to content

Commit 2b7dc94

Browse files
authored
Rollup merge of #109635 - Nilstrieb:debrrruginfo, r=compiler=errors
debuginfo: Get pointer size/align from tcx.data_layout instead of layout_of This avoids some type interning and a query execution. It also just makes the code simpler.
2 parents b39db70 + 72c917d commit 2b7dc94

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -176,15 +176,14 @@ fn build_pointer_or_reference_di_node<'ll, 'tcx>(
176176

177177
return_if_di_node_created_in_meantime!(cx, unique_type_id);
178178

179-
let (thin_pointer_size, thin_pointer_align) =
180-
cx.size_and_align_of(cx.tcx.mk_imm_ptr(cx.tcx.types.unit));
179+
let data_layout = &cx.tcx.data_layout;
181180
let ptr_type_debuginfo_name = compute_debuginfo_type_name(cx.tcx, ptr_type, true);
182181

183182
match fat_pointer_kind(cx, pointee_type) {
184183
None => {
185184
// This is a thin pointer. Create a regular pointer type and give it the correct name.
186185
debug_assert_eq!(
187-
(thin_pointer_size, thin_pointer_align),
186+
(data_layout.pointer_size, data_layout.pointer_align.abi),
188187
cx.size_and_align_of(ptr_type),
189188
"ptr_type={}, pointee_type={}",
190189
ptr_type,
@@ -195,8 +194,8 @@ fn build_pointer_or_reference_di_node<'ll, 'tcx>(
195194
llvm::LLVMRustDIBuilderCreatePointerType(
196195
DIB(cx),
197196
pointee_type_di_node,
198-
thin_pointer_size.bits(),
199-
thin_pointer_align.bits() as u32,
197+
data_layout.pointer_size.bits(),
198+
data_layout.pointer_align.abi.bits() as u32,
200199
0, // Ignore DWARF address space.
201200
ptr_type_debuginfo_name.as_ptr().cast(),
202201
ptr_type_debuginfo_name.len(),

0 commit comments

Comments
 (0)