[PATCH] Mangling of member-expressions involving anonymous unions.

Richard Smith richard at metafoo.co.uk
Wed Nov 12 17:22:56 PST 2014


On Wed, Nov 12, 2014 at 5:14 PM, Richard Smith <richard at metafoo.co.uk>
wrote:

> On Wed, Oct 29, 2014 at 2:26 PM, Tomasz Miąsko <tomasz.miasko at gmail.com>
> wrote:
>
>> I have updated tests to include an anonymous union, an anonymous struct
>> and
>> combinations of those two. In addition, dependency on non-diagnosed
>> incomplete
>> type in member-expression has been removed.
>>
>> End condition is now made more explicit using IndirectFieldDecl, but this
>> requires additional check ensuring that we are in fact dealing with an
>> anonymous union / struct (so that we don't break non-anonymous case). Did
>> you
>> have something simpler in mind here?
>
>
> I was thinking of something like:
>
>   while (base is anonymous struct or union) {
>     base = cast<MemberExpr>(base->getBase());
>     isArrow = base->isArrow();
>   }
>
> ... but what you have here is fine
>

Actually, scratch that. It looks like your approach will break if you
change your testcase:

struct X {
  struct {
    int i;
  };
};

How about just

    if (!member)
      return mangleExpression(base);

?


> (especially since we don't have a nice way to write "is anonymous struct
> or union" for a type). Do you need someone to commit this for you?
>
> http://reviews.llvm.org/D5997
>>
>> Files:
>>   lib/AST/ItaniumMangle.cpp
>>   test/CodeGenCXX/mangle-exprs.cpp
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20141112/7ebcb4e9/attachment.html>


More information about the cfe-commits mailing list