- union {
- /* if type == STATEMENT_COMPOUND */
- struct {
- statement_t *statements;
- context_t context;
- } compound_stmt;
- /* if type == STATEMENT_RETURN */
- expression_t *return_value;
- /* if type == STATEMENT_DECLARATION */
- struct {
- declaration_t *begin;
- declaration_t *end;
- } declaration_stmt;
- /* if type == STATEMENT_IF */
- struct {
- expression_t *condition;
- statement_t *true_statement;
- statement_t *false_statement;
- } if_stmt;
- /* if type == STATEMENT_SWITCH */
- struct {
- expression_t *expression;
- statement_t *body;
- } switch_stmt;
- /* if type == STATEMENT_EXPRESSION */
- expression_t *expression;
- /* if type == STATEMENT_GOTO */
- declaration_t *goto_label;
- /* if type == STATEMENT_LABEL */
- struct {
- declaration_t *label;
- statement_t *label_statement;
- } label_stmt;
- /* if type == STATEMENT_CASE_LABEL */
- struct {
- expression_t *expression;
- statement_t *label_statement;
- } case_label_stmt;
- /* if type == STATEMENT_WHILE or STATEMENT_DO_WHILE */
- struct {
- expression_t *condition;
- statement_t *body;
- } while_stmt;
- /* if type == STATEMENT_FOR */
- struct {
- expression_t *initialisation;
- expression_t *condition;
- expression_t *step;
- statement_t *body;
- context_t context;
- } for_stmt;
- } v;
+};
+
+struct return_statement_t {
+ statement_base_t statement;
+ expression_t *return_value;
+};
+
+struct compound_statement_t {
+ statement_base_t statement;
+ statement_t *statements;
+ context_t context;
+};
+
+struct declaration_statement_t {
+ statement_base_t statement;
+ declaration_t *declarations_begin;
+ declaration_t *declarations_end;
+};
+
+struct if_statement_t {
+ statement_base_t statement;
+ expression_t *condition;
+ statement_t *true_statement;
+ statement_t *false_statement;
+};
+
+struct switch_statement_t {
+ statement_base_t statement;
+ expression_t *expression;
+ statement_t *body;
+};
+
+struct goto_statement_t {
+ statement_base_t statement;
+ declaration_t *label;
+};
+
+struct case_label_statement_t {
+ statement_base_t statement;
+ expression_t *expression;
+ statement_t *label_statement;
+};
+
+struct label_statement_t {
+ statement_base_t statement;
+ declaration_t *label;
+ statement_t *label_statement;
+};
+
+struct expression_statement_t {
+ statement_base_t statement;
+ expression_t *expression;
+};
+
+struct while_statement_t {
+ statement_base_t statement;
+ expression_t *condition;
+ statement_t *body;
+};
+
+struct do_while_statement_t {
+ statement_base_t statement;
+ expression_t *condition;
+ statement_t *body;
+};
+
+struct for_statement_t {
+ statement_base_t statement;
+ expression_t *initialisation;
+ expression_t *condition;
+ expression_t *step;
+ statement_t *body;
+ context_t context;
+};
+
+struct asm_constraint_t {
+ const char *constraints;
+ expression_t *expression;
+ symbol_t *symbol;
+ asm_constraint_t *next;
+};
+
+struct asm_clobber_t {
+ const char *clobber;
+ asm_clobber_t *next;
+};
+
+struct asm_statement_t {
+ statement_base_t statement;
+ const char *asm_text;
+ asm_constraint_t *inputs;
+ asm_constraint_t *outputs;
+ asm_clobber_t *clobbers;
+ bool is_volatile;
+};
+
+union statement_t {
+ statement_type_t type;
+ statement_base_t base;
+ return_statement_t returns;
+ compound_statement_t compound;
+ declaration_statement_t declaration;
+ if_statement_t ifs;
+ switch_statement_t switchs;
+ goto_statement_t gotos;
+ case_label_statement_t case_label;
+ label_statement_t label;
+ expression_statement_t expression;
+ while_statement_t whiles;
+ do_while_statement_t do_while;
+ for_statement_t fors;
+ asm_statement_t asms;