[cxx-abi-dev] mangling for c++17 decomposition declarations
Richard Smith
richardsmith at google.com
Mon Aug 15 17:59:49 UTC 2016
On 15 August 2016 at 09:00, Tom Honermann <Thomas.Honermann at synopsys.com>
wrote:
> On 8/12/2016 8:00 PM, Richard Smith wrote:
> > C++17 decomposition declarations are (surprisingly) permitted at global
> > scope. They can't be forward-declared nor made inline (yet...), and it
> > seems likely that the wording probably didn't *mean* to allow them to be
> > declared as templates, so we don't appear to need a cross-vendor
> > mangling for them. However, establishing a convention would be useful
> > for demanglers.
> >
> > For now, I'm mangling global decomposition declarations as:
> >
> > <unqualified-name> ::= DC <source-name>* E
> >
> > ... where the <source-name>s are the names of the bindings. (I'm
> > mangling the bindings in the obvious way, as if they were reference
> > declarations, but they get a mangled name even at global scope.)
> >
> > We could get away with mangling only the name of the first binding, but
> > the extra information seems useful to people looking at the mangled name.
> >
> > Thoughts? Is it worth specifying this in the ABI?
>
> Is it permissible for the decomposition declaration to be declared
> static?
Not currently (but there will be an NB comment on that).
As in:
>
> struct S { int x; };
> inline void f(S s) {
> static auto [x] = s;
> }
>
> If so, then I would expect cross-vendor mangling to be necessary to
> ensure only one instance of the unnamed object is present. This object
> would presumably need to acquire a name for linkage purposes, yes? If
> so, then the name of the first binding seems a reasonable choice.
You would prefer to mangle using only the name of the first binding? I'm OK
with that (I only have a slight preference for using all of the names as a
convenience to people looking at demanglings).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sourcerytools.com/pipermail/cxx-abi-dev/attachments/20160815/796e1cc0/attachment.html>
More information about the cxx-abi-dev
mailing list