[cfe-dev] condition expression for while loops - not printing using
rks
rks at cse.iitb.ac.in
Mon Mar 18 07:00:03 PDT 2013
Any pointers? on why it doesn't print condition for the code given
below.
- Rajendra
On 2013-03-15 20:44, rks wrote:
> Hi,
>
> We are trying to dump condition expression for while loop using clang
> Visit methods.
>
> It works fine for normal while loops. It doesn't work and crashes
> with stack dump for following code:
>
> int main(void)
> {
> int a ;
>
> {
> {
> while (1) {
> while_continue: ;
> if (! a) {
> goto while_break;
> }
> if (a > 20) {
> a ++;
> goto while_break;
> } else {
> goto while_break;
> }
> }
> while_break: ;
> }
> return (0);
> }
> }
>
> I am unable to figure out why it doesn't print condition.
>
> I am using this code:
>
> WhileStmt* While = cast<WhileStmt>(stmt);
> const Expr* cond = While->getCond();
>
> where stmt is pointer to clang::Stmt object.
>
> We are getting clang::CFGStmt object by iterating over statements in
> basic block using CFG Block iterators.
>
> - Rajendra
More information about the cfe-dev
mailing list