Change the type name from _enum<..> to enum$<..>

This makes the type name inline with the proposed standard in #85269.
This commit is contained in:
Wesley Wiser 2021-05-20 13:58:13 -04:00
parent d2d6fa852d
commit ef053fd6f0
5 changed files with 44 additions and 44 deletions

View File

@ -1537,7 +1537,7 @@ impl EnumMemberDescriptionFactory<'ll, 'tcx> {
// For MSVC, we generate a union of structs for each variant with an explicit
// discriminant field roughly equivalent to the following C:
// ```c
// union _enum<{name}> {
// union enum$<{name}> {
// struct {variant 0 name} {
// tag$ variant$;
// <variant 0 fields>
@ -1628,7 +1628,7 @@ impl EnumMemberDescriptionFactory<'ll, 'tcx> {
// make the discriminant field that type. We then use natvis to render the enum type correctly in Windbg/VS.
// This will generate debuginfo roughly equivalent to the following C:
// ```c
// union _enum<{name}, {min niche}, {max niche}, {dataful variant name} {
// union enum$<{name}, {min niche}, {max niche}, {dataful variant name} {
// struct dataful_variant {
// <fields in dataful variant>
// },
@ -1639,7 +1639,7 @@ impl EnumMemberDescriptionFactory<'ll, 'tcx> {
// }
// }
// ```
// The natvis in `intrinsic.natvis` matches on the type name `_enum<*, *, *, *>`
// The natvis in `intrinsic.natvis` matches on the type name `enum$<*, *, *, *>`
// and evaluates `this.discriminant$.discriminant`. If the value is between
// the min niche and max niche, then the enum is in the dataful variant and
// `this.dataful_variant` is rendered. Otherwise, the enum is in one of the

View File

@ -267,7 +267,7 @@ pub fn push_debuginfo_type_name<'tcx>(
let max = dataful_discriminant_range.end();
let max = tag.value.size(&tcx).truncate(*max);
output.push_str("_enum<");
output.push_str("enum$<");
push_item_name(tcx, def.did, true, output);
push_type_params(tcx, substs, output, visited);
@ -275,7 +275,7 @@ pub fn push_debuginfo_type_name<'tcx>(
output.push_str(&format!(", {}, {}, {}>", min, max, dataful_variant_name));
} else {
output.push_str("_enum<");
output.push_str("enum$<");
push_item_name(tcx, def.did, true, output);
push_type_params(tcx, substs, output, visited);
output.push('>');

View File

@ -149,7 +149,7 @@
<Synthetic Name="[...]"><DisplayString>...</DisplayString></Synthetic>
</Expand>
</Type>
<Type Name="_enum&lt;*&gt;">
<Type Name="enum$&lt;*&gt;">
<Intrinsic Name="tag" Expression="Variant0.variant$" />
<DisplayString Condition="tag() == 0">{tag(),en}</DisplayString>
<DisplayString Condition="tag() == 1" Optional="true">{tag(),en}</DisplayString>
@ -189,7 +189,7 @@
</Type>
<!-- $T1 is the name of the enum, $T2 is the low value of the dataful variant tag, $T3 is the high value of the dataful variant tag, $T4 is the name of the dataful variant -->
<Type Name="_enum&lt;*, *, *, *&gt;">
<Type Name="enum$&lt;*, *, *, *&gt;">
<Intrinsic Name="tag" Expression="discriminant$.discriminant" />
<Intrinsic Name="is_dataful" Expression="tag() &gt;= $T2 &amp;&amp; tag() &lt;= $T3" />
<DisplayString Condition="is_dataful()">{"$T4",sb}({dataful_variant})</DisplayString>

View File

@ -8,72 +8,72 @@
// so the best we can do is to make sure we are generating the right debuginfo
// cdb-command: dx -r2 a,!
// cdb-check:a,! [Type: _enum<core::option::Option<_enum<msvc_pretty_enums::CStyleEnum>>, 2, 16, Some>]
// cdb-check: [+0x000] dataful_variant [Type: _enum<core::option::Option<_enum<msvc_pretty_enums::CStyleEnum>>, 2, 16, Some>::Some]
// cdb-check:a,! [Type: enum$<core::option::Option<enum$<msvc_pretty_enums::CStyleEnum>>, 2, 16, Some>]
// cdb-check: [+0x000] dataful_variant [Type: enum$<core::option::Option<enum$<msvc_pretty_enums::CStyleEnum>>, 2, 16, Some>::Some]
// cdb-check: [+0x000] __0 : Low (0x2) [Type: msvc_pretty_enums::CStyleEnum]
// cdb-check: [+0x000] discriminant$ [Type: _enum<core::option::Option<_enum<msvc_pretty_enums::CStyleEnum>>, 2, 16, Some>::discriminant$]
// cdb-check: [+0x000] discriminant : 0x2 [Type: _enum<core::option::Option<_enum<msvc_pretty_enums::CStyleEnum>>, 2, 16, Some>::tag$]
// cdb-check: [+0x000] discriminant$ [Type: enum$<core::option::Option<enum$<msvc_pretty_enums::CStyleEnum>>, 2, 16, Some>::discriminant$]
// cdb-check: [+0x000] discriminant : 0x2 [Type: enum$<core::option::Option<enum$<msvc_pretty_enums::CStyleEnum>>, 2, 16, Some>::tag$]
// cdb-command: dx -r2 b,!
// cdb-check:b,! [Type: _enum<core::option::Option<_enum<msvc_pretty_enums::CStyleEnum>>, 2, 16, Some>]
// cdb-check: [+0x000] dataful_variant [Type: _enum<core::option::Option<_enum<msvc_pretty_enums::CStyleEnum>>, 2, 16, Some>::Some]
// cdb-check:b,! [Type: enum$<core::option::Option<enum$<msvc_pretty_enums::CStyleEnum>>, 2, 16, Some>]
// cdb-check: [+0x000] dataful_variant [Type: enum$<core::option::Option<enum$<msvc_pretty_enums::CStyleEnum>>, 2, 16, Some>::Some]
// cdb-check: [+0x000] __0 : 0x11 [Type: msvc_pretty_enums::CStyleEnum]
// cdb-check: [+0x000] discriminant$ [Type: _enum<core::option::Option<_enum<msvc_pretty_enums::CStyleEnum>>, 2, 16, Some>::discriminant$]
// cdb-check: [+0x000] discriminant : None (0x11) [Type: _enum<core::option::Option<_enum<msvc_pretty_enums::CStyleEnum>>, 2, 16, Some>::tag$]
// cdb-check: [+0x000] discriminant$ [Type: enum$<core::option::Option<enum$<msvc_pretty_enums::CStyleEnum>>, 2, 16, Some>::discriminant$]
// cdb-check: [+0x000] discriminant : None (0x11) [Type: enum$<core::option::Option<enum$<msvc_pretty_enums::CStyleEnum>>, 2, 16, Some>::tag$]
// cdb-command: dx -r2 c,!
// cdb-check:c,! [Type: _enum<msvc_pretty_enums::NicheLayoutEnum, 2, 16, Data>]
// cdb-check: [+0x000] dataful_variant [Type: _enum<msvc_pretty_enums::NicheLayoutEnum, 2, 16, Data>::Data]
// cdb-check:c,! [Type: enum$<msvc_pretty_enums::NicheLayoutEnum, 2, 16, Data>]
// cdb-check: [+0x000] dataful_variant [Type: enum$<msvc_pretty_enums::NicheLayoutEnum, 2, 16, Data>::Data]
// cdb-check: [+0x000] my_data : 0x11 [Type: msvc_pretty_enums::CStyleEnum]
// cdb-check: [+0x000] discriminant$ [Type: _enum<msvc_pretty_enums::NicheLayoutEnum, 2, 16, Data>::discriminant$]
// cdb-check: [+0x000] discriminant : Tag1 (0x11) [Type: _enum<msvc_pretty_enums::NicheLayoutEnum, 2, 16, Data>::tag$]
// cdb-check: [+0x000] discriminant$ [Type: enum$<msvc_pretty_enums::NicheLayoutEnum, 2, 16, Data>::discriminant$]
// cdb-check: [+0x000] discriminant : Tag1 (0x11) [Type: enum$<msvc_pretty_enums::NicheLayoutEnum, 2, 16, Data>::tag$]
// cdb-command: dx -r2 d,!
// cdb-check:d,! [Type: _enum<msvc_pretty_enums::NicheLayoutEnum, 2, 16, Data>]
// cdb-check: [+0x000] dataful_variant [Type: _enum<msvc_pretty_enums::NicheLayoutEnum, 2, 16, Data>::Data]
// cdb-check:d,! [Type: enum$<msvc_pretty_enums::NicheLayoutEnum, 2, 16, Data>]
// cdb-check: [+0x000] dataful_variant [Type: enum$<msvc_pretty_enums::NicheLayoutEnum, 2, 16, Data>::Data]
// cdb-check: [+0x000] my_data : High (0x10) [Type: msvc_pretty_enums::CStyleEnum]
// cdb-check: [+0x000] discriminant$ [Type: _enum<msvc_pretty_enums::NicheLayoutEnum, 2, 16, Data>::discriminant$]
// cdb-check: [+0x000] discriminant : 0x10 [Type: _enum<msvc_pretty_enums::NicheLayoutEnum, 2, 16, Data>::tag$]
// cdb-check: [+0x000] discriminant$ [Type: enum$<msvc_pretty_enums::NicheLayoutEnum, 2, 16, Data>::discriminant$]
// cdb-check: [+0x000] discriminant : 0x10 [Type: enum$<msvc_pretty_enums::NicheLayoutEnum, 2, 16, Data>::tag$]
// cdb-command: dx -r2 e,!
// cdb-check:e,! [Type: _enum<msvc_pretty_enums::NicheLayoutEnum, 2, 16, Data>]
// cdb-check: [+0x000] dataful_variant [Type: _enum<msvc_pretty_enums::NicheLayoutEnum, 2, 16, Data>::Data]
// cdb-check:e,! [Type: enum$<msvc_pretty_enums::NicheLayoutEnum, 2, 16, Data>]
// cdb-check: [+0x000] dataful_variant [Type: enum$<msvc_pretty_enums::NicheLayoutEnum, 2, 16, Data>::Data]
// cdb-check: [+0x000] my_data : 0x13 [Type: msvc_pretty_enums::CStyleEnum]
// cdb-check: [+0x000] discriminant$ [Type: _enum<msvc_pretty_enums::NicheLayoutEnum, 2, 16, Data>::discriminant$]
// cdb-check: [+0x000] discriminant : Tag2 (0x13) [Type: _enum<msvc_pretty_enums::NicheLayoutEnum, 2, 16, Data>::tag$]
// cdb-check: [+0x000] discriminant$ [Type: enum$<msvc_pretty_enums::NicheLayoutEnum, 2, 16, Data>::discriminant$]
// cdb-check: [+0x000] discriminant : Tag2 (0x13) [Type: enum$<msvc_pretty_enums::NicheLayoutEnum, 2, 16, Data>::tag$]
// cdb-command: dx -r2 f,!
// cdb-check:f,! [Type: _enum<core::option::Option<u32*>, 1, [...], Some>]
// cdb-check: [+0x000] dataful_variant [Type: _enum<core::option::Option<u32*>, 1, [...], Some>::Some]
// cdb-check:f,! [Type: enum$<core::option::Option<u32*>, 1, [...], Some>]
// cdb-check: [+0x000] dataful_variant [Type: enum$<core::option::Option<u32*>, 1, [...], Some>::Some]
// cdb-check: [+0x000] __0 : 0x[...] : 0x1 [Type: unsigned int *]
// cdb-check: [+0x000] discriminant$ [Type: _enum<core::option::Option<u32*>, 1, [...], Some>::discriminant$]
// cdb-check: [+0x000] discriminant : 0x[...] [Type: _enum<core::option::Option<u32*>, 1, [...], Some>::tag$]
// cdb-check: [+0x000] discriminant$ [Type: enum$<core::option::Option<u32*>, 1, [...], Some>::discriminant$]
// cdb-check: [+0x000] discriminant : 0x[...] [Type: enum$<core::option::Option<u32*>, 1, [...], Some>::tag$]
// cdb-command: dx -r2 g,!
// cdb-check:g,! [Type: _enum<core::option::Option<u32*>, 1, [...], Some>]
// cdb-check: [+0x000] dataful_variant [Type: _enum<core::option::Option<u32*>, 1, [...], Some>::Some]
// cdb-check:g,! [Type: enum$<core::option::Option<u32*>, 1, [...], Some>]
// cdb-check: [+0x000] dataful_variant [Type: enum$<core::option::Option<u32*>, 1, [...], Some>::Some]
// cdb-check: [+0x000] __0 : 0x0 [Type: unsigned int *]
// cdb-check: [+0x000] discriminant$ [Type: _enum<core::option::Option<u32*>, 1, [...], Some>::discriminant$]
// cdb-check: [+0x000] discriminant : None (0x0) [Type: _enum<core::option::Option<u32*>, 1, [...], Some>::tag$]
// cdb-check: [+0x000] discriminant$ [Type: enum$<core::option::Option<u32*>, 1, [...], Some>::discriminant$]
// cdb-check: [+0x000] discriminant : None (0x0) [Type: enum$<core::option::Option<u32*>, 1, [...], Some>::tag$]
// cdb-command: dx h
// cdb-check:h : Some [Type: _enum<core::option::Option<u32>>]
// cdb-check:h : Some [Type: enum$<core::option::Option<u32>>]
// cdb-check: [+0x000] variant$ : Some (0x1) [Type: core::option::Option]
// cdb-check: [+0x004] __0 : 0xc [Type: unsigned int]
// cdb-command: dx i
// cdb-check:i : None [Type: _enum<core::option::Option<u32>>]
// cdb-check:i : None [Type: enum$<core::option::Option<u32>>]
// cdb-check: [+0x000] variant$ : None (0x0) [Type: core::option::Option]
// cdb-command: dx j
// cdb-check:j : High (0x10) [Type: msvc_pretty_enums::CStyleEnum]
// cdb-command: dx -r2 k,!
// cdb-check:k,! [Type: _enum<core::option::Option<alloc::string::String>, 1, [...], Some>]
// cdb-check: [+0x000] dataful_variant [Type: _enum<core::option::Option<alloc::string::String>, 1, [...], Some>::Some]
// cdb-check:k,! [Type: enum$<core::option::Option<alloc::string::String>, 1, [...], Some>]
// cdb-check: [+0x000] dataful_variant [Type: enum$<core::option::Option<alloc::string::String>, 1, [...], Some>::Some]
// cdb-check: [+0x000] __0 [Type: alloc::string::String]
// cdb-check: [+0x000] discriminant$ [Type: _enum<core::option::Option<alloc::string::String>, 1, [...], Some>::discriminant$]
// cdb-check: [+0x000] discriminant : 0x[...] [Type: _enum<core::option::Option<alloc::string::String>, 1, [...], Some>::tag$]
// cdb-check: [+0x000] discriminant$ [Type: enum$<core::option::Option<alloc::string::String>, 1, [...], Some>::discriminant$]
// cdb-check: [+0x000] discriminant : 0x[...] [Type: enum$<core::option::Option<alloc::string::String>, 1, [...], Some>::tag$]
pub enum CStyleEnum {
Low = 2,

View File

@ -112,11 +112,11 @@
// NOTE: OsString doesn't have a .natvis entry yet.
// cdb-command: dx some
// cdb-check:some : Some [Type: _enum<core::option::Option<i16>>]
// cdb-check:some : Some [Type: enum$<core::option::Option<i16>>]
// cdb-command: dx none
// cdb-check:none : None [Type: _enum<core::option::Option<i64>>]
// cdb-check:none : None [Type: enum$<core::option::Option<i64>>]
// cdb-command: dx some_string
// cdb-check:some_string [Type: _enum<core::option::Option<alloc::string::String>, 1, [...], Some>]
// cdb-check:some_string [Type: enum$<core::option::Option<alloc::string::String>, 1, [...], Some>]
#![allow(unused_variables)]
use std::ffi::OsString;