Makefile: small whitespace change
[smatch.git] / smatch_extra.h
blob272577edc82a08d3d7a0736aa906d5722d3d1dae
1 /*
2 * sparse/smatch_extra.h
4 * Copyright (C) 2009 Dan Carpenter.
6 * Licensed under the Open Software License version 1.1
8 */
10 enum data_type {
11 DATA_RANGE,
14 DECLARE_PTR_LIST(range_list, struct data_range);
15 DECLARE_PTR_LIST(range_list_stack, struct range_list);
17 struct relation {
18 int op;
19 char *name;
20 struct symbol *sym;
23 DECLARE_PTR_LIST(related_list, struct relation);
25 struct data_info {
26 struct related_list *related;
27 enum data_type type;
28 struct range_list *value_ranges;
30 DECLARE_ALLOCATOR(data_info);
32 extern struct string_list *__ignored_macros;
34 /* these are implimented in smatch_ranges.c */
35 struct data_range *alloc_range_perm(long long min, long long max);
36 void add_range(struct range_list **list, long long min, long long max);
37 int true_comparison_range(struct data_range *left, int comparison, struct data_range *right);
38 int possibly_true(int comparison, struct data_info *dinfo, long long num, int left);
39 int possibly_true_range_lists(struct range_list *left_ranges, int comparison, struct range_list *right_ranges);
40 int possibly_true_range_list_lr(int comparison, struct data_info *dinfo, struct range_list *values, int left);
41 int possibly_false(int comparison, struct data_info *dinfo, long long num, int left);
42 int possibly_false_range_lists(struct range_list *left_ranges, int comparison, struct range_list *right_ranges);
43 int possibly_false_range_list_lr(int comparison, struct data_info *dinfo, struct range_list *values, int left);
44 void free_range_list(struct range_list **rlist);
45 void free_data_info_allocs(void);
46 struct range_list *clone_range_list(struct range_list *list);
47 char *show_ranges(struct range_list *list);
48 struct range_list *remove_range(struct range_list *list, long long min, long long max);
50 /* used in smatch_slist. implemented in smatch_extra.c */
51 int implied_not_equal(struct expression *expr, long long val);
52 struct sm_state *__extra_handle_canonical_loops(struct statement *loop, struct state_list **slist);
53 int __iterator_unchanged(struct sm_state *sm);
54 void __extra_pre_loop_hook_after(struct sm_state *sm,
55 struct statement *iterator,
56 struct expression *condition);
58 /* also implemented in smatch_extra */
59 struct smatch_state *clone_extra_state(struct smatch_state *state);
60 struct sm_state *set_extra_mod(const char *name, struct symbol *sym, struct smatch_state *state);
61 struct sm_state *set_extra_expr_mod(struct expression *expr, struct smatch_state *state);
62 void set_extra_expr_nomod(struct expression *expr, struct smatch_state *state);
63 struct smatch_state *alloc_extra_state(long long val);
64 struct smatch_state *alloc_extra_state_range_list(struct range_list *rl);
65 struct range_list *get_range_list(struct expression *expr);
66 struct data_info *get_dinfo(struct smatch_state *state);
67 struct smatch_state *add_filter(struct smatch_state *orig, long long filter);
68 struct smatch_state *extra_undefined(void);
70 struct range_list *range_list_union(struct range_list *one, struct range_list *two);
71 long long get_dinfo_min(struct data_info *dinfo);
72 long long get_dinfo_max(struct data_info *dinfo);
73 int get_single_value_from_dinfo(struct data_info *dinfo, long long *val);
75 void function_comparison(int comparison, struct expression *expr, long long value, int left);
77 int true_comparison_range_lr(int comparison, struct data_range *var, struct data_range *val, int left);
78 int false_comparison_range_lr(int comparison, struct data_range *var, struct data_range *val, int left);
79 struct data_range *alloc_range(long long min, long long max);
80 void tack_on(struct range_list **list, struct data_range *drange);
81 int in_list_exact(struct range_list *list, struct data_range *drange);
83 struct smatch_state *alloc_extra_state_range(long long min, long long max);
85 void push_range_list(struct range_list_stack **rl_stack, struct range_list *rl);
86 struct range_list *pop_range_list(struct range_list_stack **rl_stack);
87 struct range_list *top_range_list(struct range_list_stack *rl_stack);
88 void filter_top_range_list(struct range_list_stack **rl_stack, long long num);
89 int get_implied_range_list(struct expression *expr, struct range_list **rl);
90 int is_whole_range(struct smatch_state *state);
92 /* implemented in smatch_constraints */
93 struct relation *get_common_relationship(struct data_info *dinfo, int op,
94 const char *name, struct symbol *sym);
95 struct related_list *clone_related_list(struct related_list *related);
96 void add_related(struct smatch_state *state, int op, const char *name, struct symbol *sym);
97 void add_equiv(struct smatch_state *state, const char *name, struct symbol *sym);
98 void remove_from_equiv(const char *name, struct symbol *sym);
99 void remove_from_equiv_expr(struct expression *expr);