[cxx-abi-dev] Name mangling for explicit overriders

Dennis Handly dhandly at cup.hp.com
Tue Jul 29 09:22:35 UTC 2003


>We recently implemented the Microsoft extension that allows explicit
>specification of overriding on derived class virtual functions.
>	struct D: B1, B2 {
>	  virtual void B1::f() {}  // Overrides B1::f (only)
>	  virtual void B2::f() {}  // Overrides B2::f (only)
>	};

>This has a name mangling implication: as shown in the above example,
>you can end up with two member functions in a given class that have
>the same name and signature, and differ only in the function that
>they override.

You can't just add mangling to the ABI, you'll also need to explain
how the vtables (and which) are changed.

>We added a rule for <encoding>:
>  <encoding> ::= <function name> O <nested-name> <bare-function-type>

>We also considered naming only the overridden class, not the function, but
>decided that other explicit-override extensions might allow overriding of
>differently-named functions, and therefore generality should be chosen over
>brevity.
>Any comments?
Steve Adamczyk

And you can't substitute for f, since only D and D::f are known.

>From: Christophe de Dinechin <ddd at cup.hp.com>
>Also, making the "extension tag" a prefix of the whole symbol means 
>that you can't demangle anything.
>the EDG approach and reserving "O" for extensions? So you'd have 
>something like Ov3EDG <length> <vendor-specific>, so that any demangler 
>could show something like "D::f [with an EDG-specific extension]", and 
>the EDG demangler would show "D::f [overriding B2::f]" as proposed.

Right.  Except there is no connection with reserving "O" for extensions.

>I also really appreciate that EDG tries to make sure that even their 
>proprietary extensions are known to the rest of the ABI users. I 
>recommend that we keep track of such extensions in the document when 
>vendors are kind enough to share them. What about an appendix to the ABI?
Christophe

Would this be where the implementation info I asked for belong?

>From: Daveed Vandevoorde <daveed at vandevoorde.com>
>Note that this is in fact not an "EDG extension": It is a
>Microsoft extension implemented in the EDG compiler.

So you're blaming it on Bill?  ;-)
So the correct mangling is: _Zv3M$$

>Also, this extension is going to be proposed to the evolution
>working group for inclusion in the next standard (including
>the ability to rename the overrider).
         Daveed

OK, so the original idea is better.

>From: Daveed Vandevoorde <daveed at edg.com>
>I believe Bjarne is in favor of the proposal
>The issues are mostly syntactic.

So the semantics of what to do in the vtables is well defined?

How do you call each directly?
   D::B1::f() or D::B2::f()

>From: Mark Mitchell <mark at codesourcery.com>
>I guess it makes sense to standardize it.  Does anyone object?

No.  Will Daveed document more than just the mangling part?



More information about the cxx-abi-dev mailing list