[cfe-dev] Dissect and rewrite of function calls in expressions

Marcel Schaible via cfe-dev cfe-dev at lists.llvm.org
Mon Aug 7 11:15:09 PDT 2017


Hi everyone,

I need some advice for the following intended transformation:

int foo(int p) { return 2*p; }

int bar (void) {

     int var = 42 + foo(foo(42)); /*1*/

     return var;

}

I want to check the return value from foo:

int bar (void) {

     int temp1 = foo(42);

     int temp2 foo(temp1);

     // perform some checks on temp1 and temp2

     int var = 42 + temp2;

     return var;

}

How should I dissect and translate the expr /*1*/ with a Rewriter?

Thanks for your help

Marcel

(Greetings from the Black Forest in Germany ;- ) )




More information about the cfe-dev mailing list