static tree start_cdtor (int method_type) { tree fnname = get_file_function_name (method_type); tree void_list_node_1 = build_tree_list (NULL_TREE, void_type_node); tree body; start_function (void_list_node_1, build_nt (CALL_EXPR, fnname, tree_cons (NULL_TREE, NULL_TREE, void_list_node_1), NULL_TREE), NULL_TREE); store_parm_decls (); current_function_cannot_inline = "static constructors and destructors cannot be inlined"; body = c_begin_compound_stmt (); pushlevel (0); clear_last_expr (); add_scope_stmt (/*begin_p=*/1, /*partial_p=*/0); return body; }
tree add_stmt (tree t) { if (input_filename != last_expr_filename) { /* If the filename has changed, also add in a FILE_STMT. Do a string compare first, though, as it might be an equivalent string. */ int add = (strcmp (input_filename, last_expr_filename) != 0); last_expr_filename = input_filename; if (add) { tree pos = build_nt (FILE_STMT, get_identifier (input_filename)); add_stmt (pos); } } /* Add T to the statement-tree. */ TREE_CHAIN (last_tree) = t; last_tree = t; /* When we expand a statement-tree, we must know whether or not the statements are full-expressions. We record that fact here. */ STMT_IS_FULL_EXPR_P (last_tree) = stmts_are_full_exprs_p (); return t; }
void begin_stmt_tree (tree *t) { /* We create a trivial EXPR_STMT so that last_tree is never NULL in what follows. We remove the extraneous statement in finish_stmt_tree. */ *t = build_nt (EXPR_STMT, void_zero_node); last_tree = *t; last_expr_type = NULL_TREE; last_expr_filename = input_filename; }
static void finish_handler_array () { tree decl = current_handler->handler_array_decl; tree t; tree handler_array_init = NULL_TREE; int handlers_count = 1; int nelts; /* Build the table mapping exceptions to handler(-number)s. This is done in reverse order. */ /* First push the end of the list. This is either the ELSE handler (current_handler->else_handler>0) or NULL handler to indicate the end of the list (if current_handler->else-handler == 0). The following works either way. */ handler_array_init = build_tree_list (NULL_TREE, chill_expand_tuple (handler_element_type, build_nt (CONSTRUCTOR, NULL_TREE, tree_cons (NULL_TREE, null_pointer_node, build_tree_list (NULL_TREE, build_int_2 (current_handler->else_handler, 0)))))); for (t = current_handler->on_alt_list; t != NULL_TREE; t = TREE_CHAIN (t)) { tree handler_number = TREE_PURPOSE(t); tree elist = TREE_VALUE (t); for ( ; elist != NULL_TREE; elist = TREE_CHAIN (elist)) { tree ex_decl = build_chill_exception_decl (IDENTIFIER_POINTER(TREE_VALUE(elist))); tree ex_addr = build1 (ADDR_EXPR, char_pointer_type_for_handler, ex_decl); tree el = build_nt (CONSTRUCTOR, NULL_TREE, tree_cons (NULL_TREE, ex_addr, build_tree_list (NULL_TREE, handler_number))); mark_addressable (ex_decl); TREE_CONSTANT (ex_addr) = 1; handler_array_init = tree_cons (NULL_TREE, chill_expand_tuple (handler_element_type, el), handler_array_init); handlers_count++; } } #if 1 nelts = list_length (handler_array_init); TYPE_DOMAIN (TREE_TYPE (decl)) = build_index_type (build_int_2 (nelts - 1, - (nelts == 0))); layout_type (TREE_TYPE (decl)); DECL_INITIAL (decl) = convert (TREE_TYPE (decl), build_nt (CONSTRUCTOR, NULL_TREE, handler_array_init)); /* Pop back to the obstack that is current for this binding level. This is because MAXINDEX, rtl, etc. to be made below must go in the permanent obstack. But don't discard the temporary data yet. */ pop_obstacks (); layout_decl (decl, 0); /* To prevent make_decl_rtl (called indiectly by rest_of_decl_compilation) throwing the existing RTL (which has already been used). */ PUT_MODE (DECL_RTL (decl), DECL_MODE (decl)); rest_of_decl_compilation (decl, (char*)0, 0, 0); expand_decl_init (decl); #else /* To prevent make_decl_rtl (called indirectly by finish_decl) altering the existing RTL. */ GET_MODE (DECL_RTL (current_handler->handler_array_decl)) = DECL_MODE (current_handler->handler_array_decl); finish_decl (current_handler->handler_array_decl, build_nt (CONSTRUCTOR, NULL_TREE, handler_array_init), NULL_TREE); #endif }