[cfe-dev] Mangling & linkage of unnamed but instantiated nested classes
Jordan Rose
jordan_rose at apple.com
Wed Oct 31 14:14:46 PDT 2012
On Oct 31, 2012, at 13:53 , John McCall <rjmccall at apple.com> wrote:
> On Oct 31, 2012, at 12:37 PM, David Blaikie wrote:
>> GCC 4.7 mangles them as:
>>
>> _Z1fIN1SUt_EEiT_
>> _Z1fIN1SUt0_EEiT_
>> _Z1fIN1TUt_EEiT_
>> _Z1fIN1TUt0_EEiT_
>>
>> I don't think we have any class-specific unnamed nested type counter
>> that would implement that Ut_, Ut0_, ... mangling scheme, though I can
>> imagine where one might be added (I'm not very familiar with IRGen
>> though, so I'll certainly be happy to have any pointers about how that
>> could/should be implemented).
>
> Probably we would want to record and remember this in the AST.
>
> This schema is indeed the one blessed by the ABI.
> <unnamed-type-name> ::= Ut [ <nonnegative number> ] _
> But as the ABI also notes:
> The mangling of such unnamed types defined in namespace scope is generally unspecified because they do not have to match across translation units. An implementation must only ensure that naming collisions are avoided.
But David's original example does not have an unnamed type in namespace scope.
> struct foo {
> struct {
> void func() { ... } // warning that this is 'unused'
> } x;
> };
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20121031/443b9a8c/attachment.html>
More information about the cfe-dev
mailing list