Do real flow simplification only after liveness analysis.
[smatch.git] / test-parsing.c
blob59ae4be6def7700a49ab60a034675494f09df5ed
1 /*
2 * Example trivial client program that uses the sparse library
3 * to tokenize, pre-process and parse a C file, and prints out
4 * the results.
6 * Copyright (C) 2003 Transmeta Corp.
7 * 2003 Linus Torvalds
9 * Licensed under the Open Software License version 1.1
11 #include <stdarg.h>
12 #include <stdlib.h>
13 #include <stdio.h>
14 #include <string.h>
15 #include <ctype.h>
16 #include <unistd.h>
17 #include <fcntl.h>
19 #include "lib.h"
20 #include "token.h"
21 #include "parse.h"
22 #include "symbol.h"
23 #include "expression.h"
25 static void clean_up_symbols(struct symbol_list *list)
27 struct symbol *sym;
29 FOR_EACH_PTR(list, sym) {
30 expand_symbol(sym);
31 } END_FOR_EACH_PTR(sym);
34 int main(int argc, char **argv)
36 struct symbol_list *list = sparse(argc, argv);
38 // Simplification
39 clean_up_symbols(list);
41 #if 1
42 // Show the end result.
43 show_symbol_list(list, "\n\n");
44 printf("\n\n");
45 #endif
47 #if 0
48 // And show the allocation statistics
49 show_ident_alloc();
50 show_token_alloc();
51 show_symbol_alloc();
52 show_expression_alloc();
53 show_statement_alloc();
54 show_string_alloc();
55 show_bytes_alloc();
56 #endif
57 return 0;