A coroutine debuginfo node looks the same as a that of an enum type.
In CPP-like mode, we generate a union with a field for each variant and an
explicit tag field. The field of each variant has a struct type
that encodes the discriminant of the variant and itβs data layout.
The union also has a nested enumeration type that is only used for encoding
variant names in an efficient way. Its enumerator values do not correspond
to the enumβs discriminant values.
Itβs roughly equivalent to the following C/C++ code:
This is a helper function shared between enums and coroutines that makes sure fields have the
expect names.
This function builds a DW_AT_enumeration_type that contains an entry for
each variant. Note that this has nothing to do with the discriminant. The
numeric value of each enumerator corresponds to the variant index. The
type is only used for efficiently encoding the name of each variant in
debuginfo.