[cfe-dev] Obtaining variable references in an expression

Eli Friedman eli.friedman at gmail.com
Fri Feb 17 11:37:03 PST 2012


On Fri, Feb 17, 2012 at 4:42 AM, abetts <abetts at doc.ic.ac.uk> wrote:
> What is the best way to obtain the variable references in an expression?
>
> For instance, from:
>
> x = y + 10 * z
>
> I want to obtain:
>
> x, y, z
>
> I realise this could be done through an AST visit, but I wondered if there
> is a way I could do it through the existing API?

I'd suggest a RecursiveASTVisitor.

-Eli



More information about the cfe-dev mailing list