SF Markus Elfring
2018-07-08 07:42:09 UTC
Hello,
I would like to clarify another combination of functionality from the semantic
patch language.
The following small SmPL script can be constructed to find some function calls.
@rtg@
identifier F, G;
@@
F(..., 9);
*G(1, ...);
@rth@
identifier F, H;
@@
F(..., 9);
*H(2, ...);
The important detail is here that both SmPL rules specify to search for
the same function calls before other source code should be found.
This common SmPL code could be moved into another SmPL rule.
@rpx@
identifier F;
position P;
@@
F(..., 9);@P
@rpg@
identifier rpx.F, G;
position rpx.P;
@@
F(..., 9);@P
*G(1, ...);
@rph@
identifier rpx.F, H;
position rpx.P;
@@
F(..., 9);@P
*H(2, ...);
I became curious to know if the shown inherited information could be used also
without repeating SmPL code for a precondition.
Can the search be continued directly behind the determined source code position?
Regards,
Markus
I would like to clarify another combination of functionality from the semantic
patch language.
The following small SmPL script can be constructed to find some function calls.
@rtg@
identifier F, G;
@@
F(..., 9);
*G(1, ...);
@rth@
identifier F, H;
@@
F(..., 9);
*H(2, ...);
The important detail is here that both SmPL rules specify to search for
the same function calls before other source code should be found.
This common SmPL code could be moved into another SmPL rule.
@rpx@
identifier F;
position P;
@@
F(..., 9);@P
@rpg@
identifier rpx.F, G;
position rpx.P;
@@
F(..., 9);@P
*G(1, ...);
@rph@
identifier rpx.F, H;
position rpx.P;
@@
F(..., 9);@P
*H(2, ...);
I became curious to know if the shown inherited information could be used also
without repeating SmPL code for a precondition.
Can the search be continued directly behind the determined source code position?
Regards,
Markus