modification_hooks: rely on the database more when it's available
[smatch.git] / smatch_slist.h
blobf7fa231dcacb51d93fefa3fa6040fc5363dc4bb0
1 DECLARE_PTR_LIST(state_list, struct sm_state);
2 DECLARE_PTR_LIST(state_list_stack, struct state_list);
3 struct named_slist {
4 char *name;
5 struct state_list *slist;
6 };
7 DECLARE_ALLOCATOR(named_slist);
8 DECLARE_PTR_LIST(named_stack, struct named_slist);
10 extern struct state_list_stack *implied_pools;
11 extern int __slist_id;
13 char *show_sm(struct sm_state *sm);
14 void __print_slist(struct state_list *slist);
15 void add_history(struct sm_state *sm);
16 int cmp_tracker(const struct sm_state *a, const struct sm_state *b);
17 char *alloc_sname(const char *str);
19 void free_every_single_sm_state(void);
20 struct sm_state *clone_sm(struct sm_state *s);
21 int is_merged(struct sm_state *sm);
22 int is_implied(struct sm_state *sm);
23 struct state_list *clone_slist(struct state_list *from_slist);
24 struct state_list_stack *clone_stack(struct state_list_stack *from_stack);
26 int slist_has_state(struct state_list *slist, struct smatch_state *state);
27 struct smatch_state *merge_states(int owner, const char *name,
28 struct symbol *sym,
29 struct smatch_state *state1,
30 struct smatch_state *state2);
32 int too_many_possible(struct sm_state *sm);
33 struct sm_state *merge_sm_states(struct sm_state *one, struct sm_state *two);
34 struct smatch_state *get_state_slist(struct state_list *slist, int owner, const char *name,
35 struct symbol *sym);
37 struct sm_state *get_sm_state_slist(struct state_list *slist, int owner, const char *name,
38 struct symbol *sym);
40 void overwrite_sm_state(struct state_list **slist, struct sm_state *sm);
41 void overwrite_sm_state_stack(struct state_list_stack **stack, struct sm_state *sm);
42 struct sm_state *set_state_slist(struct state_list **slist, int owner, const char *name,
43 struct symbol *sym, struct smatch_state *state);
45 void delete_state_slist(struct state_list **slist, int owner, const char *name,
46 struct symbol *sym);
48 void delete_state_stack(struct state_list_stack **stack, int owner, const char *name,
49 struct symbol *sym);
50 void push_slist(struct state_list_stack **list_stack, struct state_list *slist);
52 struct state_list *pop_slist(struct state_list_stack **list_stack);
54 void free_slist(struct state_list **slist);
55 void free_stack(struct state_list_stack **stack);
56 void free_stack_and_slists(struct state_list_stack **slist_stack);
58 struct sm_state *set_state_stack(struct state_list_stack **stack, int owner, const char *name,
59 struct symbol *sym, struct smatch_state *state);
61 struct smatch_state *get_state_stack(struct state_list_stack *stack, int owner,
62 const char *name, struct symbol *sym);
64 int out_of_memory(void);
65 int low_on_memory(void);
66 void merge_slist(struct state_list **to, struct state_list *slist);
67 void filter_slist(struct state_list **slist, struct state_list *filter);
68 void and_slist_stack(struct state_list_stack **slist_stack);
70 void or_slist_stack(struct state_list_stack **pre_conds,
71 struct state_list *cur_slist,
72 struct state_list_stack **slist_stack);
74 struct state_list **get_slist_from_named_stack(struct named_stack *stack,
75 const char *name);
77 void overwrite_slist(struct state_list *from, struct state_list **to);
79 /* add stuff smatch_returns.c here */
81 void all_return_states_hook(void (*callback)(struct state_list *slist));
82 int get_slist_id(struct state_list *slist);