[cfe-dev] check an AST node's parent node ?

Kim Gräsman kim.grasman at gmail.com
Mon Jan 7 23:49:49 PST 2013


On Tue, Jan 8, 2013 at 8:42 AM, Philip Craig <philipjcraig at gmail.com> wrote:
>
>> It doesn't look like the comma in the for statement declaration is
>> represented in the AST, but maybe you can trigger on the fact that
>> there are multiple VarDecls under the DeclStmt?
>
> Commas in declarations aren't the same as comma operators in
> expressions. If you declare x and y outside of the for statement, then
> you will see the comma in the AST.

I see.

I think that solves it nicely for kevinlynx, because it looks like he
wants to ban the comma operator for everything that isn't a
declaration, except when the parent is a ForStmt.

- Kim



More information about the cfe-dev mailing list