On Mon, 12 Nov 2018, 藤本太希 wrote:

>
> Nice to meet you. 
>
> I am a student of Kochi University of Technology in Japan.
>
> I am contacting you to enquire about Coccinelle.
>
> Please excuse me if you may not understand or you feel bad with my poor
> English.
>
>
> I am doing pattern matching using Coccinelle.
>
> That time, I want to check that a particular process is within the scope of
> variable. How can I express the scope of variable in the SmPL language?

Coccinelle rather focuses on the case where variables are all defined at
the top of a function.  But the following will probably do:

@@
statement S;
type T;
identifier i;
@@

{
... when != S
T i;  // the variable you are interested in
<...
P     // the pattern you are interested in in the scope of i
...>
}

This searches for pattern P occurring 0 or more times in the scope of i.
To propose something more precise of efficient, you can give some more
information about what you want to do.

julia
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci

Reply via email to