Commit | Line | Data |
---|---|---|
34e49164 C |
1 | // The first two rules only work when there is only one reference. |
2 | ||
3 | @@ | |
4 | expression *x; | |
5 | type T; | |
6 | expression e; | |
7 | expression f; | |
8 | @@ | |
9 | if(x == NULL) { | |
10 | ... when != x = e | |
11 | ( | |
12 | return x; | |
13 | | | |
14 | ... | |
15 | ( | |
16 | *x | |
17 | | | |
18 | *((T)x) | |
19 | | | |
20 | f(...,x,...) | |
21 | | | |
22 | f(...,(T)x,...) | |
23 | ) | |
24 | ... | |
25 | ) | |
26 | ... | |
27 | } | |
28 | ||
29 | @@ | |
30 | expression *x; | |
31 | type T; | |
32 | expression e; | |
33 | expression f; | |
34 | statement S; | |
35 | @@ | |
36 | if(x != NULL) S else { | |
37 | ... when != x = e | |
38 | ( | |
39 | return x; | |
40 | | | |
41 | ... | |
42 | ( | |
43 | *x | |
44 | | | |
45 | *((T)x) | |
46 | | | |
47 | f(...,x,...) | |
48 | | | |
49 | f(...,(T)x,...) | |
50 | ) | |
51 | ... | |
52 | ) | |
53 | ... | |
54 | } | |
55 | ||
56 | @@ | |
57 | expression *x; | |
58 | type T1, T2, T3; | |
59 | expression e; | |
60 | expression f; | |
61 | statement S; | |
62 | @@ | |
63 | x = (T1) kmalloc(...); | |
64 | ... when != \( if(x == NULL) { ... return ...; } \| if(x == NULL) S else { ... return ...; } \| x = e; \) | |
65 | ( | |
66 | return x; | |
67 | | | |
68 | ... | |
69 | ( | |
70 | *x | |
71 | | | |
72 | *((T2)x) | |
73 | | | |
74 | f(...,x,...) | |
75 | | | |
76 | f(...,(T3)x,...) | |
77 | ) | |
78 | ... | |
79 | ) |