buf_size: remove memset() and memmove()
[smatch.git] / parse.h
blob6b21e234f3262946882bd8077199196aa7eff356
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_DECLARATION,
17 STMT_EXPRESSION,
18 STMT_COMPOUND,
19 STMT_IF,
20 STMT_RETURN,
21 STMT_CASE,
22 STMT_SWITCH,
23 STMT_ITERATOR,
24 STMT_LABEL,
25 STMT_GOTO,
26 STMT_ASM,
27 STMT_CONTEXT,
28 STMT_RANGE,
31 struct statement {
32 enum statement_type type;
33 struct position pos;
34 union {
35 struct /* declaration */ {
36 struct symbol_list *declaration;
38 struct /* label_arg */ {
39 struct symbol *label;
40 struct statement *label_statement;
42 struct {
43 struct expression *expression;
44 struct expression *context;
46 struct /* return_statement */ {
47 struct expression *ret_value;
48 struct symbol *ret_target;
50 struct /* if_statement */ {
51 struct expression *if_conditional;
52 struct statement *if_true;
53 struct statement *if_false;
55 struct /* compound_struct */ {
56 struct statement_list *stmts;
57 struct symbol *ret;
58 struct symbol *inline_fn;
59 struct statement *args;
61 struct /* labeled_struct */ {
62 struct symbol *label_identifier;
63 struct statement *label_statement;
65 struct /* case_struct */ {
66 struct expression *case_expression;
67 struct expression *case_to;
68 struct statement *case_statement;
69 struct symbol *case_label;
71 struct /* switch_struct */ {
72 struct expression *switch_expression;
73 struct statement *switch_statement;
74 struct symbol *switch_break, *switch_case;
76 struct /* iterator_struct */ {
77 struct symbol *iterator_break;
78 struct symbol *iterator_continue;
79 struct symbol_list *iterator_syms;
80 struct statement *iterator_pre_statement;
81 struct expression *iterator_pre_condition;
83 struct statement *iterator_statement;
85 struct statement *iterator_post_statement;
86 struct expression *iterator_post_condition;
88 struct /* goto_struct */ {
89 struct symbol *goto_label;
91 /* computed gotos have these: */
92 struct expression *goto_expression;
93 struct symbol_list *target_list;
95 struct /* goto_bb */ {
96 struct expression *bb_conditional;
97 struct symbol *bb_target;
99 struct /* multijmp */ {
100 struct expression *multi_from;
101 struct expression *multi_to;
102 struct symbol *multi_target;
104 struct /* asm */ {
105 struct expression *asm_string;
106 struct expression_list *asm_outputs;
107 struct expression_list *asm_inputs;
108 struct expression_list *asm_clobbers;
109 struct symbol_list *asm_labels;
111 struct /* range */ {
112 struct expression *range_expression;
113 struct expression *range_low;
114 struct expression *range_high;
119 extern struct symbol_list *function_computed_target_list;
120 extern struct statement_list *function_computed_goto_list;
122 extern struct token *parse_expression(struct token *, struct expression **);
123 extern struct symbol *label_symbol(struct token *token);
125 extern int show_statement(struct statement *);
126 extern void show_statement_list(struct statement_list *, const char *);
127 extern int show_expression(struct expression *);
129 extern struct token *external_declaration(struct token *token, struct symbol_list **list);
131 extern struct symbol *ctype_integer(int size, int want_unsigned);
133 extern void copy_statement(struct statement *src, struct statement *dst);
134 extern int inline_function(struct expression *expr, struct symbol *sym);
135 extern void uninline(struct symbol *sym);
136 extern void init_parser(int);
138 #endif /* PARSE_H */