Discussion:
[Cocci] About using Coccinelle
藤本太希
2018-11-11 21:33:19 UTC
Permalink
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?
Julia Lawall
2018-11-11 21:41:16 UTC
Permalink
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

Loading...