mrdocs icon indicating copy to clipboard operation
mrdocs copied to clipboard

Handle union-like classes

Open sdkrystian opened this issue 2 years ago • 2 comments

Consider the following:

struct S
{
    union
    {
        short x;
        long y;
    };
};

Currently, we produce the following output:

<namespace name="">
  <struct name="S" id="pOYGF6pLJlICuiGO0Xj0daDb/to=">
    <file path="input.cpp" line="20" class="def"/>
    <data name="" type="" id="oYkHFJ3A7o+2VVIq/RVlpFvwiWE="/>
    <union name="" id="oYkHFJ3A7o+2VVIq/RVlpFvwiWE=">
      <file path="input.cpp" line="22" class="def"/>
      <data name="x" type="short"/>
      <data name="y" type="long"/>
    </union>
  </struct>
</namespace>

The members x and y should be considered (variant) members of S.

sdkrystian avatar May 22 '23 15:05 sdkrystian

We might want to squelch the name="" since it is empty. @evanlenz what do you think?

vinniefalco avatar May 22 '23 16:05 vinniefalco

Within the DeclContext of S, x and y are IndirectFieldDecls

sdkrystian avatar May 23 '23 11:05 sdkrystian