expressions: add cast_expression()
[smatch.git] / smatch_start_states.c
blobca9721da8b7efdf45d9e5a935d645819ba1c4052
1 /*
2 * Copyright (C) 2012 Oracle.
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, see http://www.gnu.org/copyleft/gpl.txt
19 * Store the states at the start of the function because this is something that
20 * is used in a couple places.
24 #include "smatch.h"
25 #include "smatch_slist.h"
27 static int my_id;
29 static struct stree *start_states;
30 static void save_start_states(struct statement *stmt)
32 start_states = clone_stree(__get_cur_stree());
35 static void match_end_func(void)
37 free_stree(&start_states);
40 struct stree *get_start_states(void)
42 return start_states;
45 void register_start_states(int id)
47 my_id = id;
49 add_hook(&save_start_states, AFTER_DEF_HOOK);
50 add_function_data((unsigned long *)&start_states);
51 add_hook(&match_end_func, AFTER_FUNC_HOOK);