Resolve EnumTagInfo FIXME
This commit is contained in:
parent
f353cbf1a1
commit
b644f06326
1 changed files with 11 additions and 15 deletions
|
@ -1507,7 +1507,7 @@ impl EnumMemberDescriptionFactory<'ll, 'tcx> {
|
||||||
cx,
|
cx,
|
||||||
self.layout,
|
self.layout,
|
||||||
variant_info,
|
variant_info,
|
||||||
NoTag,
|
None,
|
||||||
self_metadata,
|
self_metadata,
|
||||||
self.span,
|
self.span,
|
||||||
);
|
);
|
||||||
|
@ -1539,13 +1539,13 @@ impl EnumMemberDescriptionFactory<'ll, 'tcx> {
|
||||||
..
|
..
|
||||||
} => {
|
} => {
|
||||||
let tag_info = if fallback {
|
let tag_info = if fallback {
|
||||||
RegularTag {
|
Some(DirectTag {
|
||||||
tag_field: Field::from(tag_field),
|
tag_field: Field::from(tag_field),
|
||||||
tag_type_metadata: self.tag_type_metadata.unwrap(),
|
tag_type_metadata: self.tag_type_metadata.unwrap(),
|
||||||
}
|
})
|
||||||
} else {
|
} else {
|
||||||
// This doesn't matter in this case.
|
// This doesn't matter in this case.
|
||||||
NoTag
|
None
|
||||||
};
|
};
|
||||||
variants
|
variants
|
||||||
.iter_enumerated()
|
.iter_enumerated()
|
||||||
|
@ -1606,7 +1606,7 @@ impl EnumMemberDescriptionFactory<'ll, 'tcx> {
|
||||||
cx,
|
cx,
|
||||||
variant,
|
variant,
|
||||||
variant_info_for(dataful_variant),
|
variant_info_for(dataful_variant),
|
||||||
OptimizedTag,
|
Some(NicheTag),
|
||||||
self.containing_scope,
|
self.containing_scope,
|
||||||
self.span,
|
self.span,
|
||||||
);
|
);
|
||||||
|
@ -1681,7 +1681,7 @@ impl EnumMemberDescriptionFactory<'ll, 'tcx> {
|
||||||
cx,
|
cx,
|
||||||
variant,
|
variant,
|
||||||
variant_info,
|
variant_info,
|
||||||
OptimizedTag,
|
Some(NicheTag),
|
||||||
self_metadata,
|
self_metadata,
|
||||||
self.span,
|
self.span,
|
||||||
);
|
);
|
||||||
|
@ -1771,14 +1771,10 @@ impl VariantMemberDescriptionFactory<'ll, 'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: terminology here should be aligned with `abi::TagEncoding`.
|
|
||||||
// `OptimizedTag` is `TagEncoding::Niche`, `RegularTag` is `TagEncoding::Direct`.
|
|
||||||
// `NoTag` should be removed; users should use `Option<EnumTagInfo>` instead.
|
|
||||||
#[derive(Copy, Clone)]
|
#[derive(Copy, Clone)]
|
||||||
enum EnumTagInfo<'ll> {
|
enum EnumTagInfo<'ll> {
|
||||||
RegularTag { tag_field: Field, tag_type_metadata: &'ll DIType },
|
DirectTag { tag_field: Field, tag_type_metadata: &'ll DIType },
|
||||||
OptimizedTag,
|
NicheTag,
|
||||||
NoTag,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone)]
|
#[derive(Copy, Clone)]
|
||||||
|
@ -1859,7 +1855,7 @@ fn describe_enum_variant(
|
||||||
cx: &CodegenCx<'ll, 'tcx>,
|
cx: &CodegenCx<'ll, 'tcx>,
|
||||||
layout: layout::TyAndLayout<'tcx>,
|
layout: layout::TyAndLayout<'tcx>,
|
||||||
variant: VariantInfo<'_, 'tcx>,
|
variant: VariantInfo<'_, 'tcx>,
|
||||||
discriminant_info: EnumTagInfo<'ll>,
|
discriminant_info: Option<EnumTagInfo<'ll>>,
|
||||||
containing_scope: &'ll DIScope,
|
containing_scope: &'ll DIScope,
|
||||||
span: Span,
|
span: Span,
|
||||||
) -> (&'ll DICompositeType, MemberDescriptionFactory<'ll, 'tcx>) {
|
) -> (&'ll DICompositeType, MemberDescriptionFactory<'ll, 'tcx>) {
|
||||||
|
@ -1882,7 +1878,7 @@ fn describe_enum_variant(
|
||||||
let (offsets, args) = if use_enum_fallback(cx) {
|
let (offsets, args) = if use_enum_fallback(cx) {
|
||||||
// If this is not a univariant enum, there is also the discriminant field.
|
// If this is not a univariant enum, there is also the discriminant field.
|
||||||
let (discr_offset, discr_arg) = match discriminant_info {
|
let (discr_offset, discr_arg) = match discriminant_info {
|
||||||
RegularTag { tag_field, .. } => {
|
Some(DirectTag { tag_field, .. }) => {
|
||||||
// We have the layout of an enum variant, we need the layout of the outer enum
|
// We have the layout of an enum variant, we need the layout of the outer enum
|
||||||
let enum_layout = cx.layout_of(layout.ty);
|
let enum_layout = cx.layout_of(layout.ty);
|
||||||
let offset = enum_layout.fields.offset(tag_field.as_usize());
|
let offset = enum_layout.fields.offset(tag_field.as_usize());
|
||||||
|
@ -1919,7 +1915,7 @@ fn describe_enum_variant(
|
||||||
offsets,
|
offsets,
|
||||||
args,
|
args,
|
||||||
tag_type_metadata: match discriminant_info {
|
tag_type_metadata: match discriminant_info {
|
||||||
RegularTag { tag_type_metadata, .. } => Some(tag_type_metadata),
|
Some(DirectTag { tag_type_metadata, .. }) => Some(tag_type_metadata),
|
||||||
_ => None,
|
_ => None,
|
||||||
},
|
},
|
||||||
span,
|
span,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue