How tor traverse an return expr?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

How tor traverse an return expr?

Roman Popov via cfe-dev
Hi everyone,

inside a FunctionDecl I have a return statement like e.g.

     return 1 + foo(p1,p2) * 2;

and I want to transform this into something like

/*1*/    temp = foo(p1,p2,p3);

/*2*/    return 1 + foo(p1,p2,p3) * 2;

How can I iterate over the return Expr to rewrite the call to foo?

The case /*2*/ is working fine with the use of a VisitCallExpr method.

The case /*1*/ is generated by using a rewriter and the rewriter does

not know about the /*2*/ transformation.

Thanks

Marcel



_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev