[cfe-dev] Invalid mangled names emitted for local types declared in Apple Block expressions used in non-static data member initializers
Richard Smith via cfe-dev
cfe-dev at lists.llvm.org
Wed Sep 6 14:50:18 PDT 2017
On 6 September 2017 at 14:16, Tom Honermann via cfe-dev <
cfe-dev at lists.llvm.org> wrote:
> Clang appears to be generating ill-formed mangled names for local types
> declared in Apple Block expressions used as non-static data member
> initializers:
>
> $ cat t.cpp
> template<typename T> void tf(T) {}
> struct S {
> void(^bp)() = ^{
> enum E {} e;
> tf(e);
> };
> };
> auto x = S{}.bp;
>
> $ clang++ --version
> clang version 4.0.0 (tags/RELEASE_400/final)
> Target: x86_64-unknown-linux-gnu
> Thread model: posix
> ...
>
> $ clang++ -c -std=c++11 -fblocks t.cpp
> $ nm t.o
> ...
> 0000000000000000 W _Z2tfIZ1S2bpMUb0_E1EEvT_
> ...
>
> The mangled name generated for the function template specialization
> instantiated for the local enum type 'E' uses a <pointer-to-member-type>
> production [1] (as signified by 'M'),
I believe you're mistaken. This is not a context in which a <type>
production can appear. That's a <data-member-prefix>:
http://itanium-cxx-abi.github.io/cxx-abi/abi.html#mangle.data-member-prefix
... which specifies a context of the default member initializer of S::bp.
The following construct (the Ub0_) is a vendor extension for naming a block
closure.
but only one of the two required
> dependent productions is present (<class type> via 'Ub0_', but not
> <member type>).
>
> If someone can confirm that this is not intentional (it could be since
> Apple Blocks aren't governed by the Itanium ABI), I'll file a new BZ for
> this.
>
This behavior looks correct to me, except that I'm surprised that this
block is numbered as Ub0_ instead of Ub_. Looks like we have an off-by-one
error here, introduced in r214699 while fixing a different off-by-one error.
John: should we restore the pre-r214699 ABI, or would you prefer that we
just accept the new mangling as our ABI now?
> Additionally, for unnamed local types, discriminators are not added to
> disambiguate such types. Bug 34511 [2] has been filed for that issue.
>
> Tom.
>
> [1]:
> http://itanium-cxx-abi.github.io/cxx-abi/abi.html#mangle.
> pointer-to-member-type
> [2]: https://bugs.llvm.org/show_bug.cgi?id=34511
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20170906/bd7c3beb/attachment.html>
More information about the cfe-dev
mailing list