locking: update to use stree
[smatch.git] / smatch_slist.h
blob15b038053163d863ab02d9f98ad2323667bed2f7
1 struct AVL;
3 DECLARE_PTR_LIST(state_list, struct sm_state);
4 DECLARE_PTR_LIST(state_list_stack, struct state_list);
5 DECLARE_PTR_LIST(stree_stack, struct AVL);
7 struct named_slist {
8 char *name;
9 struct state_list *slist;
11 DECLARE_ALLOCATOR(named_slist);
12 DECLARE_PTR_LIST(named_stack, struct named_slist);
14 struct named_stree {
15 char *name;
16 struct AVL *stree;
18 DECLARE_ALLOCATOR(named_stree);
19 DECLARE_PTR_LIST(named_stree_stack, struct named_stree);
22 extern struct state_list_stack *implied_pools;
23 extern int __slist_id;
25 char *show_sm(struct sm_state *sm);
26 void __print_slist(struct state_list *slist);
27 void __print_stree(struct AVL *stree);
28 void add_history(struct sm_state *sm);
29 int cmp_tracker(const struct sm_state *a, const struct sm_state *b);
30 char *alloc_sname(const char *str);
32 void free_every_single_sm_state(void);
33 struct sm_state *clone_sm(struct sm_state *s);
34 int is_merged(struct sm_state *sm);
35 int is_implied(struct sm_state *sm);
36 struct state_list *clone_slist(struct state_list *from_slist);
37 struct state_list_stack *clone_stack(struct state_list_stack *from_stack);
39 int slist_has_state(struct state_list *slist, struct smatch_state *state);
40 struct smatch_state *merge_states(int owner, const char *name,
41 struct symbol *sym,
42 struct smatch_state *state1,
43 struct smatch_state *state2);
45 int too_many_possible(struct sm_state *sm);
46 struct sm_state *merge_sm_states(struct sm_state *one, struct sm_state *two);
47 struct smatch_state *get_state_slist(struct state_list *slist, int owner, const char *name,
48 struct symbol *sym);
49 struct smatch_state *get_state_stree(struct AVL *stree, int owner, const char *name,
50 struct symbol *sym);
52 struct sm_state *get_sm_state_slist(struct state_list *slist, int owner, const char *name,
53 struct symbol *sym);
54 struct sm_state *get_sm_state_stree(struct AVL *stree, int owner, const char *name,
55 struct symbol *sym);
57 void overwrite_sm_state(struct state_list **slist, struct sm_state *sm);
58 void overwrite_sm_state_stree(struct AVL **stree, struct sm_state *sm);
59 void overwrite_sm_state_stack(struct state_list_stack **stack, struct sm_state *sm);
60 void overwrite_sm_state_stree_stack(struct stree_stack **stack, struct sm_state *sm);
61 struct sm_state *set_state_slist(struct state_list **slist, int owner, const char *name,
62 struct symbol *sym, struct smatch_state *state);
63 struct sm_state *set_state_stree(struct AVL **stree, int owner, const char *name,
64 struct symbol *sym, struct smatch_state *state);
66 void delete_state_slist(struct state_list **slist, int owner, const char *name,
67 struct symbol *sym);
68 void delete_state_stree(struct AVL **stree, int owner, const char *name,
69 struct symbol *sym);
71 void delete_state_stack(struct state_list_stack **stack, int owner, const char *name,
72 struct symbol *sym);
73 void delete_state_stree_stack(struct stree_stack **stack, int owner, const char *name,
74 struct symbol *sym);
76 void push_slist(struct state_list_stack **list_stack, struct state_list *slist);
77 void push_stree(struct stree_stack **list_stack, struct AVL *stree);
79 struct state_list *pop_slist(struct state_list_stack **list_stack);
80 struct AVL *pop_stree(struct stree_stack **list_stack);
82 void free_slist(struct state_list **slist);
83 void free_stree(struct AVL **stree);
84 void free_stack(struct state_list_stack **stack);
85 void free_stree_stack(struct stree_stack **stack);
86 void free_stack_and_slists(struct state_list_stack **slist_stack);
87 void free_stack_and_strees(struct stree_stack **stree_stack);
89 struct sm_state *set_state_stack(struct state_list_stack **stack, int owner, const char *name,
90 struct symbol *sym, struct smatch_state *state);
91 struct sm_state *set_state_stree_stack(struct stree_stack **stack, int owner, const char *name,
92 struct symbol *sym, struct smatch_state *state);
94 struct smatch_state *get_state_stack(struct state_list_stack *stack, int owner,
95 const char *name, struct symbol *sym);
96 struct smatch_state *get_state_stree_stack(struct stree_stack *stack, int owner,
97 const char *name, struct symbol *sym);
99 int out_of_memory(void);
100 int low_on_memory(void);
101 void merge_slist(struct state_list **to, struct state_list *slist);
102 void merge_stree(struct AVL **to, struct AVL *stree);
103 void filter_slist(struct state_list **slist, struct state_list *filter);
104 void filter_stree(struct AVL **stree, struct AVL *filter);
105 void and_slist_stack(struct state_list_stack **slist_stack);
106 void and_stree_stack(struct stree_stack **stree_stack);
108 void or_slist_stack(struct state_list_stack **pre_conds,
109 struct state_list *cur_slist,
110 struct state_list_stack **slist_stack);
111 void or_stree_stack(struct stree_stack **pre_conds,
112 struct AVL *cur_stree,
113 struct stree_stack **stack);
115 struct state_list **get_slist_from_named_stack(struct named_stack *stack,
116 const char *name);
118 struct AVL **get_named_stree(struct named_stree_stack *stack,
119 const char *name);
121 void overwrite_slist(struct state_list *from, struct state_list **to);
122 void overwrite_stree(struct AVL *from, struct AVL **to);
124 /* add stuff smatch_returns.c here */
126 void all_return_states_hook(void (*callback)(struct state_list *slist));
127 void all_return_states_hook_stree(void (*callback)(struct AVL *slist));
129 int get_slist_id(struct state_list *slist);
130 int get_stree_id(struct AVL *slist);
132 struct state_list *stree_to_slist(struct AVL *stree);
133 struct AVL *slist_to_stree(struct state_list *stree);