Handle declarations inside switch statement blocks.
[smatch.git] / smatch_slist.h
blob995d718f4cd97e7d9aaaf9efda0a98506090cae1
1 struct state_history {
2 unsigned int loc;
3 };
4 DECLARE_PTR_LIST(history_list, struct state_history);
6 struct sm_state {
7 char *name;
8 unsigned int owner;
9 struct symbol *sym;
10 struct smatch_state *state;
11 struct history_list *line_history;
12 struct state_list_stack *pools;
13 struct state_list *possible;
16 DECLARE_ALLOCATOR(sm_state);
17 DECLARE_PTR_LIST(state_list, struct sm_state);
18 DECLARE_PTR_LIST(state_list_stack, struct state_list);
19 struct named_slist {
20 char *name;
21 struct state_list *slist;
23 DECLARE_ALLOCATOR(named_slist);
24 DECLARE_PTR_LIST(named_stack, struct named_slist);
26 extern struct state_list_stack *implied_pools;
28 void __print_slist(struct state_list *slist);
29 void add_history(struct sm_state *state);
30 struct sm_state *alloc_state(const char *name, int owner,
31 struct symbol *sym,
32 struct smatch_state *state);
34 struct sm_state *clone_state(struct sm_state *s);
35 struct state_list *clone_slist(struct state_list *from_slist);
36 struct state_list_stack *clone_stack(struct state_list_stack *from_stack);
38 int slist_has_state(struct state_list *slist, struct smatch_state *state);
39 struct smatch_state *merge_states(const char *name, int owner,
40 struct symbol *sym,
41 struct smatch_state *state1,
42 struct smatch_state *state2);
44 struct smatch_state *get_state_slist(struct state_list *slist, const char *name, int owner,
45 struct symbol *sym);
47 struct sm_state *get_sm_state_slist(struct state_list *slist, const char *name, int owner,
48 struct symbol *sym);
50 void set_state_slist(struct state_list **slist, const char *name, int owner,
51 struct symbol *sym, struct smatch_state *state);
53 void merge_state_slist(struct state_list **slist, const char *name, int owner,
54 struct symbol *sym, struct smatch_state *state);
56 void delete_state_slist(struct state_list **slist, const char *name, int owner,
57 struct symbol *sym);
59 struct smatch_state *get_state_slist(struct state_list *slist, const char *name, int owner,
60 struct symbol *sym);
62 void push_slist(struct state_list_stack **list_stack, struct state_list *slist);
64 struct state_list *pop_slist(struct state_list_stack **list_stack);
66 void del_slist(struct state_list **slist);
68 void del_slist_stack(struct state_list_stack **slist_stack);
70 void set_state_stack(struct state_list_stack **stack, const char *name,
71 int owner, struct symbol *sym, struct smatch_state *state);
73 struct smatch_state *get_state_stack(struct state_list_stack *stack, const char *name,
74 int owner, struct symbol *sym);
76 void merge_slist(struct state_list **to, struct state_list *slist);
77 struct state_list *clone_states_in_pool(struct state_list *pool,
78 struct state_list *cur_slist);
79 void filter(struct state_list **slist, struct state_list *filter,
80 struct state_list *cur_slist);
81 void and_slist_stack(struct state_list_stack **slist_stack);
83 void or_slist_stack(struct state_list_stack **slist_stack);
85 struct state_list **get_slist_from_named_stack(struct named_stack *stack,
86 const char *name);
88 void overwrite_slist(struct state_list *from, struct state_list **to);