-typedef struct ast_value_s ast_value;
-typedef struct ast_function_s ast_function;
-typedef struct ast_block_s ast_block;
-typedef struct ast_binary_s ast_binary;
-typedef struct ast_store_s ast_store;
-typedef struct ast_entfield_s ast_entfield;
-typedef struct ast_ifthen_s ast_ifthen;
-typedef struct ast_ternary_s ast_ternary;
-typedef struct ast_loop_s ast_loop;
+ /* Several coverage options
+ * AST_FLAG_COVERAGE means there was an explicit [[coverage]] attribute,
+ * which will overwrite the default set via the commandline switches.
+ * BLOCK_COVERAGE inserts coverage() calls into every basic block.
+ * In the future there might be more options like tracking variable access
+ * by creating get/set wrapper functions.
+ */
+ AST_FLAG_COVERAGE = 1 << 12,
+ AST_FLAG_BLOCK_COVERAGE = 1 << 13,
+
+ AST_FLAG_LAST,
+ AST_FLAG_TYPE_MASK = (AST_FLAG_VARIADIC | AST_FLAG_NORETURN),
+ AST_FLAG_COVERAGE_MASK = (AST_FLAG_BLOCK_COVERAGE)
+};
+
+enum {
+ TYPE_ast_node, /* 0 */
+ TYPE_ast_expression, /* 1 */
+ TYPE_ast_value, /* 2 */
+ TYPE_ast_function, /* 3 */
+ TYPE_ast_block, /* 4 */
+ TYPE_ast_binary, /* 5 */
+ TYPE_ast_store, /* 6 */
+ TYPE_ast_binstore, /* 7 */
+ TYPE_ast_entfield, /* 8 */
+ TYPE_ast_ifthen, /* 9 */
+ TYPE_ast_ternary, /* 10 */
+ TYPE_ast_loop, /* 11 */
+ TYPE_ast_call, /* 12 */
+ TYPE_ast_unary, /* 13 */
+ TYPE_ast_return, /* 14 */
+ TYPE_ast_member, /* 15 */
+ TYPE_ast_array_index, /* 16 */
+ TYPE_ast_breakcont, /* 17 */
+ TYPE_ast_switch, /* 18 */
+ TYPE_ast_label, /* 19 */
+ TYPE_ast_goto, /* 20 */
+ TYPE_ast_argpipe, /* 21 */
+ TYPE_ast_state /* 22 */
+};
+
+#define ast_istype(x, t) ( ((ast_node*)x)->node_type == (TYPE_##t) )
+#define ast_ctx(node) (((ast_node*)(node))->context)
+#define ast_side_effects(node) (((ast_node*)(node))->side_effects)