Fix "addressof" of arrays.
[smatch.git] / parse.h
blob8d894df14c3328c9ab490d96589d04f1830ad21b
1 #ifndef PARSE_H
2 #define PARSE_H
3 /*
4 * Basic parsing data structures. Statements and symbols.
6 * Copyright (C) 2003 Transmeta Corp.
7 * 2003 Linus Torvalds
9 * Licensed under the Open Software License version 1.1
12 #include "symbol.h"
14 enum statement_type {
15 STMT_NONE,
16 STMT_EXPRESSION,
17 STMT_COMPOUND,
18 STMT_IF,
19 STMT_RETURN,
20 STMT_CASE,
21 STMT_SWITCH,
22 STMT_ITERATOR,
23 STMT_LABEL,
24 STMT_GOTO,
25 STMT_ASM,
28 struct statement {
29 enum statement_type type;
30 struct position pos;
31 union {
32 struct /* label_arg */ {
33 struct symbol *label;
34 struct statement *label_statement;
36 struct expression *expression;
37 struct /* return_statement */ {
38 struct expression *ret_value;
39 struct symbol *ret_target;
41 struct /* if_statement */ {
42 struct expression *if_conditional;
43 struct statement *if_true;
44 struct statement *if_false;
46 struct /* compound_struct */ {
47 struct symbol_list *syms;
48 struct statement_list *stmts;
49 struct symbol *ret;
51 struct /* labeled_struct */ {
52 struct symbol *label_identifier;
53 struct statement *label_statement;
55 struct /* case_struct */ {
56 struct expression *case_expression;
57 struct expression *case_to;
58 struct statement *case_statement;
59 struct symbol *case_label;
61 struct /* switch_struct */ {
62 struct expression *switch_expression;
63 struct statement *switch_statement;
64 struct symbol *switch_break, *switch_case;
66 struct /* iterator_struct */ {
67 struct symbol *iterator_break;
68 struct symbol *iterator_continue;
69 struct symbol_list *iterator_syms;
70 struct statement *iterator_pre_statement;
71 struct expression *iterator_pre_condition;
73 struct statement *iterator_statement;
75 struct statement *iterator_post_statement;
76 struct expression *iterator_post_condition;
78 struct /* goto_struct */ {
79 struct symbol *goto_label;
80 struct expression *goto_expression;
82 struct /* goto_bb */ {
83 struct expression *bb_conditional;
84 struct symbol *bb_target;
86 struct /* multijmp */ {
87 struct expression *multi_from;
88 struct expression *multi_to;
89 struct symbol *multi_target;
94 extern struct token *parse_expression(struct token *, struct expression **);
95 extern struct token *statement_list(struct token *, struct statement_list **);
96 extern struct symbol *label_symbol(struct token *token);
98 extern int show_statement(struct statement *);
99 extern void show_statement_list(struct statement_list *, const char *);
100 extern int show_expression(struct expression *);
101 extern void translation_unit(struct token *, struct symbol_list **);
103 extern struct symbol *ctype_integer(unsigned int spec);
104 extern struct symbol *ctype_fp(unsigned int spec);
106 extern int match_string_ident(struct ident *, const char *);
107 extern void copy_statement(struct statement *src, struct statement *dst);
108 extern int inline_function(struct expression *expr, struct symbol *sym);
110 #endif /* PARSE_H */