diff options
author | Mark Mitchell <mark@codesourcery.com> | 2000-09-07 01:36:11 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 2000-09-07 01:36:11 +0000 |
commit | ae499ccea4f2eee460c8612d920755773cacfe47 (patch) | |
tree | 1ae8ce0d3f4f58cfa7b33b9fac7c1209e34d27a7 /gcc/c-decl.c | |
parent | 4f4b88d0832c7279722b5dee73d9ce9f1704452f (diff) | |
download | gcc-ae499ccea4f2eee460c8612d920755773cacfe47.zip gcc-ae499ccea4f2eee460c8612d920755773cacfe47.tar.gz gcc-ae499ccea4f2eee460c8612d920755773cacfe47.tar.bz2 |
Move statement-tree facilities from C++ to C front-end.
* c-common.h (c_tree_index): Add CTI_VOID_ZERO.
(void_zero_node): New macro.
(struct stmt_tree_s): New type.
(stmt_tree): New typedef.
(struct language_function): New type.
(last_tree): New macro.
(last_expr_type): Likewise.
(walk_tree_fn): New typedef.
(current_stmt_tree): New function.
(begin_stmt_tree): Likewise.
(add_stmt): Likewise.
(finish_stmt_tree): Likewise.
(statement_code_p): Likewise.
(lang_statement_code_p): New variable.
(walk_stmt_tree): New function.
(STMT_IS_FULL_EXPR_P): New macro.
* c-common.c (lang_statement_code_p): New variable.
(c_common_nodes_and_builtins): Initialize void_zero_node.
(statement_code_p): New function.
(walk_stmt_tree): Likewise.
* c-decl.c (language_function): Rename to ...
(c_language_function): ... this. Include language_function.
(push_c_function_context): Adjust accordingly.
(pop_c_function_context): Likewise.
(mark_c_function_context): Likewise.
(current_stmt_tree): Define.
* c-semantics.c (begin_stmt_tree): New function.
(add_stmt): Likewise.
(prune_unused_decls): Likewise.
(finish_stmt_tree): Likewise.
Move statement-tree facilities from C++ to C front-end.
* cp-tree.h (cp_tree_index): Remove CPTI_VOID_ZERO.
(void_zero_node): Remove.
(stmt_tree): Likewise.
(scope_chain): Adjust.
(language_function): Rename to cp_language_function.
(cp_function_chain): Adjust.
(current_stmt_tree): Remove.
(last_tree): Likewise.
(last_expr_type): Likewise.
(struct lang_decl): Adjust.
(STMT_IS_FULL_EXPR_P): Remove.
(add_tree): Remove.
(begin_stmt_tree): Likewise.
(finish_stmt_tree): Likewise.
(walk_tree_fn): Likewise.
(walk_stmt_tree): Likewise.
* class.c (finish_struct): Replace use of add_tree with add_stmt.
* decl.c (mark_stmt_tree): Adjust type.
(init_decl_processing): Don't build void_zero_node.
(initialize_local_var): Adjust usage of current_stmt_tree.
(finish_enum): Use add_stmt, not add_tree.
(save_function_data): Adjust use of language_function.
(finish_constructor_body): Use add_stmt, not add_tree.
(finish_destructor_body): Likewise.
(push_cp_function_context): Adjust use of language_function.
(pop_cp_function_context): Likewise.
(mark_lang_function): Likewise.
(mark_cp_function_context): Likewise.
* init.c (build_aggr_init): Adjust use of current_stmt_tree.
(build_vec_init): Likewise.
* semantics.c (SET_LAST_STMT): Remove.
(RECHAIN_STMTS): Don't use it.
(stmts_are_full_exprs_p): Adjust use of current_stmt_tree.
(current_stmt_tree): Define.
(add_tree): Remove.
(finish_goto_stmt): Use add_stmt, not add_tree.
(finish_expr_stmt): Likewise.
(begin_if_stmt): Likewise.
(finish_then_clause): Likewise.
(begin_while_stmt): Likewise.
(begin_do_stmt): Likewise.
(finish_return_stmt): Likewise.
(begin_for_stmt): Likewise.
(finish_break_stmt): Likewise.
(finish_continue_stmt): Likewise.
(begin_switch_stmt): Likewise.
(finish_case_label): Likewise.
(begin_try_block): Likewise.
(begin_function_try_block): Likewise.
(begin_handler): Likewise.
(begin_catch_block): Likewise.
(begin_compound_stmt): Likewise.
(begin_asm_stmt): Likewise.
(finish_asm_stmt): Likewise.
(finish_label_stmt): Likewise.
(add_decl_stmt): Likewise.
(finish_subobject): Likewise.
(finish_decl_cleanup): Likewise.
(finish_named_return_value): Likewise.
(setup_vtbl_ptr): Likewise.
(add_scope_stmt): Likewise.
(finish_stmt_expr): Likewise.
(prune_unused_decls): Remove.
(begin_stmt_tree): Likewise.
(finish_stmt_tree): Likewise.
(prep_stmt): Adjust use of current_stmt_tree.
(lang_expand_stmt): Likewise.
* tree.c (statement_code_p): Remove.
(cp_statement_code_p): New function.
(walk_stmt_tree): Remove.
(init_tree): Set lang_statement_code_p.
From-SVN: r36221
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r-- | gcc/c-decl.c | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c index af9428b..a5dc3d6 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -6761,8 +6761,9 @@ finish_function (nested) that keep track of the progress of compilation of the current function. Used for nested functions. */ -struct language_function +struct c_language_function { + struct language_function base; tree named_labels; tree shadowed_labels; int returns_value; @@ -6779,9 +6780,10 @@ void push_c_function_context (f) struct function *f; { - struct language_function *p; - p = (struct language_function *) xmalloc (sizeof (struct language_function)); - f->language = p; + struct c_language_function *p; + p = ((struct c_language_function *) + xmalloc (sizeof (struct c_language_function))); + f->language = (struct language_function *) p; p->named_labels = named_labels; p->shadowed_labels = shadowed_labels; @@ -6798,7 +6800,8 @@ void pop_c_function_context (f) struct function *f; { - struct language_function *p = f->language; + struct c_language_function *p + = (struct c_language_function *) f->language; tree link; /* Bring back all the labels that were shadowed. */ @@ -6834,7 +6837,8 @@ void mark_c_function_context (f) struct function *f; { - struct language_function *p = f->language; + struct c_language_function *p + = (struct c_language_function *) f->language; if (p == 0) return; @@ -6899,6 +6903,16 @@ stmts_are_full_exprs_p () return 0; } +/* Returns the stmt_tree (if any) to which statements are currently + being added. If there is no active statement-tree, NULL is + returned. */ + +stmt_tree +current_stmt_tree () +{ + return cfun ? &cfun->language->x_stmt_tree : NULL; +} + /* Nonzero if TYPE is an anonymous union or struct type. Always 0 in C. */ |