Skip to content

Commit 38aff5d

Browse files
committed
generate typedef nodes for ptr/ref and array
1 parent a2db928 commit 38aff5d

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,21 @@ fn build_fixed_size_array_di_node<'ll, 'tcx>(
131131
)
132132
};
133133

134+
if cpp_like_debuginfo(cx.tcx) {
135+
let array_type_name = compute_debuginfo_type_name(cx.tcx, array_type, false);
136+
di_node = unsafe {
137+
llvm::LLVMRustDIBuilderCreateTypedef(
138+
DIB(cx),
139+
di_node,
140+
array_type_name.as_c_char_ptr(),
141+
array_type_name.len(),
142+
unknown_file_metadata(cx),
143+
UNKNOWN_LINE_NUMBER,
144+
None,
145+
)
146+
};
147+
}
148+
134149
DINodeCreationResult::new(di_node, false)
135150
}
136151

@@ -180,8 +195,19 @@ fn build_pointer_or_reference_di_node<'ll, 'tcx>(
180195
pointer_align.abi,
181196
&ptr_type_debuginfo_name,
182197
);
198+
let typedefed_ptr = unsafe {
199+
llvm::LLVMRustDIBuilderCreateTypedef(
200+
DIB(cx),
201+
di_node,
202+
ptr_type_debuginfo_name.as_c_char_ptr(),
203+
ptr_type_debuginfo_name.len(),
204+
unknown_file_metadata(cx),
205+
UNKNOWN_LINE_NUMBER,
206+
None,
207+
)
208+
};
183209

184-
DINodeCreationResult { di_node, already_stored_in_typemap: false }
210+
DINodeCreationResult { di_node: typedefed_ptr, already_stored_in_typemap: false }
185211
}
186212
Some(wide_pointer_kind) => {
187213
type_map::build_type_with_children(

0 commit comments

Comments
 (0)