Hi, Have you already tried the following semantic patch ? Which problem you have with it ?
-------------------------------- @@ expression x,y; @@ -foo(x,y) +bar(x,y,z) ... foo(x,y) -------------------------------- Do you always have two calls to foo or could you have more/less of them ? Is the comment relevant for matching ? Regards. On Mon, Jun 27, 2011 at 4:21 PM, Ajay Panyala <[email protected]> wrote: > Hello > Is something like the following possible. > > Original code : > ... > // some comment > foo(x,y); > ..... > foo(x,y) > The code should be transformed after applying a patch > such that only the occurrence of foo(...) with the comment > above it should be transformed, i.e > The code after the transformation should look like > ... > // some comment > bar(x,y,z) > ... > foo(x,y) > The second call to foo(..) should remain untouched. > > If possible, how should a patch be specified to handle this case. > Thanks > Ajay > _______________________________________________ > Cocci mailing list > [email protected] > http://lists.diku.dk/mailman/listinfo/cocci > (Web access from inside DIKUs LAN only) > > -- Nicolas Palix http://sardes.inrialpes.fr/~npalix/ _______________________________________________ Cocci mailing list [email protected] http://lists.diku.dk/mailman/listinfo/cocci (Web access from inside DIKUs LAN only)
