2 * smatch/check_db_info.c
4 * Copyright (C) 2010 Dan Carpenter.
6 * Licensed under the Open Software License version 1.1
11 #include "smatch_extra.h"
15 static struct range_list
*return_ranges
;
17 static void add_return_range(struct range_list
*rl
)
19 rl
= cast_rl(cur_func_return_type(), rl
);
24 return_ranges
= rl_union(return_ranges
, rl
);
27 static void match_return(struct expression
*ret_value
)
29 struct range_list
*rl
;
30 struct symbol
*type
= cur_func_return_type();
34 ret_value
= strip_expr(ret_value
);
38 if (get_implied_rl(ret_value
, &rl
))
41 add_return_range(alloc_whole_rl(type
));
44 static void match_end_func(struct symbol
*sym
)
50 sql_insert_return_values(show_rl(return_ranges
));
54 void check_db_info(int id
)
57 add_hook(&match_return
, RETURN_HOOK
);
58 add_hook(&match_end_func
, END_FUNC_HOOK
);