blob: 7a2a26f9188418f7b4dffb48a37ade49fd88cefc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
/* For each node, maintain a mapping of variables to
*
* { UNINITIALIZED, INITIALIZED, INITIALIZED_IF_TRUE, INITIALIZED_IF_FALSE }
*
*/
#include "ast.h"
static void
compute_initialized (ast_t *ast, gboolean *changed)
{
}
static gboolean
check_uses (ast_t *ast)
{
GList *list;
for (list = ast->common.children->head; list; list = list->next)
{
if (!check_uses (list->data))
return FALSE;
}
return TRUE;
}
gboolean
new_init_check (ast_program_t *program)
{
gboolean changed = FALSE;
do
{
changed = FALSE;
compute_initialized ((ast_t *)program->statement, &changed);
}
while (changed);
return check_uses ((ast_t *)program->statement);
}
|