Skip to content

Commit f9ac7ac

Browse files
committed
Add location info for f16
1 parent 64dd582 commit f9ac7ac

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs

+18
Original file line numberDiff line numberDiff line change
@@ -728,19 +728,36 @@ fn build_cpp_f16_di_node<'ll, 'tcx>(cx: &CodegenCx<'ll, 'tcx>) -> DINodeCreation
728728
// `f16`'s value to be displayed using a Natvis visualiser in `intrinsic.natvis`.
729729
let float_ty = cx.tcx.types.f16;
730730
let bits_ty = cx.tcx.types.u16;
731+
let def_location = if cx.sess().opts.unstable_opts.debug_info_type_line_numbers {
732+
match float_ty.kind() {
733+
ty::Adt(def, _) => Some(file_metadata_from_def_id(cx, Some(def.did()))),
734+
_ => None,
735+
}
736+
} else {
737+
None
738+
};
731739
type_map::build_type_with_children(
732740
cx,
733741
type_map::stub(
734742
cx,
735743
Stub::Struct,
736744
UniqueTypeId::for_ty(cx.tcx, float_ty),
737745
"f16",
746+
def_location,
738747
cx.size_and_align_of(float_ty),
739748
NO_SCOPE_METADATA,
740749
DIFlags::FlagZero,
741750
),
742751
// Fields:
743752
|cx, float_di_node| {
753+
let def_id = if cx.sess().opts.unstable_opts.debug_info_type_line_numbers {
754+
match bits_ty.kind() {
755+
ty::Adt(def, _) => Some(def.did()),
756+
_ => None,
757+
}
758+
} else {
759+
None
760+
};
744761
smallvec![build_field_di_node(
745762
cx,
746763
float_di_node,
@@ -749,6 +766,7 @@ fn build_cpp_f16_di_node<'ll, 'tcx>(cx: &CodegenCx<'ll, 'tcx>) -> DINodeCreation
749766
Size::ZERO,
750767
DIFlags::FlagZero,
751768
type_di_node(cx, bits_ty),
769+
def_id,
752770
)]
753771
},
754772
NO_GENERICS,

0 commit comments

Comments
 (0)