- Rework the way literals are handled, these are now kept as strings until
[cparser] / ast_t.h
1 /*
2  * This file is part of cparser.
3  * Copyright (C) 2007-2009 Matthias Braun <matze@braunis.de>
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * as published by the Free Software Foundation; either version 2
8  * of the License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
18  * 02111-1307, USA.
19  */
20 #ifndef AST_T_H
21 #define AST_T_H
22
23 #include <libfirm/firm_types.h>
24 #include <assert.h>
25
26 #include "ast.h"
27 #include "symbol.h"
28 #include "token_t.h"
29 #include "type.h"
30 #include "entity_t.h"
31 #include "adt/obst.h"
32 #include "target_value.h"
33
34 /** The AST obstack contains all data that must stay in the AST. */
35 extern struct obstack ast_obstack;
36
37 /**
38  * Operator precedence classes
39  */
40 typedef enum precedence_t {
41         PREC_BOTTOM,
42         PREC_EXPRESSION,     /* ,                                  left to right */
43         PREC_ASSIGNMENT,     /* = += -= *= /= %= <<= >>= &= ^= |=  right to left */
44         PREC_CONDITIONAL,    /* ?:                                 right to left */
45         PREC_LOGICAL_OR,     /* ||                                 left to right */
46         PREC_LOGICAL_AND,    /* &&                                 left to right */
47         PREC_OR,             /* |                                  left to right */
48         PREC_XOR,            /* ^                                  left to right */
49         PREC_AND,            /* &                                  left to right */
50         PREC_EQUALITY,       /* == !=                              left to right */
51         PREC_RELATIONAL,     /* < <= > >=                          left to right */
52         PREC_SHIFT,          /* << >>                              left to right */
53         PREC_ADDITIVE,       /* + -                                left to right */
54         PREC_MULTIPLICATIVE, /* * / %                              left to right */
55         PREC_CAST,           /* (type)                             right to left */
56         PREC_UNARY,          /* ! ~ ++ -- + - * & sizeof           right to left */
57         PREC_POSTFIX,        /* () [] -> .                         left to right */
58         PREC_PRIMARY,
59         PREC_TOP
60 } precedence_t;
61
62 /**
63  * Expression kinds.
64  */
65 typedef enum expression_kind_t {
66         EXPR_UNKNOWN = 0,
67         EXPR_INVALID,
68         EXPR_REFERENCE,
69         EXPR_REFERENCE_ENUM_VALUE,
70         EXPR_LITERAL_BOOLEAN,
71         EXPR_LITERAL_INTEGER,
72         EXPR_LITERAL_INTEGER_OCTAL,
73         EXPR_LITERAL_INTEGER_HEXADECIMAL,
74         EXPR_LITERAL_FLOATINGPOINT,
75         EXPR_LITERAL_FLOATINGPOINT_HEXADECIMAL,
76         EXPR_LITERAL_CHARACTER,
77         EXPR_LITERAL_WIDE_CHARACTER,
78         EXPR_LITERAL_MS_NOOP, /**< MS __noop extension */
79         EXPR_STRING_LITERAL,
80         EXPR_WIDE_STRING_LITERAL,
81         EXPR_COMPOUND_LITERAL,
82         EXPR_CALL,
83         EXPR_CONDITIONAL,
84         EXPR_SELECT,
85         EXPR_ARRAY_ACCESS,
86         EXPR_SIZEOF,
87         EXPR_CLASSIFY_TYPE,
88         EXPR_ALIGNOF,
89
90         EXPR_FUNCNAME,
91         EXPR_BUILTIN_CONSTANT_P,
92         EXPR_BUILTIN_TYPES_COMPATIBLE_P,
93         EXPR_OFFSETOF,
94         EXPR_VA_START,
95         EXPR_VA_ARG,
96         EXPR_VA_COPY,
97         EXPR_STATEMENT,
98         EXPR_LABEL_ADDRESS, /**< GCC extension &&label operator */
99
100         EXPR_UNARY_FIRST,
101         EXPR_UNARY_NEGATE = EXPR_UNARY_FIRST,
102         EXPR_UNARY_PLUS,
103         EXPR_UNARY_BITWISE_NEGATE,
104         EXPR_UNARY_NOT,
105         EXPR_UNARY_DEREFERENCE,
106         EXPR_UNARY_TAKE_ADDRESS,
107         EXPR_UNARY_POSTFIX_INCREMENT,
108         EXPR_UNARY_POSTFIX_DECREMENT,
109         EXPR_UNARY_PREFIX_INCREMENT,
110         EXPR_UNARY_PREFIX_DECREMENT,
111         EXPR_UNARY_CAST,
112         EXPR_UNARY_CAST_IMPLICIT, /**< compiler generated cast */
113         EXPR_UNARY_ASSUME,        /**< MS __assume() */
114         EXPR_UNARY_DELETE,
115         EXPR_UNARY_DELETE_ARRAY,
116         EXPR_UNARY_THROW,
117         EXPR_UNARY_LAST = EXPR_UNARY_THROW,
118
119         EXPR_BINARY_FIRST,
120         EXPR_BINARY_ADD = EXPR_BINARY_FIRST,
121         EXPR_BINARY_SUB,
122         EXPR_BINARY_MUL,
123         EXPR_BINARY_DIV,
124         EXPR_BINARY_MOD,
125         EXPR_BINARY_EQUAL,
126         EXPR_BINARY_NOTEQUAL,
127         EXPR_BINARY_LESS,
128         EXPR_BINARY_LESSEQUAL,
129         EXPR_BINARY_GREATER,
130         EXPR_BINARY_GREATEREQUAL,
131         EXPR_BINARY_BITWISE_AND,
132         EXPR_BINARY_BITWISE_OR,
133         EXPR_BINARY_BITWISE_XOR,
134         EXPR_BINARY_LOGICAL_AND,
135         EXPR_BINARY_LOGICAL_OR,
136         EXPR_BINARY_SHIFTLEFT,
137         EXPR_BINARY_SHIFTRIGHT,
138         EXPR_BINARY_ASSIGN,
139         EXPR_BINARY_MUL_ASSIGN,
140         EXPR_BINARY_DIV_ASSIGN,
141         EXPR_BINARY_MOD_ASSIGN,
142         EXPR_BINARY_ADD_ASSIGN,
143         EXPR_BINARY_SUB_ASSIGN,
144         EXPR_BINARY_SHIFTLEFT_ASSIGN,
145         EXPR_BINARY_SHIFTRIGHT_ASSIGN,
146         EXPR_BINARY_BITWISE_AND_ASSIGN,
147         EXPR_BINARY_BITWISE_XOR_ASSIGN,
148         EXPR_BINARY_BITWISE_OR_ASSIGN,
149         EXPR_BINARY_COMMA,
150
151         EXPR_BINARY_ISGREATER,
152         EXPR_BINARY_ISGREATEREQUAL,
153         EXPR_BINARY_ISLESS,
154         EXPR_BINARY_ISLESSEQUAL,
155         EXPR_BINARY_ISLESSGREATER,
156         EXPR_BINARY_ISUNORDERED,
157         EXPR_BINARY_LAST = EXPR_BINARY_ISUNORDERED,
158 } expression_kind_t;
159
160 typedef enum funcname_kind_t {
161         FUNCNAME_FUNCTION,           /**< C99 __func__, older __FUNCTION__ */
162         FUNCNAME_PRETTY_FUNCTION,    /**< GNUC __PRETTY_FUNCTION__ */
163         FUNCNAME_FUNCSIG,            /**< MS __FUNCSIG__ */
164         FUNCNAME_FUNCDNAME           /**< MS __FUNCDNAME__ */
165 } funcname_kind_t;
166
167 /* convenience macros */
168 #define EXPR_BINARY_CASES                  \
169         case EXPR_BINARY_ADD:                  \
170         case EXPR_BINARY_SUB:                  \
171         case EXPR_BINARY_MUL:                  \
172         case EXPR_BINARY_DIV:                  \
173         case EXPR_BINARY_MOD:                  \
174         case EXPR_BINARY_EQUAL:                \
175         case EXPR_BINARY_NOTEQUAL:             \
176         case EXPR_BINARY_LESS:                 \
177         case EXPR_BINARY_LESSEQUAL:            \
178         case EXPR_BINARY_GREATER:              \
179         case EXPR_BINARY_GREATEREQUAL:         \
180         case EXPR_BINARY_BITWISE_AND:          \
181         case EXPR_BINARY_BITWISE_OR:           \
182         case EXPR_BINARY_BITWISE_XOR:          \
183         case EXPR_BINARY_LOGICAL_AND:          \
184         case EXPR_BINARY_LOGICAL_OR:           \
185         case EXPR_BINARY_SHIFTLEFT:            \
186         case EXPR_BINARY_SHIFTRIGHT:           \
187         case EXPR_BINARY_ASSIGN:               \
188         case EXPR_BINARY_MUL_ASSIGN:           \
189         case EXPR_BINARY_DIV_ASSIGN:           \
190         case EXPR_BINARY_MOD_ASSIGN:           \
191         case EXPR_BINARY_ADD_ASSIGN:           \
192         case EXPR_BINARY_SUB_ASSIGN:           \
193         case EXPR_BINARY_SHIFTLEFT_ASSIGN:     \
194         case EXPR_BINARY_SHIFTRIGHT_ASSIGN:    \
195         case EXPR_BINARY_BITWISE_AND_ASSIGN:   \
196         case EXPR_BINARY_BITWISE_XOR_ASSIGN:   \
197         case EXPR_BINARY_BITWISE_OR_ASSIGN:    \
198         case EXPR_BINARY_COMMA:                \
199         case EXPR_BINARY_ISGREATER:            \
200         case EXPR_BINARY_ISGREATEREQUAL:       \
201         case EXPR_BINARY_ISLESS:               \
202         case EXPR_BINARY_ISLESSEQUAL:          \
203         case EXPR_BINARY_ISLESSGREATER:        \
204         case EXPR_BINARY_ISUNORDERED:
205
206 /**
207  * unary expression with mandatory operand
208  */
209 #define EXPR_UNARY_CASES_MANDATORY         \
210         case EXPR_UNARY_NEGATE:                \
211         case EXPR_UNARY_PLUS:                  \
212         case EXPR_UNARY_BITWISE_NEGATE:        \
213         case EXPR_UNARY_NOT:                   \
214         case EXPR_UNARY_DEREFERENCE:           \
215         case EXPR_UNARY_TAKE_ADDRESS:          \
216         case EXPR_UNARY_POSTFIX_INCREMENT:     \
217         case EXPR_UNARY_POSTFIX_DECREMENT:     \
218         case EXPR_UNARY_PREFIX_INCREMENT:      \
219         case EXPR_UNARY_PREFIX_DECREMENT:      \
220         case EXPR_UNARY_CAST:                  \
221         case EXPR_UNARY_CAST_IMPLICIT:         \
222         case EXPR_UNARY_ASSUME:                \
223         case EXPR_UNARY_DELETE:                \
224         case EXPR_UNARY_DELETE_ARRAY:
225
226 /**
227  * unary expression with optional operand
228  */
229 #define EXPR_UNARY_CASES_OPTIONAL \
230         case EXPR_UNARY_THROW:        \
231
232 #define EXPR_UNARY_CASES       \
233         EXPR_UNARY_CASES_MANDATORY \
234         EXPR_UNARY_CASES_OPTIONAL
235
236 #define EXPR_LITERAL_CASES                        \
237         case EXPR_LITERAL_BOOLEAN:                    \
238         case EXPR_LITERAL_INTEGER:                    \
239         case EXPR_LITERAL_INTEGER_OCTAL:              \
240         case EXPR_LITERAL_INTEGER_HEXADECIMAL:        \
241         case EXPR_LITERAL_FLOATINGPOINT:              \
242         case EXPR_LITERAL_FLOATINGPOINT_HEXADECIMAL:  \
243         case EXPR_LITERAL_CHARACTER:                  \
244         case EXPR_LITERAL_WIDE_CHARACTER:             \
245         case EXPR_LITERAL_MS_NOOP:
246
247 /**
248  * The base class of every expression.
249  */
250 struct expression_base_t {
251         expression_kind_t   kind;            /**< The expression kind. */
252         type_t             *type;            /**< The type of the expression. */
253         source_position_t   source_position; /**< The source position of this expression. */
254         bool                parenthesized : 1;
255 #ifndef NDEBUG
256         bool                transformed : 1;     /**< Set if this expression was transformed. */
257 #endif
258 };
259
260 /**
261  * integer/float constants, character and string literals
262  */
263 struct literal_expression_t {
264         expression_base_t  base;
265         string_t           value;
266         symbol_t          *suffix;
267
268         /* ast2firm data */
269         tarval            *target_value;
270 };
271
272 struct string_literal_expression_t {
273         expression_base_t  base;
274         string_t           value;
275 };
276
277 struct funcname_expression_t {
278         expression_base_t  base;
279         funcname_kind_t    kind;
280         string_t           value;     /**< the value once assigned. */
281 };
282
283 struct compound_literal_expression_t {
284         expression_base_t  base;
285         type_t            *type;
286         initializer_t     *initializer;
287 };
288
289 struct builtin_constant_expression_t {
290         expression_base_t  base;
291         expression_t      *value;
292 };
293
294 struct builtin_types_compatible_expression_t {
295         expression_base_t  base;
296         type_t            *left;
297         type_t            *right;
298 };
299
300 struct reference_expression_t {
301         expression_base_t  base;
302         entity_t          *entity;
303 };
304
305 /**
306  * An argument of a call.
307  */
308 struct call_argument_t {
309         expression_t    *expression;  /**< The expression which value is transmitted. */
310         call_argument_t *next;        /**< Links to the next argument of this call. */
311 };
312
313
314 struct call_expression_t {
315         expression_base_t  base;
316         expression_t      *function;  /**< The address of the function to call. */
317         call_argument_t   *arguments; /**< List of arguments of this call. */
318 };
319
320
321 struct unary_expression_t {
322         expression_base_t  base;
323         expression_t      *value;     /**< The unary operand. */
324 };
325
326 struct binary_expression_t {
327         expression_base_t  base;
328         expression_t      *left;
329         expression_t      *right;
330 };
331
332 struct select_expression_t {
333         expression_base_t  base;
334         expression_t      *compound;
335         entity_t          *compound_entry;
336         bool               implicit : 1; /**< compiler generated select
337                                               (for anonymous struct/union) */
338 };
339
340 struct array_access_expression_t {
341         expression_base_t  base;
342         expression_t      *array_ref; /**< the referenced array */
343         expression_t      *index;     /**< the index used */
344         bool               flipped;   /**< True if index/ref was written in a 5[a] way */
345 };
346
347 struct typeprop_expression_t {
348         expression_base_t  base;
349         type_t            *type;
350         expression_t      *tp_expression;
351 };
352
353 struct designator_t {
354         source_position_t  source_position;
355         symbol_t          *symbol;      /**< the symbol if any */
356         expression_t      *array_index; /**< the array index if any */
357         designator_t      *next;
358 };
359
360 struct offsetof_expression_t {
361         expression_base_t  base;
362         type_t            *type;
363         designator_t      *designator;
364 };
365
366 struct va_start_expression_t {
367         expression_base_t  base;
368         expression_t      *ap;
369         variable_t        *parameter;
370 };
371
372 struct va_arg_expression_t {
373         expression_base_t  base;
374         expression_t      *ap;
375 };
376
377 struct va_copy_expression_t {
378         expression_base_t  base;
379         expression_t      *dst;    /**< destination argument */
380         expression_t      *src;    /**< source argument */
381 };
382
383 struct conditional_expression_t {
384         expression_base_t  base;
385         expression_t      *condition;
386         expression_t      *true_expression;
387         expression_t      *false_expression;
388 };
389
390 struct statement_expression_t {
391         expression_base_t  base;
392         statement_t       *statement;
393 };
394
395 struct classify_type_expression_t {
396         expression_base_t  base;
397         expression_t      *type_expression;
398 };
399
400 struct label_address_expression_t {
401         expression_base_t  base;
402         label_t           *label;
403 };
404
405 union expression_t {
406         expression_kind_t                     kind;
407         expression_base_t                     base;
408         literal_expression_t                  literal;
409         string_literal_expression_t           string_literal;
410         funcname_expression_t                 funcname;
411         compound_literal_expression_t         compound_literal;
412         builtin_constant_expression_t         builtin_constant;
413         builtin_types_compatible_expression_t builtin_types_compatible;
414         reference_expression_t                reference;
415         call_expression_t                     call;
416         unary_expression_t                    unary;
417         binary_expression_t                   binary;
418         select_expression_t                   select;
419         array_access_expression_t             array_access;
420         typeprop_expression_t                 typeprop;
421         offsetof_expression_t                 offsetofe;
422         va_start_expression_t                 va_starte;
423         va_arg_expression_t                   va_arge;
424         va_copy_expression_t                  va_copye;
425         conditional_expression_t              conditional;
426         statement_expression_t                statement;
427         classify_type_expression_t            classify_type;
428         label_address_expression_t            label_address;
429 };
430
431 typedef enum initializer_kind_t {
432         INITIALIZER_VALUE,
433         INITIALIZER_LIST,
434         INITIALIZER_STRING,
435         INITIALIZER_WIDE_STRING,
436         INITIALIZER_DESIGNATOR
437 } initializer_kind_t;
438
439 struct initializer_base_t {
440         initializer_kind_t kind;
441 };
442
443 struct initializer_value_t {
444         initializer_base_t  base;
445         expression_t       *value;
446 };
447
448 struct initializer_list_t {
449         initializer_base_t  base;
450         size_t              len;
451         initializer_t      *initializers[];
452 };
453
454 struct initializer_string_t {
455         initializer_base_t base;
456         string_t           string;
457 };
458
459 struct initializer_wide_string_t {
460         initializer_base_t  base;
461         string_t            string;
462 };
463
464 struct initializer_designator_t {
465         initializer_base_t  base;
466         designator_t       *designator;
467 };
468
469 union initializer_t {
470         initializer_kind_t        kind;
471         initializer_base_t        base;
472         initializer_value_t       value;
473         initializer_list_t        list;
474         initializer_string_t      string;
475         initializer_wide_string_t wide_string;
476         initializer_designator_t  designator;
477 };
478
479 /**
480  * The statement kinds.
481  */
482 typedef enum statement_kind_t {
483         STATEMENT_INVALID,
484         STATEMENT_EMPTY,
485         STATEMENT_COMPOUND,
486         STATEMENT_RETURN,
487         STATEMENT_DECLARATION,
488         STATEMENT_IF,
489         STATEMENT_SWITCH,
490         STATEMENT_EXPRESSION,
491         STATEMENT_CONTINUE,
492         STATEMENT_BREAK,
493         STATEMENT_GOTO,
494         STATEMENT_LABEL,
495         STATEMENT_CASE_LABEL,
496         STATEMENT_WHILE,
497         STATEMENT_DO_WHILE,
498         STATEMENT_FOR,
499         STATEMENT_ASM,
500         STATEMENT_MS_TRY,          /**< MS __try/__finally or __try/__except */
501         STATEMENT_LEAVE            /**< MS __leave */
502 } statement_kind_t;
503
504 /**
505  * The base class of every statement.
506  */
507 struct statement_base_t {
508         statement_kind_t   kind;
509         statement_t       *next;         /**< Point to the next statement in a compound statement. */
510         source_position_t  source_position;
511         statement_t       *parent;       /**< The Parent statement that controls the execution. */
512         bool               reachable;    /**< True, if this statement is reachable. */
513 #ifndef NDEBUG
514         bool               transformed;
515 #endif
516 };
517
518 struct invalid_statement_t {
519         statement_base_t  base;
520 };
521
522 struct empty_statement_t {
523         statement_base_t  base;
524 };
525
526 struct return_statement_t {
527         statement_base_t  base;
528         expression_t     *value;    /**< The return value if any. */
529 };
530
531 struct compound_statement_t {
532         statement_base_t  base;
533         statement_t      *statements;
534         scope_t           scope;
535         bool              stmt_expr; /**< True if this compound statement is a statement expression. */
536 };
537
538 struct declaration_statement_t {
539         statement_base_t  base;
540         entity_t         *declarations_begin;
541         entity_t         *declarations_end;
542 };
543
544 struct if_statement_t {
545         statement_base_t  base;
546         expression_t     *condition;
547         statement_t      *true_statement;
548         statement_t      *false_statement;
549 };
550
551 struct switch_statement_t {
552         statement_base_t        base;
553         expression_t           *expression;
554         statement_t            *body;
555         case_label_statement_t *first_case, *last_case;  /**< List of all cases, including default. */
556         case_label_statement_t *default_label;           /**< The default label if existent. */
557         unsigned long           default_proj_nr;         /**< The Proj-number for the default Proj. */
558 };
559
560 struct goto_statement_t {
561         statement_base_t  base;
562         label_t          *label;         /**< The destination label. */
563         expression_t     *expression;    /**< The expression for an assigned goto. */
564         goto_statement_t *next;          /**< links all goto statements of a function */
565 };
566
567 struct case_label_statement_t {
568         statement_base_t        base;
569         expression_t           *expression;    /**< The case label expression, NULL for default label. */
570         expression_t           *end_range;     /**< For GNUC case a .. b: the end range expression, NULL else. */
571         case_label_statement_t *next;          /**< link to the next case label in switch */
572         statement_t            *statement;
573         long                   first_case;     /**< The folded value of expression. */
574         long                   last_case;      /**< The folded value of end_range. */
575         bool                   is_bad;         /**< If set marked as bad to suppress warnings. */
576         bool                   is_empty_range; /**< If set marked this as an empty range. */
577 };
578
579 struct label_statement_t {
580         statement_base_t   base;
581         label_t           *label;
582         statement_t       *statement;
583         label_statement_t *next;    /**< links all label statements of a function */
584 };
585
586 struct expression_statement_t {
587         statement_base_t  base;
588         expression_t     *expression;
589 };
590
591 struct while_statement_t {
592         statement_base_t  base;
593         expression_t     *condition;
594         statement_t      *body;
595 };
596
597 struct do_while_statement_t {
598         statement_base_t  base;
599         expression_t     *condition;
600         statement_t      *body;
601 };
602
603 struct for_statement_t {
604         statement_base_t  base;
605         expression_t     *initialisation;
606         expression_t     *condition;
607         expression_t     *step;
608         statement_t      *body;
609         scope_t           scope;
610         bool              condition_reachable:1;
611         bool              step_reachable:1;
612 };
613
614 struct asm_argument_t {
615         string_t        constraints;
616         expression_t   *expression;
617         symbol_t       *symbol;
618         asm_argument_t *next;
619 };
620
621 struct asm_clobber_t {
622         string_t       clobber;
623         asm_clobber_t *next;
624 };
625
626 struct asm_statement_t {
627         statement_base_t base;
628         string_t         asm_text;
629         asm_argument_t  *inputs;
630         asm_argument_t  *outputs;
631         asm_clobber_t   *clobbers;
632         bool             is_volatile;
633 };
634
635 struct ms_try_statement_t {
636         statement_base_t  base;
637         statement_t      *try_statement;
638         expression_t     *except_expression; /**< non-null for except, NULL for finally */
639         statement_t      *final_statement;
640 };
641
642 struct leave_statement_t {
643         statement_base_t  base;
644 };
645
646 union statement_t {
647         statement_kind_t         kind;
648         statement_base_t         base;
649         return_statement_t       returns;
650         compound_statement_t     compound;
651         declaration_statement_t  declaration;
652         if_statement_t           ifs;
653         switch_statement_t       switchs;
654         goto_statement_t         gotos;
655         case_label_statement_t   case_label;
656         label_statement_t        label;
657         expression_statement_t   expression;
658         while_statement_t        whiles;
659         do_while_statement_t     do_while;
660         for_statement_t          fors;
661         asm_statement_t          asms;
662         ms_try_statement_t       ms_try;
663         leave_statement_t        leave;
664 };
665
666 struct translation_unit_t {
667         scope_t      scope;
668         statement_t *global_asm;
669 };
670
671 static inline void *_allocate_ast(size_t size)
672 {
673         return obstack_alloc(&ast_obstack, size);
674 }
675
676 static inline bool is_invalid_expression(expression_t *expression)
677 {
678         return expression->base.kind == EXPR_INVALID;
679 }
680
681 static inline bool is_invalid_statement(statement_t *statement)
682 {
683         return statement->base.kind == STATEMENT_INVALID;
684 }
685
686 #define allocate_ast(size)                 _allocate_ast(size)
687
688 /**
689  * Allocate an AST node with given size and
690  * initialize all fields with zero.
691  */
692 static inline void *allocate_ast_zero(size_t size)
693 {
694         void *res = allocate_ast(size);
695         memset(res, 0, size);
696         return res;
697 }
698
699 #endif