[cfe-dev] Iterating through an Expression in the Clang AST

Robert Ankeney rrankene at gmail.com
Sun Feb 10 08:38:39 PST 2013

You can use if (isa<BinaryOperator>(stmt))  and if true, recast it as
BinaryOperator.  Have a look at the tutorials at:

The CIrewriter.cpp example gives numerous examples of using visitors like
VisitBinaryOperator, handy if you use a recursive AST visitor to walk the


Date: Sat, 9 Feb 2013 19:48:47 -0800 (PST)
> From: beni <sonaldanak at gmail.com>
> To: cfe-dev at cs.uiuc.edu
> Subject: Re: [cfe-dev] Iterating through an Expression in the Clang
>         AST
> Message-ID: <1360468127775-4030391.post at n3.nabble.com>
> Content-Type: text/plain; charset=us-ascii
> thanks! i used the iterators to iterate through a stmt but how do i check
> what type the sub statement contains? eg. how do i find out if the sub
> statement is say, a binary operator?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130210/1e245783/attachment.html>

More information about the cfe-dev mailing list