<p dir="ltr"><br>
On Feb 10, 2013 8:40 AM, "Robert Ankeney" <<a href="mailto:rrankene@gmail.com">rrankene@gmail.com</a>> wrote:<br>
><br>
> You can use if (isa<BinaryOperator>(stmt))  and if true, recast it as BinaryOperator.</p>
<p dir="ltr">Just as a aide note, we usually write that with a single dyn_cast rather than isa+cast, to use just one check instead of two.</p>
<p dir="ltr">>  Have a look at the tutorials at:<br>
> <a href="https://github.com/loarabia/Clang-tutorial">https://github.com/loarabia/Clang-tutorial</a><br>
><br>
> The CIrewriter.cpp example gives numerous examples of using visitors like VisitBinaryOperator, handy if you use a recursive AST visitor to walk the tree.<br>
><br>
> Robert<br>
><br>
>> Date: Sat, 9 Feb 2013 19:48:47 -0800 (PST)<br>
>> From: beni <<a href="mailto:sonaldanak@gmail.com">sonaldanak@gmail.com</a>><br>
>> To: <a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
>> Subject: Re: [cfe-dev] Iterating through an Expression in the Clang<br>
>>         AST<br>
>> Message-ID: <<a href="mailto:1360468127775-4030391.post@n3.nabble.com">1360468127775-4030391.post@n3.nabble.com</a>><br>
>> Content-Type: text/plain; charset=us-ascii<br>
>><br>
>><br>
>> thanks! i used the iterators to iterate through a stmt but how do i check<br>
>> what type the sub statement contains? eg. how do i find out if the sub<br>
>> statement is say, a binary operator?<br>
>><br>
>  <br>
><br>
> _______________________________________________<br>
> cfe-dev mailing list<br>
> <a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
><br>
</p>