[cxx-abi-dev] Mangling of anonymous unions?

J. Stephen Adamczyk jsa at edg.com
Thu Dec 19 13:43:27 UTC 2002


Mark Mitchell writes:
> I think that the first name found in a pre-order, depth-first,
> declaration-order walk is a reasonable choice.

I agree.  We already do exactly that in our other (non-IA-64)
name mangling scheme.  One reason we did so is repeatability:
when we did exported templates, we discovered that "unique"
names generated no longer had to be merely unique -- they
now also had to be repeatable.  Things like static functions
and unnamed namespaces have to be externalized in some cases
so that instantiations of the same template in different
compilations can reference the same externalized copy.
And likewise members of anonymous unions.

We used to use a sort of discriminator-like scheme, but it
failed for entities declared in namespaces, because they're
not required to be in the same order in each compilation,
and therefore the discriminator values (assigned in order
of source declaration) were not appropriately consistent.
Using the name of the first member avoids that problem.

Steve Adamczyk
Edison Design Group



More information about the cxx-abi-dev mailing list