Re: transforming expressions

> The problem I am encountering is how to replace the input expression
> (e1) with the output expression.  The input expression will be an
> SgExpression and the output expression should be an SgFunctionCallExp.
> Is there an easy way to change the expression or do I need to resort
> to the lower level C interface to do something which the C++ interface
> does not seem to provide?

I don't think so.

I would suggest constructing a completely new expression from the old
one and use that. For instance:

SgSymbol *operator_plus_symbol

SgExpression *lhs = plus_op->lhs();
SgExpression *rhs = plus_op->rhs();

SgExprListExp *first_param = new SgExprListExp (*lhs);
SgExprListExp *second_param = new SgExprListExp (*rhs);

func_call = new SgFunctionCall (*operator_plus_symbol, *first_param);

return (isSgFunctionCallExp (func_call));

If your problem is how to replace the expression in context, then you
are in a little bit of difficulty b/c SgExpressions do not have "up"
pointers. I have written a class to descend an expression tree and
keep track of "up" pointers so that it is easy to replace things. If
you are interested, email me. This is pretty easy to do on your own
anyway, if you so desire.