11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, see http://www.gnu.org/copyleft/gpl.txt
16 */
17
18 /*
19 * This is for smatch_extra.c to use. It sort of like check_assigned_expr.c but
20 * more limited. Say a function returns "64min-s64max[$0->data]" and the caller
21 * does "struct whatever *p = get_data(dev);" then we want to record that p is
22 * now the same as "dev->data". Then if we update "p->foo" it means we can
23 * update "dev->data->foo" as well.
24 *
25 */
26
27 #include "smatch.h"
28 #include "smatch_slist.h"
29 #include "smatch_extra.h"
30
31 extern int check_assigned_expr_id;
32 static int my_id;
33 static int link_id;
34
35 static struct smatch_state *alloc_my_state(const char *name, struct symbol *sym)
36 {
37 struct smatch_state *state;
38
39 state = __alloc_smatch_state(0);
40 state->name = alloc_sname(name);
41 state->data = sym;
42 return state;
43 }
44
45 static void undef(struct sm_state *sm, struct expression *mod_expr)
46 {
47 if (__in_fake_parameter_assign)
48 return;
49 set_state(my_id, sm->name, sm->sym, &undefined);
50 }
51
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, see http://www.gnu.org/copyleft/gpl.txt
16 */
17
18 /*
19 * This is for smatch_extra.c to use. It sort of like check_assigned_expr.c but
20 * more limited. Say a function returns "64min-s64max[$0->data]" and the caller
21 * does "struct whatever *p = get_data(dev);" then we want to record that p is
22 * now the same as "dev->data". Then if we update "p->foo" it means we can
23 * update "dev->data->foo" as well.
24 *
25 */
26
27 #include "smatch.h"
28 #include "smatch_slist.h"
29 #include "smatch_extra.h"
30
31 static int my_id;
32 static int link_id;
33
34 static struct smatch_state *alloc_my_state(const char *name, struct symbol *sym)
35 {
36 struct smatch_state *state;
37
38 state = __alloc_smatch_state(0);
39 state->name = alloc_sname(name);
40 state->data = sym;
41 return state;
42 }
43
44 static void undef(struct sm_state *sm, struct expression *mod_expr)
45 {
46 if (__in_fake_parameter_assign)
47 return;
48 set_state(my_id, sm->name, sm->sym, &undefined);
49 }
50
|