blob: 9afb3edd97fb447d10fd79be8766c3745f40fe04 [file] [log] [blame]
Paolo Bonzini22fb6eb2020-10-07 12:23:56 -04001// Highlight object declarations that don't look like object class but
2// accidentally inherit from it.
3
4@match@
5identifier obj_t, fld;
6type parent_t =~ ".*Class$";
7@@
8struct obj_t {
9 parent_t fld;
10 ...
11};
12
13@script:python filter depends on match@
14obj_t << match.obj_t;
15@@
16is_class_obj = obj_t.endswith('Class')
17cocci.include_match(not is_class_obj)
18
19@replacement depends on filter@
20identifier match.obj_t, match.fld;
21type match.parent_t;
22@@
23struct obj_t {
24* parent_t fld;
25 ...
26};