Print this page
new smatch
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/tools/smatch/src/smatch_extra.h
+++ new/usr/src/tools/smatch/src/smatch_extra.h
1 1 /*
2 2 * Copyright (C) 2009 Dan Carpenter.
3 3 *
4 4 * This program is free software; you can redistribute it and/or
5 5 * modify it under the terms of the GNU General Public License
6 6 * as published by the Free Software Foundation; either version 2
7 7 * of the License, or (at your option) any later version.
8 8 *
9 9 * This program is distributed in the hope that it will be useful,
10 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 * GNU General Public License for more details.
13 13 *
14 14 * You should have received a copy of the GNU General Public License
15 15 * along with this program; if not, see http://www.gnu.org/copyleft/gpl.txt
16 16 */
17 17
18 18 DECLARE_PTR_LIST(range_list, struct data_range);
19 19 DECLARE_PTR_LIST(range_list_stack, struct range_list);
20 20
21 21 struct relation {
22 22 char *name;
23 23 struct symbol *sym;
↓ open down ↓ |
23 lines elided |
↑ open up ↑ |
24 24 };
25 25
26 26 DECLARE_PTR_LIST(related_list, struct relation);
27 27
28 28 struct data_info {
29 29 struct related_list *related;
30 30 struct range_list *value_ranges;
31 31 sval_t fuzzy_max;
32 32 unsigned int hard_max:1;
33 33 unsigned int capped:1;
34 + unsigned int treat_untagged:1;
34 35 };
35 36 DECLARE_ALLOCATOR(data_info);
36 37
37 38 extern struct string_list *__ignored_macros;
38 39
39 40 /* these are implemented in smatch_ranges.c */
40 41 struct range_list *rl_zero(void);
41 42 struct range_list *rl_one(void);
42 43 char *show_rl(struct range_list *list);
43 44 int str_to_comparison_arg(const char *c, struct expression *call, int *comparison, struct expression **arg);
44 45 void str_to_rl(struct symbol *type, char *value, struct range_list **rl);
45 46 void call_results_to_rl(struct expression *call, struct symbol *type, const char *value, struct range_list **rl);
46 47
47 48 struct data_range *alloc_range(sval_t min, sval_t max);
48 49 struct data_range *alloc_range_perm(sval_t min, sval_t max);
49 50
50 51 int rl_fits_in_type(struct range_list *rl, struct symbol *type);
51 52
52 53 struct range_list *alloc_rl(sval_t min, sval_t max);
53 54 struct range_list *clone_rl(struct range_list *list);
54 55 struct range_list *clone_rl_permanent(struct range_list *list);
55 56 struct range_list *alloc_whole_rl(struct symbol *type);
56 57
57 58 void add_range(struct range_list **list, sval_t min, sval_t max);
58 59 struct range_list *remove_range(struct range_list *list, sval_t min, sval_t max);
59 60 void tack_on(struct range_list **list, struct data_range *drange);
60 61
61 62 int true_comparison_range(struct data_range *left, int comparison, struct data_range *right);
62 63 int true_comparison_range_LR(int comparison, struct data_range *var, struct data_range *val, int left);
63 64 int false_comparison_range_LR(int comparison, struct data_range *var, struct data_range *val, int left);
64 65
65 66 int possibly_true(struct expression *left, int comparison, struct expression *right);
↓ open down ↓ |
22 lines elided |
↑ open up ↑ |
66 67 int possibly_true_rl(struct range_list *left_ranges, int comparison, struct range_list *right_ranges);
67 68 int possibly_true_rl_LR(int comparison, struct range_list *a, struct range_list *b, int left);
68 69
69 70 int possibly_false(struct expression *left, int comparison, struct expression *right);
70 71 int possibly_false_rl(struct range_list *left_ranges, int comparison, struct range_list *right_ranges);
71 72 int possibly_false_rl_LR(int comparison, struct range_list *a, struct range_list *b, int left);
72 73
73 74 int rl_has_sval(struct range_list *rl, sval_t sval);
74 75 int ranges_equiv(struct data_range *one, struct data_range *two);
75 76
77 +bool is_err_ptr(sval_t sval);
78 +
76 79 int rl_equiv(struct range_list *one, struct range_list *two);
77 80 int is_whole_rl(struct range_list *rl);
78 81 int is_unknown_ptr(struct range_list *rl);
79 82 int is_whole_rl_non_zero(struct range_list *rl);
80 83 int estate_is_unknown(struct smatch_state *state);
81 84
82 85 sval_t rl_min(struct range_list *rl);
83 86 sval_t rl_max(struct range_list *rl);
84 87 int rl_to_sval(struct range_list *rl, sval_t *sval);
85 88 struct symbol *rl_type(struct range_list *rl);
86 89
87 90 struct range_list *rl_filter(struct range_list *rl, struct range_list *filter);
88 91 struct range_list *rl_intersection(struct range_list *one, struct range_list *two);
89 92 struct range_list *rl_union(struct range_list *one, struct range_list *two);
90 93 struct range_list *rl_binop(struct range_list *left, int op, struct range_list *right);
91 94
92 95 void push_rl(struct range_list_stack **rl_stack, struct range_list *rl);
93 96 struct range_list *pop_rl(struct range_list_stack **rl_stack);
94 97 struct range_list *top_rl(struct range_list_stack *rl_stack);
95 98 void filter_top_rl(struct range_list_stack **rl_stack, struct range_list *filter);
96 99
97 100 struct range_list *rl_truncate_cast(struct symbol *type, struct range_list *rl);
98 101 struct range_list *cast_rl(struct symbol *type, struct range_list *rl);
99 102 int get_implied_rl(struct expression *expr, struct range_list **rl);
100 103 int get_absolute_rl(struct expression *expr, struct range_list **rl);
101 104 int get_real_absolute_rl(struct expression *expr, struct range_list **rl);
102 105 struct range_list *var_to_absolute_rl(struct expression *expr);
103 106 int custom_get_absolute_rl(struct expression *expr,
104 107 struct range_list *(*fn)(struct expression *expr),
105 108 struct range_list **rl);
106 109 int get_implied_rl_var_sym(const char *var, struct symbol *sym, struct range_list **rl);
107 110 void split_comparison_rl(struct range_list *left_orig, int op, struct range_list *right_orig,
108 111 struct range_list **left_true_rl, struct range_list **left_false_rl,
109 112 struct range_list **right_true_rl, struct range_list **right_false_rl);
110 113
111 114 void free_data_info_allocs(void);
112 115 void free_all_rl(void);
113 116
114 117 /* smatch_estate.c */
115 118
116 119 struct smatch_state *alloc_estate_empty(void);
117 120 struct smatch_state *alloc_estate_sval(sval_t sval);
118 121 struct smatch_state *alloc_estate_range(sval_t min, sval_t max);
119 122 struct smatch_state *alloc_estate_rl(struct range_list *rl);
120 123 struct smatch_state *alloc_estate_whole(struct symbol *type);
121 124 struct smatch_state *clone_estate(struct smatch_state *state);
122 125 struct smatch_state *clone_estate_cast(struct symbol *type, struct smatch_state *state);
123 126 struct smatch_state *clone_partial_estate(struct smatch_state *state, struct range_list *rl);
124 127
125 128 struct smatch_state *merge_estates(struct smatch_state *s1, struct smatch_state *s2);
126 129
127 130 int estates_equiv(struct smatch_state *one, struct smatch_state *two);
128 131 int estate_is_whole(struct smatch_state *state);
129 132 int estate_is_empty(struct smatch_state *state);
130 133
131 134 struct range_list *estate_rl(struct smatch_state *state);
132 135 struct related_list *estate_related(struct smatch_state *state);
133 136
134 137 sval_t estate_min(struct smatch_state *state);
135 138 sval_t estate_max(struct smatch_state *state);
136 139 struct symbol *estate_type(struct smatch_state *state);
137 140
138 141 int estate_has_fuzzy_max(struct smatch_state *state);
↓ open down ↓ |
53 lines elided |
↑ open up ↑ |
139 142 sval_t estate_get_fuzzy_max(struct smatch_state *state);
140 143 void estate_set_fuzzy_max(struct smatch_state *state, sval_t max);
141 144 void estate_copy_fuzzy_max(struct smatch_state *new, struct smatch_state *old);
142 145 void estate_clear_fuzzy_max(struct smatch_state *state);
143 146 int estate_has_hard_max(struct smatch_state *state);
144 147 void estate_set_hard_max(struct smatch_state *state);
145 148 void estate_clear_hard_max(struct smatch_state *state);
146 149 int estate_get_hard_max(struct smatch_state *state, sval_t *sval);
147 150 bool estate_capped(struct smatch_state *state);
148 151 void estate_set_capped(struct smatch_state *state);
152 +bool estate_treat_untagged(struct smatch_state *state);
153 +void estate_set_treat_untagged(struct smatch_state *state);
149 154
150 155 int estate_get_single_value(struct smatch_state *state, sval_t *sval);
151 156 struct smatch_state *get_implied_estate(struct expression *expr);
152 157
153 158 struct smatch_state *estate_filter_sval(struct smatch_state *orig, sval_t filter);
154 159 struct data_info *clone_dinfo_perm(struct data_info *dinfo);
155 160 struct smatch_state *clone_estate_perm(struct smatch_state *state);
156 161
157 162 /* smatch_extra.c */
158 163 bool is_impossible_variable(struct expression *expr);
159 164 struct sm_state *get_extra_sm_state(struct expression *expr);
160 165 struct smatch_state *get_extra_state(struct expression *expr);
161 166 void call_extra_mod_hooks(const char *name, struct symbol *sym, struct expression *expr, struct smatch_state *state);
162 167 void set_extra_mod(const char *name, struct symbol *sym, struct expression *expr, struct smatch_state *state);
163 168 void set_extra_expr_mod(struct expression *expr, struct smatch_state *state);
164 169 void set_extra_nomod(const char *name, struct symbol *sym, struct expression *expr, struct smatch_state *state);
165 170 void set_extra_nomod_vsl(const char *name, struct symbol *sym, struct var_sym_list *vsl, struct expression *expr, struct smatch_state *state);
166 171 void set_extra_expr_nomod(struct expression *expr, struct smatch_state *state);
167 172 void set_extra_mod_helper(const char *name, struct symbol *sym, struct expression *expr, struct smatch_state *state);
168 173
169 174 struct data_info *get_dinfo(struct smatch_state *state);
170 175
171 176 void add_extra_mod_hook(void (*fn)(const char *name, struct symbol *sym, struct expression *expr, struct smatch_state *state));
172 177 void add_extra_nomod_hook(void (*fn)(const char *name, struct symbol *sym, struct expression *expr, struct smatch_state *state));
173 178 int implied_not_equal(struct expression *expr, long long val);
174 179 int implied_not_equal_name_sym(char *name, struct symbol *sym, long long val);
175 180 int parent_is_null_var_sym(const char *name, struct symbol *sym);
176 181 int parent_is_null(struct expression *expr);
177 182 int parent_is_free_var_sym_strict(const char *name, struct symbol *sym);
178 183 int parent_is_free_var_sym(const char *name, struct symbol *sym);
179 184 int parent_is_free(struct expression *expr);
180 185
181 186 struct sm_state *__extra_handle_canonical_loops(struct statement *loop, struct stree **stree);
182 187 int __iterator_unchanged(struct sm_state *sm);
183 188 void __extra_pre_loop_hook_after(struct sm_state *sm,
184 189 struct statement *iterator,
185 190 struct expression *condition);
186 191
187 192 /* smatch_equiv.c */
188 193 void set_equiv(struct expression *left, struct expression *right);
189 194 void set_related(struct smatch_state *estate, struct related_list *rlist);
190 195 struct related_list *get_shared_relations(struct related_list *one,
191 196 struct related_list *two);
192 197 struct related_list *clone_related_list(struct related_list *related);
193 198 void remove_from_equiv(const char *name, struct symbol *sym);
194 199 void remove_from_equiv_expr(struct expression *expr);
195 200 void set_equiv_state_expr(int id, struct expression *expr, struct smatch_state *state);
196 201
197 202 /* smatch_function_hooks.c */
198 203 void function_comparison(struct expression *left, int comparison, struct expression *right);
199 204
200 205 /* smatch_expressions.c */
201 206 struct expression *zero_expr();
202 207 struct expression *value_expr(long long val);
203 208 struct expression *member_expression(struct expression *deref, int op, struct ident *member);
↓ open down ↓ |
45 lines elided |
↑ open up ↑ |
204 209 struct expression *preop_expression(struct expression *expr, int op);
205 210 struct expression *deref_expression(struct expression *expr);
206 211 struct expression *assign_expression(struct expression *left, int op, struct expression *right);
207 212 struct expression *binop_expression(struct expression *left, int op, struct expression *right);
208 213 struct expression *array_element_expression(struct expression *array, struct expression *offset);
209 214 struct expression *symbol_expression(struct symbol *sym);
210 215 struct expression *string_expression(char *str);
211 216 struct expression *compare_expression(struct expression *left, int op, struct expression *right);
212 217 struct expression *unknown_value_expression(struct expression *expr);
213 218 int is_fake_call(struct expression *expr);
219 +struct expression *gen_expression_from_name_sym(const char *name, struct symbol *sym);
214 220 struct expression *gen_expression_from_key(struct expression *arg, const char *key);
215 221 void free_tmp_expressions(void);
216 222 void expr_set_parent_expr(struct expression *expr, struct expression *parent);
217 223 void expr_set_parent_stmt(struct expression *expr, struct statement *parent);
218 224 struct expression *expr_get_parent_expr(struct expression *expr);
219 225 struct statement *expr_get_parent_stmt(struct expression *expr);
220 226
221 227 /* smatch_param_limit.c */
222 228 struct smatch_state *get_orig_estate(const char *name, struct symbol *sym);
223 229
224 230 /* smatch_real_absolute.c */
225 231 struct smatch_state *get_real_absolute_state(struct expression *expr);
226 232 struct smatch_state *get_real_absolute_state_var_sym(const char *name, struct symbol *sym);
227 233
228 234 /* smatch_imaginary_absolute.c */
229 235 void __save_imaginary_state(struct expression *expr, struct range_list *true_rl, struct range_list *false_rl);
230 236 int get_imaginary_absolute(struct expression *expr, struct range_list **rl);
231 237
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX