Sometimes is it useful to match a function parameter in an unknown position and then match the arguments at call sites that correspond to that parameter. The following semantic patch illustrates how to do this:
@r@
identifier fn, x;
parameter list[n] P;
@@
fn(P, long x,...) { ... }
@@
identifier r.fn;
expression list[r.n] E;
@@
fn(E,
- atoi
+ atol
(...),...)
It is of course possible to go the other way, and match first an argument and then the parameter in the corresponding position, or any other combination.