[cfe-dev] Visiting anonymous unions

Philip Craig philipjcraig at gmail.com
Fri Aug 17 17:15:58 PDT 2012


On Sat, Aug 18, 2012 at 5:52 AM, John McCall <rjmccall at apple.com> wrote:
> On Aug 17, 2012, at 6:23 AM, Sergejs Belajevs wrote:
>> I am writing a source-to-source transformation tool and I need a way
>> to check if function contains at least one anonymous union inside.
>
> You should see a DeclStmt that declares a single VarDecl whose type
> is a RecordType whose RecordDecl has the isAnonymousStructOrUnion()
> bit set.

The VarDecl is flagged as implicit, so to see it in the visitor you
need to override shouldVisitImplicitCode() to return true.



More information about the cfe-dev mailing list