local names

Alex Samuel samuel at codesourcery.com
Fri Sep 1 03:18:43 UTC 2000


Jeffrey, Jim,

I apologize for not being able to attend or call in today.

I understand there was some confusion regarding the local namd issue.
Let me see if I can clarify:

Suppose you want to mangle the type of D in

    void foo () {
      class C {
        class D {};
      };
    }

As I understand it, you go through <class-enum-type> ::= <local-name>,
since D is (indirectly) contained in a function scope.  This gives you

    Z <function encoding> E <entity name>

The <function encoding> for foo () is `3foov'.  Now, since D not in
file scope, you use the production

    <name> ::= <nested-name> ::=
           ::= N <prefix> <component> E
           ...
           ::= N <component> <component> <component> E

The innermost <component> is `1D', the next is `1C', and the outermost
one is a <local-name> for foo, I think.  This is clearly not
necessary, since the we've already encoded foo up front.  

So, I think when we encode the <entity name> in the topmost
<local-name> production, we should encode only up to, but not
including, the innermost function scope, as if C::D was in file scope.
There's no need for the <component> ::= <local-name> production.  This
would yeild the mangling `Z3foovEN1C1DE'.

Am I making any sense?

Regards
Alex




More information about the cxx-abi-dev mailing list