gcc/gcc/cp/semantics.c

3009 lines
82 KiB
C
Raw Normal View History

/* Perform the semantic phase of parsing, i.e., the process of
building tree structure, checking semantic consistency, and
building RTL. These routines are used both during actual parsing
and during the instantiation of template functions.
Change base class access representation. * tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED, TREE_VIA_PRIVATE): Remove. (BINFO_BASEACCESSES): New binfo elt. (BINFO_BASEACCESS): New accessor. (BINFO_ELTS): Increase. (TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New. (access_public_node, access_protected_node, access_private_node): New global nodes. * tree.c (build_common_tree_nodes_2): Initialize access nodes. * dbxout.c (dbxout_type): Adjust. * dwarf2out.c (gen_inheritance_die): Add access parameter. (gen_member_die): Adjust. * dwarfout.c (output_inheritance_die): ARG is array of two trees. (output_type): Adjust. * tree-dump.c (dequeue_and_dump): Adjust binfo dumping. Change base class access representation. Share virtual base binfos. * cp/call.c (build_special_member_call): Remove binfo_for_vbase call. * cp/class.c (build_base_path): Likewise. (build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use. (build_secondary_vtable): Remove FOR_TYPE arg. Adjust. (make_new_vtable): Adjust. (force_canonical_binfo_r): Delete. (force_canonical_binfo): Delete. (mark_primary_virtual_base): Delete. (dfs_unshared_virtual_bases): Delete. (mark_primary_bases): Adjust. (maybe_warn_about_overly_private_class): Adjust. (dfs_base_derived_from): Delete. (base_derived_from): Follow the inheritance chain. (struct find_final_overrider_data): Add vpath member. (dfs_find_final_overrider): Adjust. (dfs_find_final_overrider_q, dfs_find_final_overrider_post): New. (find_final_overrider): Adjust. (update_vtable_entry_for_fn): Adjust. (modify_all_vtables): Adjust. (walk_subobject_offsets): Adjust. (layout_nonempty_base_or_field): Adjust. (layout_empty_base): Remove last parameter. Adjust. (build_base_field): Adjust. (build_base_fields): Adjust. (propagate_binfo_offsets): Remove last parameter. Adjust. (dfs_set_offset_for_unshared_vbases): Delete. (layout_virtual_bases): Adjust. (finish_struct_1): Adjust. (init_class_processing): Don't init access nodes. (dfs_get_primary_binfo): Delete. (get_primary_binfo): Adjust. (dump_class_hierarchy_r): Remove most derived arg, add IGO parameter. Adjust. (dump_class_hierarchy): Adjust. (finish_vtbls): Adjust. (get_original_base): Delete. (build_vtt_inits): Adjust. (dfs_build_secondary_vptr_vtt_inits): Adjust. (dfs_ctor_vtable_bases_queue_p): Adjust. (build_ctor_vtbl_group): Adjust. (dfs_accumulate_vtbl_inits): Adjust. (build_vtbl_initializer): Adjust. (build_vbase_offset_vtbl_entries): Adjust. (add_vcall_offset_vtbl_entries_1): Adjust. * cp/cp-tree.h (CPTI_ACCESS_*): Remove. (access_*_node): Remove. (CANONICAL_BINFO): Delete. (BINFO_UNSHARED_MARKED): Remove. (BINFO_MARKED): Set LANG_FLAG_0 directly. (SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete. (BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly. (SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED): Delete. (BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly. (SET_BINFO_NEW_VTABLE_MARKED): Adjust. (SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED): Delete. (BINFO_DEPENDENT_BASE_P): New. (dfs_walk, dfs_walk_real): Queue function takes derived binfo and index. (markedp, unmarkedp): Adjust. (dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p, dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp, find_vbase_instance, binfo_for_vbase): Delete. (copied_binfo, original_binfo): Declare. (finish_base_specifier): Add virtual_p arg. (unshare_base_binfos): Delete. (copy_base_binfos): Declare. (reverse_path): Delete. * cp/decl.c (xref_basetypes): Access and virtuality passed differently. Don't copy direct base binfos here. Call copy_base_binfos. * cp/init.c (dfs_initialize_vtbl_ptrs): Adjust. (initialize_vtbl_ptrs): Adjust. (expand_member_init): Adjust. * cp/parser.c (cp_parser_base_specifier): Adjust. * cp/pt.c (instantiate_class_template): Adjust. (get_template_base_recursive): Adjust. * cp/rtti.c (get_pseudo_ti_init): Adjust. (get_pseudo_ti_desc): Adjust. * cp/tree.c (unshare_base_binfos): Rename to ... (copy_base_binfos): ... here, reimplement. (make_binfo): Set BINFO_DEPENDENT_BASE_P. (reverse_path): Remove. * cp/typeck.c (get_delta_difference): Adjust error messages. * cp/semantics.c (finish_base_specifier): Add virtual arg, adjust. * cp/search.c (lookup_base_r): Adjust. (dynamic_cast_base_recurse): Adjust. (canonical_binfo): Remove. (dfs_canonical_queue): Remove. (dfs_assert_unmarked_p): Remove. (assert_canonical_unmarked): Remove. (shared_marked_p, shared_unmarked_p): Remove. (BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE. (dfs_access_in_type): Adjust. (access_in_type): Adjust. (dfs_accessible_queue_p): Adjust. (dfs_accessible_p): Adjust. (is_subobject_of_p_1, is_subobject_of_p): Remove. (struct lookup_field_info): Remove from_dep_base_p field. (lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P. (lookup_field_r): Remove dependent base code. (lookup_member): Likewise. (dfs_walk, dfs_walk_real): Add access arg to queue fn. (dfs_unmarked_real_bases_queue_p): Remove. (dfs_marked_real_bases_queue_p): Remove. (dfs_skip_vbases): Remove. (dfs_get_pure_virtuals): Adjust. (markedp, unmarkedp): Adjust. (marked_vtable_pathp, unmarked_vtable_pathp): Remove. (marked_pushdecls_p, unmarked_pushdecls_p): Adjust. (dfs_unmark): Adjust. (dfs_get_vbase_types):Remove. (dfs_build_inheritance_graph_order): Remove. (get_vbase_types): Remove (dfs_find_vbase_instance): Remove. (find_vbase_instance): Remove. (dfs_debug_unmarkedp): Adjust. (dependent_base_p): Remove. (dfs_push_type_decls): Adjust. (dfs_push_decls): Adjust. (dfs_no_overlap_yet): Adjust. (copied_binfo): New function. (original_binfo): New function. (binfo_for_vbase): Remove. Change base class access representation. * java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC. (add_interface_do): Likewise. From-SVN: r63172
2003-02-20 18:51:46 +01:00
Copyright (C) 1998, 1999, 2000, 2001, 2002,
2003 Free Software Foundation, Inc.
Written by Mark Mitchell (mmitchell@usa.net) based on code found
formerly in parse.y and pt.c.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GCC is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "tm.h"
#include "tree.h"
#include "cp-tree.h"
Make-lang.in (cp/decl.o, cp/tree.o): Depend on tree-inline.h. * Make-lang.in (cp/decl.o, cp/tree.o): Depend on tree-inline.h. (cp/pt.o, cp/semantics.o, cp/optimize.o): Likewise. * cp-tree.h (lang_decl): Moved inlined_fns to tree_decl. (TREE_READONLY_DECL_P, DECL_INLINED_FNS): Moved to ../tree.h. (flag_inline_trees): Moved declaration to ../tree-inline.h. (walk_tree): Moved declaration to ../tree-inline.h. (walk_tree_without_duplicates, copy_tree_r): Likewise. (remap_save_expr): Likewise. * decl.c: Include tree-inline.h. (lang_mark_tree): Don't mark inlined_fns. * decl2.c (flag_inline_trees): Moved defn to ../tree-inline.c. * optimize.c: Include tree-inline.h. (optimize_inline_calls): Move declaration to ../tree.h, as non-static. (remap_decl): Use language-independent constructs and hooks. (remap_block, copy_body_r, declare_return_variable): Likewise. (inlinable_function_p): Likewise. Don't test for DECL_LANG_SPECIFIC before DECL_INLINED_FNS as inlined_fns is no longer language-specific. (optimize_inline_calls): Likewise. Make it non-static. Moved call of dump_function to... (optimize_function): Here... (clone_body): New function, extracted from... (maybe_clone_body): ... here. Build decl_map locally and pass it on to clone_body. * pt.c, semantics.c: Include tree-inline.h. * tree.c: Likewise. (cp_walk_subtrees): New language-specific hook for tree inlining. (cp_cannot_inline_tree_fn, cp_add_pending_fn_decls, cp_is_overload_p, cp_auto_var_in_fn_p, cp_copy_res_decl_for_inlining): Likewise. (walk_tree): Move language-specific constructs into... (cp_walk_subtrees): this new function. (copy_tree_r): Use language-independent constructs and hooks. (init_tree): Initialize tree inlining hooks. (remap_save_expr): Adjust prototype so that the declaration does not require the definition of splay_tree. From-SVN: r46020
2001-10-05 04:48:47 +02:00
#include "tree-inline.h"
#include "except.h"
#include "lex.h"
#include "toplev.h"
#include "flags.h"
#include "rtl.h"
#include "expr.h"
#include "output.h"
#include "timevar.h"
Makefile.in (toplev.o, [...]): Don't depend on dwarfout.h. * Makefile.in (toplev.o, dwarfout.o, final.o): Don't depend on dwarfout.h. * dbxout.c (dbxout_function): Rename dbxout_funciton_decl, move to conditionally compiled block. (dbx_debug_hooks, xcoff_debug_hooks): Update. * dbxout.h (dbxout_function): Remove. * debug.c (do_nothing_debug_hooks): Update. * debug.h (struct gcc_debug_hooks): New hooks function_decl, global_decl, deferred_inline_function. * dwarf2out.c (dwarf2_debug_hooks): Update. (dwarf2out_global_decl): New. * dwarfout.c: Don't include dwarfout.h. (dwarfout_global_decl, dwarfout_function_decl, dwarfout_deferred_inline_function): New. (dwarf_debug_hooks): Update. * dwarfout.h: Remove. * final.c: Don't include dwarfout.h. * sdbout.c (sdbout_global_decl): New. (sdbout_debug_hooks): Update. * toplev.c: Don't include dwarfout.h. (check_global_declarations, rest_of_compilation): Use new debug hooks. (note_deferral_of_defined_inline_function): Remove. * toplev.h (note_deferral_of_defined_inline_function): Remove. * ch/Makefile.in (lex.o): No dependence on dwarfout.h. * ch/lex.c: Don't include dwarfout.h. * cp/Make-lang.in (decl2.o): No dependence on dwarfout.h, dwarf2out.h. (semantics.o, optimize.o): Depend on debug.h not dwarfout.h. * cp/decl2.c: Don't include dwarfout.h and dwarf2out.h. * cp/optimize.c: Include debug.h. (maybe_clone_body): Use debug hook. * cp/semantics.c: Include debug.h. (expand_body): Use debug hook. * po/POTFILES.in: Remove dwarfout.h. From-SVN: r44145
2001-07-19 08:22:04 +02:00
#include "debug.h"
#include "cgraph.h"
/* There routines provide a modular interface to perform many parsing
operations. They may therefore be used during actual parsing, or
during template instantiation, which may be regarded as a
degenerate form of parsing. Since the current g++ parser is
lacking in several respects, and will be reimplemented, we are
attempting to move most code that is not directly related to
parsing into this file; that will make implementing the new parser
much easier since it will be able to make use of these routines. */
static tree maybe_convert_cond (tree);
static tree simplify_aggr_init_exprs_r (tree *, int *, void *);
static void emit_associated_thunks (tree);
static void genrtl_try_block (tree);
static void genrtl_eh_spec_block (tree);
static void genrtl_handler (tree);
static void cp_expand_stmt (tree);
tree-optimize.c: New file. gcc/ * tree-optimize.c: New file. * Makefile.in (OBJS-archive): Add tree-optimize.o. (tree-optimize.o): New. * c-decl.c (store_parm_decls): Use allocate_struct_function. (finish_function): Don't free_after_parsing or free_after_compilation. (set_save_expr_context): Move to tree-optimize.c. (c_expand_body_1): Use tree_rest_of_compilation. * c-lang.c (LANG_HOOKS_RTL_EXPAND_STMT): New. * objc/objc-lang.c (LANG_HOOKS_RTL_EXPAND_STMT): New. * c-objc-common.c (expand_deferred_fns): Don't emit unused inlines; iterate until closure. * langhooks-def.h (LANG_HOOKS_RTL_EXPAND_START, LANG_HOOKS_RTL_EXPAND_STMT, LANG_HOOKS_RTL_EXPAND_END): New. (LANG_HOOKS_RTL_EXPAND_INITIALIZER): New. * langhooks.h (struct lang_hooks_for_rtl_expansion): New. * toplev.h (tree_rest_of_compilation): Declare it. gcc/cp/ * cp-lang.c (LANG_HOOKS_RTL_EXPAND_START): New. (LANG_HOOKS_RTL_EXPAND_STMT): New. * cp-tree.h (cxx_expand_function_start): Declare. * decl.c (start_function): Use allocate_struct_function. Move stmts_are_full_exprs_p assertion from expand_body. Do not free_after_parsing or free_after_compilation. (cxx_push_function_context): Move code to set struct function data from genrtl_start_function. * optimize.c (optimize_function): Don't inc/dec function_depth. * semantics.c (expand_body): Use tree_rest_of_compilation. (cxx_expand_function_start): Rename from genrtl_start_function, omit bits done by tree_rest_of_compilation. (genrtl_finish_function): Remove. (clear_decl_rtl): Move to ../tree-optimize.c. Co-Authored-By: Jason Merrill <jason@redhat.com> From-SVN: r70933
2003-08-30 01:21:13 +02:00
cp-tree.def (STMT_EXPR): New tree node. * cp-tree.def (STMT_EXPR): New tree node. * cp-tree.h (STMT_EXPR_STMT): New macro. (store_return_init): Change prototype. (finish_named_return_value): New function. (expand_stmt): Likewise. (expand_body): Likewise. (begin_stmt_tree): Likewise. (finish_stmt_tree): Likewise. (expanding_p): New variable. (last_expr_type): Likewise. (building_stmt_tree): New macro. * decl.c (start_function): Use building_stmt_tree, not processing_template_decl, where appropriate. (store_parm_decls): Likewise. (store_return_init): Move most of the body to semantics.c. (finish_function): Use building_stmt_tree. (finish_stmt): Clear last_expr_type here. (cp_function): Add expanding_p, last_tree, last_expr_type. (push_cp_function_context): Save them. (pop_cp_function_context): Restore them. * decl2.c (setup_vtbl_ptr): Move to semantics.c. * error.c (dump_expr): Handle STMT_EXPR. * except.c (expand_start_catch_block): Use building_stmt_tree. Use add_decl_stmt. * expr.c (cplus_expand_expr): Handle STMT_EXPR. (do_case): Move add_tree call to semantics.c. * parse.y (return_init): Use finish_named_return_value. (for.init.statement): Use finish_expr_stmt. * parse.c: Regenerated. * pt.c (do_pushlevel): Move to semantics.c. (do_poplevel): Likewise. (tsubst_copy): Handle STMT_EXPR instead of BIND_EXPR. (tsubst_expr): Don't expand all the way to RTL here. Handle RETURN_INIT and CTOR_INITIALIZER. (instantiate_decl): Call expand_body after tsubst'ing into DECL_SAVED_TREE. * semantics.c (expand_stmts): New function. (expanding_p): New variable. (last_expr_type): Likewise. (finish_expr_stmt): Use building_stmt_tree. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (fnish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_for_stmt): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (finish_switch_cond): Likewise. (finish_switch_stmt): Likewise. (finish_case_label): Call add_tree here if necessary. (finish_goto_statement): Use building_stmt_tree. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_named_return_value): New function. (setup_vtbl_ptr): Moved here from decl2.c. (do_pushlevel): Moved here from pt.c. (do_poplevel): Likewise. (begin_stmt_expr): Use building_stmt_tree. (finish_stmt_expr): Likewise. Build a STMT_EXPR, not a BIND_EXPR, when building_stmt_tree. (begin_stmt_tree): New function. (finish_stmt_tree): Likewise. (expand_stmt): Likewise. (expand_body): Likewise. * tree.c (build_cplus_method_type): Make sure the argument types end up on the same obstack as the METHOD_TYPE. (search_tree): Handle COMPOUND_EXPR, MODIFY_EXPR, THROW_EXPR, STMT_EXPR. (mapcar): Break out common cases. Handle COMPOUND_EXPR, MODIFY_EXPR, THROW_EXPR, STMT_EXPR, RTL_EXPR. Abort, rather than sorry, if an unsupported node is encountered. * typeck.c (require_complete_type_in_void): Handle BIND_EXPR. (c_expand_return): Don't call add_tree here. From-SVN: r28729
1999-08-16 21:01:36 +02:00
/* Finish processing the COND, the SUBSTMT condition for STMT. */
#define FINISH_COND(COND, STMT, SUBSTMT) \
do { \
if (last_tree != (STMT)) \
{ \
RECHAIN_STMTS (STMT, SUBSTMT); \
if (!processing_template_decl) \
{ \
(COND) = build_tree_list (SUBSTMT, COND); \
(SUBSTMT) = (COND); \
} \
} \
else \
(SUBSTMT) = (COND); \
} while (0)
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
/* Deferred Access Checking Overview
---------------------------------
Most C++ expressions and declarations require access checking
to be performed during parsing. However, in several cases,
this has to be treated differently.
For member declarations, access checking has to be deferred
until more information about the declaration is known. For
example:
class A {
typedef int X;
public:
X f();
};
A::X A::f();
A::X g();
When we are parsing the function return type `A::X', we don't
really know if this is allowed until we parse the function name.
Furthermore, some contexts require that access checking is
never performed at all. These include class heads, and template
instantiations.
Typical use of access checking functions is described here:
1. When we enter a context that requires certain access checking
mode, the function `push_deferring_access_checks' is called with
DEFERRING argument specifying the desired mode. Access checking
may be performed immediately (dk_no_deferred), deferred
(dk_deferred), or not performed (dk_no_check).
2. When a declaration such as a type, or a variable, is encountered,
the function `perform_or_defer_access_check' is called. It
maintains a TREE_LIST of all deferred checks.
3. The global `current_class_type' or `current_function_decl' is then
setup by the parser. `enforce_access' relies on these information
to check access.
4. Upon exiting the context mentioned in step 1,
`perform_deferred_access_checks' is called to check all declaration
stored in the TREE_LIST. `pop_deferring_access_checks' is then
called to restore the previous access checking mode.
In case of parsing error, we simply call `pop_deferring_access_checks'
without `perform_deferred_access_checks'. */
config-lang.in: Add semantics.c to gtfiles. * config-lang.in: Add semantics.c to gtfiles. * cp-tree.h (flagged_type_tree_s): Remove lookups field. (saved_scope): Likewise. (type_lookups): Remove. (deferred_access): New structure. (type_access_control): Remove. (save_type_access_control): Likewise. (reset_type_access_control): Likewise. (decl_type_access_control): Likewise. (push_deferring_access_checks): Declare. (resume_deferring_access_checks): Likewise. (stop_deferring_access_checks): Likewise. (pop_deferring_access_checks): Likewise. (get_deferred_access_checks): Likewise. (pop_to_parent_deferring_access_checks): Likewise. (perform_deferred_access_checks): Likewise. (perform_or_defer_access_check): Likewise. * decl.c (make_typename_type): Use perform_or_defer_access_check. (make_unbound_class_template): Likewise. (grokdeclarator): Don't call decl_type_access_control. * parser.c (cp_parser_context): Remove deferred_access_checks and deferring_access_checks_p fields. (cp_parser_context_new): Adjust. (cp_parser): Remove access_checks_lists. (cp_parser_defer_access_check): Remove. (cp_parser_start_deferring_access_checks): Remove. (cp_parser_stop_deferring_access_checks): Remove. (cp_parser_perform_deferred_access_checks): Remove. (cp_parser_nested_name_specifier_opt): Use new deferred access functions. (cp_parser_simple_declaration): Likewise. (cp_parser_template_id): Likewise. (cp_parser_function_definition): Likewise. (cp_parser_class_specifier): Likewise. (cp_parser_lookup_name): Likewise. (cp_parser_single_declaration): Likewise. (cp_parser_pre_parsed_nested_name_specifier): Likewise. (cp_parser_parse_tentatively): Likewise. (cp_parser_parse_definitely): Likewise. (yyparse): Likewise. (cp_parser_init_declarator): Remove access_checks parameter. Use new deferred access functions. (cp_parser_function_definition_from_specifiers_and_declarator): Likewise. (cp_parser_class_head): Remove deferring_access_checks_p and saved_access_checks parameters. Use new deferred access functions. (cp_parser_member_specification_opt): Don't call reset_type_access_control. * search.c (type_access_control): Remove. * semantics.c: Include "gt-cp-semantics.h". (deferred_type_access_control): Remove. (deferred_access_stack): New variable. (deferred_access_free_list): Likewise. (push_deferring_access_checks): New function. (resume_deferring_access_checks): Likewise. (stop_deferring_access_checks): Likewise. (pop_deferring_access_checks): Likewise. (get_deferred_access_checks): Likewise. (pop_to_parent_deferring_access_checks): Likewise. (perform_deferred_access_checks): New function, adapted from cp_parser_perform_deferred_access_checks. (perform_or_defer_access_check): New function, adapted from cp_parser_defer_access_check. (current_type_lookups): Remove. (deferred_type_access_control): Likewise. (decl_type_access_control): Likewise. (save_type_access_control): Likewise. (reset_type_access_control): Likewise. (begin_function_definition): Adjust. (begin_class_definiton): Likewise. From-SVN: r61283
2003-01-14 14:40:53 +01:00
/* Data for deferred access checking. */
static GTY(()) deferred_access *deferred_access_stack;
static GTY(()) deferred_access *deferred_access_free_list;
/* Save the current deferred access states and start deferred
access checking iff DEFER_P is true. */
void push_deferring_access_checks (deferring_kind deferring)
config-lang.in: Add semantics.c to gtfiles. * config-lang.in: Add semantics.c to gtfiles. * cp-tree.h (flagged_type_tree_s): Remove lookups field. (saved_scope): Likewise. (type_lookups): Remove. (deferred_access): New structure. (type_access_control): Remove. (save_type_access_control): Likewise. (reset_type_access_control): Likewise. (decl_type_access_control): Likewise. (push_deferring_access_checks): Declare. (resume_deferring_access_checks): Likewise. (stop_deferring_access_checks): Likewise. (pop_deferring_access_checks): Likewise. (get_deferred_access_checks): Likewise. (pop_to_parent_deferring_access_checks): Likewise. (perform_deferred_access_checks): Likewise. (perform_or_defer_access_check): Likewise. * decl.c (make_typename_type): Use perform_or_defer_access_check. (make_unbound_class_template): Likewise. (grokdeclarator): Don't call decl_type_access_control. * parser.c (cp_parser_context): Remove deferred_access_checks and deferring_access_checks_p fields. (cp_parser_context_new): Adjust. (cp_parser): Remove access_checks_lists. (cp_parser_defer_access_check): Remove. (cp_parser_start_deferring_access_checks): Remove. (cp_parser_stop_deferring_access_checks): Remove. (cp_parser_perform_deferred_access_checks): Remove. (cp_parser_nested_name_specifier_opt): Use new deferred access functions. (cp_parser_simple_declaration): Likewise. (cp_parser_template_id): Likewise. (cp_parser_function_definition): Likewise. (cp_parser_class_specifier): Likewise. (cp_parser_lookup_name): Likewise. (cp_parser_single_declaration): Likewise. (cp_parser_pre_parsed_nested_name_specifier): Likewise. (cp_parser_parse_tentatively): Likewise. (cp_parser_parse_definitely): Likewise. (yyparse): Likewise. (cp_parser_init_declarator): Remove access_checks parameter. Use new deferred access functions. (cp_parser_function_definition_from_specifiers_and_declarator): Likewise. (cp_parser_class_head): Remove deferring_access_checks_p and saved_access_checks parameters. Use new deferred access functions. (cp_parser_member_specification_opt): Don't call reset_type_access_control. * search.c (type_access_control): Remove. * semantics.c: Include "gt-cp-semantics.h". (deferred_type_access_control): Remove. (deferred_access_stack): New variable. (deferred_access_free_list): Likewise. (push_deferring_access_checks): New function. (resume_deferring_access_checks): Likewise. (stop_deferring_access_checks): Likewise. (pop_deferring_access_checks): Likewise. (get_deferred_access_checks): Likewise. (pop_to_parent_deferring_access_checks): Likewise. (perform_deferred_access_checks): New function, adapted from cp_parser_perform_deferred_access_checks. (perform_or_defer_access_check): New function, adapted from cp_parser_defer_access_check. (current_type_lookups): Remove. (deferred_type_access_control): Likewise. (decl_type_access_control): Likewise. (save_type_access_control): Likewise. (reset_type_access_control): Likewise. (begin_function_definition): Adjust. (begin_class_definiton): Likewise. From-SVN: r61283
2003-01-14 14:40:53 +01:00
{
deferred_access *d;
/* For context like template instantiation, access checking
disabling applies to all nested context. */
if (deferred_access_stack
&& deferred_access_stack->deferring_access_checks_kind == dk_no_check)
deferring = dk_no_check;
config-lang.in: Add semantics.c to gtfiles. * config-lang.in: Add semantics.c to gtfiles. * cp-tree.h (flagged_type_tree_s): Remove lookups field. (saved_scope): Likewise. (type_lookups): Remove. (deferred_access): New structure. (type_access_control): Remove. (save_type_access_control): Likewise. (reset_type_access_control): Likewise. (decl_type_access_control): Likewise. (push_deferring_access_checks): Declare. (resume_deferring_access_checks): Likewise. (stop_deferring_access_checks): Likewise. (pop_deferring_access_checks): Likewise. (get_deferred_access_checks): Likewise. (pop_to_parent_deferring_access_checks): Likewise. (perform_deferred_access_checks): Likewise. (perform_or_defer_access_check): Likewise. * decl.c (make_typename_type): Use perform_or_defer_access_check. (make_unbound_class_template): Likewise. (grokdeclarator): Don't call decl_type_access_control. * parser.c (cp_parser_context): Remove deferred_access_checks and deferring_access_checks_p fields. (cp_parser_context_new): Adjust. (cp_parser): Remove access_checks_lists. (cp_parser_defer_access_check): Remove. (cp_parser_start_deferring_access_checks): Remove. (cp_parser_stop_deferring_access_checks): Remove. (cp_parser_perform_deferred_access_checks): Remove. (cp_parser_nested_name_specifier_opt): Use new deferred access functions. (cp_parser_simple_declaration): Likewise. (cp_parser_template_id): Likewise. (cp_parser_function_definition): Likewise. (cp_parser_class_specifier): Likewise. (cp_parser_lookup_name): Likewise. (cp_parser_single_declaration): Likewise. (cp_parser_pre_parsed_nested_name_specifier): Likewise. (cp_parser_parse_tentatively): Likewise. (cp_parser_parse_definitely): Likewise. (yyparse): Likewise. (cp_parser_init_declarator): Remove access_checks parameter. Use new deferred access functions. (cp_parser_function_definition_from_specifiers_and_declarator): Likewise. (cp_parser_class_head): Remove deferring_access_checks_p and saved_access_checks parameters. Use new deferred access functions. (cp_parser_member_specification_opt): Don't call reset_type_access_control. * search.c (type_access_control): Remove. * semantics.c: Include "gt-cp-semantics.h". (deferred_type_access_control): Remove. (deferred_access_stack): New variable. (deferred_access_free_list): Likewise. (push_deferring_access_checks): New function. (resume_deferring_access_checks): Likewise. (stop_deferring_access_checks): Likewise. (pop_deferring_access_checks): Likewise. (get_deferred_access_checks): Likewise. (pop_to_parent_deferring_access_checks): Likewise. (perform_deferred_access_checks): New function, adapted from cp_parser_perform_deferred_access_checks. (perform_or_defer_access_check): New function, adapted from cp_parser_defer_access_check. (current_type_lookups): Remove. (deferred_type_access_control): Likewise. (decl_type_access_control): Likewise. (save_type_access_control): Likewise. (reset_type_access_control): Likewise. (begin_function_definition): Adjust. (begin_class_definiton): Likewise. From-SVN: r61283
2003-01-14 14:40:53 +01:00
/* Recycle previously used free store if available. */
if (deferred_access_free_list)
{
d = deferred_access_free_list;
deferred_access_free_list = d->next;
}
else
d = ggc_alloc (sizeof (deferred_access));
config-lang.in: Add semantics.c to gtfiles. * config-lang.in: Add semantics.c to gtfiles. * cp-tree.h (flagged_type_tree_s): Remove lookups field. (saved_scope): Likewise. (type_lookups): Remove. (deferred_access): New structure. (type_access_control): Remove. (save_type_access_control): Likewise. (reset_type_access_control): Likewise. (decl_type_access_control): Likewise. (push_deferring_access_checks): Declare. (resume_deferring_access_checks): Likewise. (stop_deferring_access_checks): Likewise. (pop_deferring_access_checks): Likewise. (get_deferred_access_checks): Likewise. (pop_to_parent_deferring_access_checks): Likewise. (perform_deferred_access_checks): Likewise. (perform_or_defer_access_check): Likewise. * decl.c (make_typename_type): Use perform_or_defer_access_check. (make_unbound_class_template): Likewise. (grokdeclarator): Don't call decl_type_access_control. * parser.c (cp_parser_context): Remove deferred_access_checks and deferring_access_checks_p fields. (cp_parser_context_new): Adjust. (cp_parser): Remove access_checks_lists. (cp_parser_defer_access_check): Remove. (cp_parser_start_deferring_access_checks): Remove. (cp_parser_stop_deferring_access_checks): Remove. (cp_parser_perform_deferred_access_checks): Remove. (cp_parser_nested_name_specifier_opt): Use new deferred access functions. (cp_parser_simple_declaration): Likewise. (cp_parser_template_id): Likewise. (cp_parser_function_definition): Likewise. (cp_parser_class_specifier): Likewise. (cp_parser_lookup_name): Likewise. (cp_parser_single_declaration): Likewise. (cp_parser_pre_parsed_nested_name_specifier): Likewise. (cp_parser_parse_tentatively): Likewise. (cp_parser_parse_definitely): Likewise. (yyparse): Likewise. (cp_parser_init_declarator): Remove access_checks parameter. Use new deferred access functions. (cp_parser_function_definition_from_specifiers_and_declarator): Likewise. (cp_parser_class_head): Remove deferring_access_checks_p and saved_access_checks parameters. Use new deferred access functions. (cp_parser_member_specification_opt): Don't call reset_type_access_control. * search.c (type_access_control): Remove. * semantics.c: Include "gt-cp-semantics.h". (deferred_type_access_control): Remove. (deferred_access_stack): New variable. (deferred_access_free_list): Likewise. (push_deferring_access_checks): New function. (resume_deferring_access_checks): Likewise. (stop_deferring_access_checks): Likewise. (pop_deferring_access_checks): Likewise. (get_deferred_access_checks): Likewise. (pop_to_parent_deferring_access_checks): Likewise. (perform_deferred_access_checks): New function, adapted from cp_parser_perform_deferred_access_checks. (perform_or_defer_access_check): New function, adapted from cp_parser_defer_access_check. (current_type_lookups): Remove. (deferred_type_access_control): Likewise. (decl_type_access_control): Likewise. (save_type_access_control): Likewise. (reset_type_access_control): Likewise. (begin_function_definition): Adjust. (begin_class_definiton): Likewise. From-SVN: r61283
2003-01-14 14:40:53 +01:00
d->next = deferred_access_stack;
d->deferred_access_checks = NULL_TREE;
d->deferring_access_checks_kind = deferring;
config-lang.in: Add semantics.c to gtfiles. * config-lang.in: Add semantics.c to gtfiles. * cp-tree.h (flagged_type_tree_s): Remove lookups field. (saved_scope): Likewise. (type_lookups): Remove. (deferred_access): New structure. (type_access_control): Remove. (save_type_access_control): Likewise. (reset_type_access_control): Likewise. (decl_type_access_control): Likewise. (push_deferring_access_checks): Declare. (resume_deferring_access_checks): Likewise. (stop_deferring_access_checks): Likewise. (pop_deferring_access_checks): Likewise. (get_deferred_access_checks): Likewise. (pop_to_parent_deferring_access_checks): Likewise. (perform_deferred_access_checks): Likewise. (perform_or_defer_access_check): Likewise. * decl.c (make_typename_type): Use perform_or_defer_access_check. (make_unbound_class_template): Likewise. (grokdeclarator): Don't call decl_type_access_control. * parser.c (cp_parser_context): Remove deferred_access_checks and deferring_access_checks_p fields. (cp_parser_context_new): Adjust. (cp_parser): Remove access_checks_lists. (cp_parser_defer_access_check): Remove. (cp_parser_start_deferring_access_checks): Remove. (cp_parser_stop_deferring_access_checks): Remove. (cp_parser_perform_deferred_access_checks): Remove. (cp_parser_nested_name_specifier_opt): Use new deferred access functions. (cp_parser_simple_declaration): Likewise. (cp_parser_template_id): Likewise. (cp_parser_function_definition): Likewise. (cp_parser_class_specifier): Likewise. (cp_parser_lookup_name): Likewise. (cp_parser_single_declaration): Likewise. (cp_parser_pre_parsed_nested_name_specifier): Likewise. (cp_parser_parse_tentatively): Likewise. (cp_parser_parse_definitely): Likewise. (yyparse): Likewise. (cp_parser_init_declarator): Remove access_checks parameter. Use new deferred access functions. (cp_parser_function_definition_from_specifiers_and_declarator): Likewise. (cp_parser_class_head): Remove deferring_access_checks_p and saved_access_checks parameters. Use new deferred access functions. (cp_parser_member_specification_opt): Don't call reset_type_access_control. * search.c (type_access_control): Remove. * semantics.c: Include "gt-cp-semantics.h". (deferred_type_access_control): Remove. (deferred_access_stack): New variable. (deferred_access_free_list): Likewise. (push_deferring_access_checks): New function. (resume_deferring_access_checks): Likewise. (stop_deferring_access_checks): Likewise. (pop_deferring_access_checks): Likewise. (get_deferred_access_checks): Likewise. (pop_to_parent_deferring_access_checks): Likewise. (perform_deferred_access_checks): New function, adapted from cp_parser_perform_deferred_access_checks. (perform_or_defer_access_check): New function, adapted from cp_parser_defer_access_check. (current_type_lookups): Remove. (deferred_type_access_control): Likewise. (decl_type_access_control): Likewise. (save_type_access_control): Likewise. (reset_type_access_control): Likewise. (begin_function_definition): Adjust. (begin_class_definiton): Likewise. From-SVN: r61283
2003-01-14 14:40:53 +01:00
deferred_access_stack = d;
}
/* Resume deferring access checks again after we stopped doing
this previously. */
void resume_deferring_access_checks (void)
{
if (deferred_access_stack->deferring_access_checks_kind == dk_no_deferred)
deferred_access_stack->deferring_access_checks_kind = dk_deferred;
config-lang.in: Add semantics.c to gtfiles. * config-lang.in: Add semantics.c to gtfiles. * cp-tree.h (flagged_type_tree_s): Remove lookups field. (saved_scope): Likewise. (type_lookups): Remove. (deferred_access): New structure. (type_access_control): Remove. (save_type_access_control): Likewise. (reset_type_access_control): Likewise. (decl_type_access_control): Likewise. (push_deferring_access_checks): Declare. (resume_deferring_access_checks): Likewise. (stop_deferring_access_checks): Likewise. (pop_deferring_access_checks): Likewise. (get_deferred_access_checks): Likewise. (pop_to_parent_deferring_access_checks): Likewise. (perform_deferred_access_checks): Likewise. (perform_or_defer_access_check): Likewise. * decl.c (make_typename_type): Use perform_or_defer_access_check. (make_unbound_class_template): Likewise. (grokdeclarator): Don't call decl_type_access_control. * parser.c (cp_parser_context): Remove deferred_access_checks and deferring_access_checks_p fields. (cp_parser_context_new): Adjust. (cp_parser): Remove access_checks_lists. (cp_parser_defer_access_check): Remove. (cp_parser_start_deferring_access_checks): Remove. (cp_parser_stop_deferring_access_checks): Remove. (cp_parser_perform_deferred_access_checks): Remove. (cp_parser_nested_name_specifier_opt): Use new deferred access functions. (cp_parser_simple_declaration): Likewise. (cp_parser_template_id): Likewise. (cp_parser_function_definition): Likewise. (cp_parser_class_specifier): Likewise. (cp_parser_lookup_name): Likewise. (cp_parser_single_declaration): Likewise. (cp_parser_pre_parsed_nested_name_specifier): Likewise. (cp_parser_parse_tentatively): Likewise. (cp_parser_parse_definitely): Likewise. (yyparse): Likewise. (cp_parser_init_declarator): Remove access_checks parameter. Use new deferred access functions. (cp_parser_function_definition_from_specifiers_and_declarator): Likewise. (cp_parser_class_head): Remove deferring_access_checks_p and saved_access_checks parameters. Use new deferred access functions. (cp_parser_member_specification_opt): Don't call reset_type_access_control. * search.c (type_access_control): Remove. * semantics.c: Include "gt-cp-semantics.h". (deferred_type_access_control): Remove. (deferred_access_stack): New variable. (deferred_access_free_list): Likewise. (push_deferring_access_checks): New function. (resume_deferring_access_checks): Likewise. (stop_deferring_access_checks): Likewise. (pop_deferring_access_checks): Likewise. (get_deferred_access_checks): Likewise. (pop_to_parent_deferring_access_checks): Likewise. (perform_deferred_access_checks): New function, adapted from cp_parser_perform_deferred_access_checks. (perform_or_defer_access_check): New function, adapted from cp_parser_defer_access_check. (current_type_lookups): Remove. (deferred_type_access_control): Likewise. (decl_type_access_control): Likewise. (save_type_access_control): Likewise. (reset_type_access_control): Likewise. (begin_function_definition): Adjust. (begin_class_definiton): Likewise. From-SVN: r61283
2003-01-14 14:40:53 +01:00
}
/* Stop deferring access checks. */
void stop_deferring_access_checks (void)
{
if (deferred_access_stack->deferring_access_checks_kind == dk_deferred)
deferred_access_stack->deferring_access_checks_kind = dk_no_deferred;
config-lang.in: Add semantics.c to gtfiles. * config-lang.in: Add semantics.c to gtfiles. * cp-tree.h (flagged_type_tree_s): Remove lookups field. (saved_scope): Likewise. (type_lookups): Remove. (deferred_access): New structure. (type_access_control): Remove. (save_type_access_control): Likewise. (reset_type_access_control): Likewise. (decl_type_access_control): Likewise. (push_deferring_access_checks): Declare. (resume_deferring_access_checks): Likewise. (stop_deferring_access_checks): Likewise. (pop_deferring_access_checks): Likewise. (get_deferred_access_checks): Likewise. (pop_to_parent_deferring_access_checks): Likewise. (perform_deferred_access_checks): Likewise. (perform_or_defer_access_check): Likewise. * decl.c (make_typename_type): Use perform_or_defer_access_check. (make_unbound_class_template): Likewise. (grokdeclarator): Don't call decl_type_access_control. * parser.c (cp_parser_context): Remove deferred_access_checks and deferring_access_checks_p fields. (cp_parser_context_new): Adjust. (cp_parser): Remove access_checks_lists. (cp_parser_defer_access_check): Remove. (cp_parser_start_deferring_access_checks): Remove. (cp_parser_stop_deferring_access_checks): Remove. (cp_parser_perform_deferred_access_checks): Remove. (cp_parser_nested_name_specifier_opt): Use new deferred access functions. (cp_parser_simple_declaration): Likewise. (cp_parser_template_id): Likewise. (cp_parser_function_definition): Likewise. (cp_parser_class_specifier): Likewise. (cp_parser_lookup_name): Likewise. (cp_parser_single_declaration): Likewise. (cp_parser_pre_parsed_nested_name_specifier): Likewise. (cp_parser_parse_tentatively): Likewise. (cp_parser_parse_definitely): Likewise. (yyparse): Likewise. (cp_parser_init_declarator): Remove access_checks parameter. Use new deferred access functions. (cp_parser_function_definition_from_specifiers_and_declarator): Likewise. (cp_parser_class_head): Remove deferring_access_checks_p and saved_access_checks parameters. Use new deferred access functions. (cp_parser_member_specification_opt): Don't call reset_type_access_control. * search.c (type_access_control): Remove. * semantics.c: Include "gt-cp-semantics.h". (deferred_type_access_control): Remove. (deferred_access_stack): New variable. (deferred_access_free_list): Likewise. (push_deferring_access_checks): New function. (resume_deferring_access_checks): Likewise. (stop_deferring_access_checks): Likewise. (pop_deferring_access_checks): Likewise. (get_deferred_access_checks): Likewise. (pop_to_parent_deferring_access_checks): Likewise. (perform_deferred_access_checks): New function, adapted from cp_parser_perform_deferred_access_checks. (perform_or_defer_access_check): New function, adapted from cp_parser_defer_access_check. (current_type_lookups): Remove. (deferred_type_access_control): Likewise. (decl_type_access_control): Likewise. (save_type_access_control): Likewise. (reset_type_access_control): Likewise. (begin_function_definition): Adjust. (begin_class_definiton): Likewise. From-SVN: r61283
2003-01-14 14:40:53 +01:00
}
/* Discard the current deferred access checks and restore the
previous states. */
void pop_deferring_access_checks (void)
{
deferred_access *d = deferred_access_stack;
deferred_access_stack = d->next;
/* Remove references to access checks TREE_LIST. */
d->deferred_access_checks = NULL_TREE;
/* Store in free list for later use. */
d->next = deferred_access_free_list;
deferred_access_free_list = d;
}
/* Returns a TREE_LIST representing the deferred checks.
The TREE_PURPOSE of each node is the type through which the
access occurred; the TREE_VALUE is the declaration named.
*/
tree get_deferred_access_checks (void)
{
return deferred_access_stack->deferred_access_checks;
}
/* Take current deferred checks and combine with the
previous states if we also defer checks previously.
Otherwise perform checks now. */
void pop_to_parent_deferring_access_checks (void)
{
tree deferred_check = get_deferred_access_checks ();
deferred_access *d1 = deferred_access_stack;
deferred_access *d2 = deferred_access_stack->next;
deferred_access *d3 = deferred_access_stack->next->next;
/* Temporary swap the order of the top two states, just to make
sure the garbage collector will not reclaim the memory during
processing below. */
deferred_access_stack = d2;
d2->next = d1;
d1->next = d3;
for ( ; deferred_check; deferred_check = TREE_CHAIN (deferred_check))
/* Perform deferred check if required. */
perform_or_defer_access_check (TREE_PURPOSE (deferred_check),
TREE_VALUE (deferred_check));
deferred_access_stack = d1;
d1->next = d2;
d2->next = d3;
pop_deferring_access_checks ();
}
/* Perform the deferred access checks.
After performing the checks, we still have to keep the list
`deferred_access_stack->deferred_access_checks' since we may want
to check access for them again later in a different context.
For example:
class A {
typedef int X;
static X a;
};
A::X A::a, x; // No error for `A::a', error for `x'
We have to perform deferred access of `A::X', first with `A::a',
next with `x'. */
config-lang.in: Add semantics.c to gtfiles. * config-lang.in: Add semantics.c to gtfiles. * cp-tree.h (flagged_type_tree_s): Remove lookups field. (saved_scope): Likewise. (type_lookups): Remove. (deferred_access): New structure. (type_access_control): Remove. (save_type_access_control): Likewise. (reset_type_access_control): Likewise. (decl_type_access_control): Likewise. (push_deferring_access_checks): Declare. (resume_deferring_access_checks): Likewise. (stop_deferring_access_checks): Likewise. (pop_deferring_access_checks): Likewise. (get_deferred_access_checks): Likewise. (pop_to_parent_deferring_access_checks): Likewise. (perform_deferred_access_checks): Likewise. (perform_or_defer_access_check): Likewise. * decl.c (make_typename_type): Use perform_or_defer_access_check. (make_unbound_class_template): Likewise. (grokdeclarator): Don't call decl_type_access_control. * parser.c (cp_parser_context): Remove deferred_access_checks and deferring_access_checks_p fields. (cp_parser_context_new): Adjust. (cp_parser): Remove access_checks_lists. (cp_parser_defer_access_check): Remove. (cp_parser_start_deferring_access_checks): Remove. (cp_parser_stop_deferring_access_checks): Remove. (cp_parser_perform_deferred_access_checks): Remove. (cp_parser_nested_name_specifier_opt): Use new deferred access functions. (cp_parser_simple_declaration): Likewise. (cp_parser_template_id): Likewise. (cp_parser_function_definition): Likewise. (cp_parser_class_specifier): Likewise. (cp_parser_lookup_name): Likewise. (cp_parser_single_declaration): Likewise. (cp_parser_pre_parsed_nested_name_specifier): Likewise. (cp_parser_parse_tentatively): Likewise. (cp_parser_parse_definitely): Likewise. (yyparse): Likewise. (cp_parser_init_declarator): Remove access_checks parameter. Use new deferred access functions. (cp_parser_function_definition_from_specifiers_and_declarator): Likewise. (cp_parser_class_head): Remove deferring_access_checks_p and saved_access_checks parameters. Use new deferred access functions. (cp_parser_member_specification_opt): Don't call reset_type_access_control. * search.c (type_access_control): Remove. * semantics.c: Include "gt-cp-semantics.h". (deferred_type_access_control): Remove. (deferred_access_stack): New variable. (deferred_access_free_list): Likewise. (push_deferring_access_checks): New function. (resume_deferring_access_checks): Likewise. (stop_deferring_access_checks): Likewise. (pop_deferring_access_checks): Likewise. (get_deferred_access_checks): Likewise. (pop_to_parent_deferring_access_checks): Likewise. (perform_deferred_access_checks): New function, adapted from cp_parser_perform_deferred_access_checks. (perform_or_defer_access_check): New function, adapted from cp_parser_defer_access_check. (current_type_lookups): Remove. (deferred_type_access_control): Likewise. (decl_type_access_control): Likewise. (save_type_access_control): Likewise. (reset_type_access_control): Likewise. (begin_function_definition): Adjust. (begin_class_definiton): Likewise. From-SVN: r61283
2003-01-14 14:40:53 +01:00
void perform_deferred_access_checks (void)
{
tree deferred_check;
for (deferred_check = deferred_access_stack->deferred_access_checks;
deferred_check;
deferred_check = TREE_CHAIN (deferred_check))
/* Check access. */
enforce_access (TREE_PURPOSE (deferred_check),
TREE_VALUE (deferred_check));
}
/* Defer checking the accessibility of DECL, when looked up in
BINFO. */
config-lang.in: Add semantics.c to gtfiles. * config-lang.in: Add semantics.c to gtfiles. * cp-tree.h (flagged_type_tree_s): Remove lookups field. (saved_scope): Likewise. (type_lookups): Remove. (deferred_access): New structure. (type_access_control): Remove. (save_type_access_control): Likewise. (reset_type_access_control): Likewise. (decl_type_access_control): Likewise. (push_deferring_access_checks): Declare. (resume_deferring_access_checks): Likewise. (stop_deferring_access_checks): Likewise. (pop_deferring_access_checks): Likewise. (get_deferred_access_checks): Likewise. (pop_to_parent_deferring_access_checks): Likewise. (perform_deferred_access_checks): Likewise. (perform_or_defer_access_check): Likewise. * decl.c (make_typename_type): Use perform_or_defer_access_check. (make_unbound_class_template): Likewise. (grokdeclarator): Don't call decl_type_access_control. * parser.c (cp_parser_context): Remove deferred_access_checks and deferring_access_checks_p fields. (cp_parser_context_new): Adjust. (cp_parser): Remove access_checks_lists. (cp_parser_defer_access_check): Remove. (cp_parser_start_deferring_access_checks): Remove. (cp_parser_stop_deferring_access_checks): Remove. (cp_parser_perform_deferred_access_checks): Remove. (cp_parser_nested_name_specifier_opt): Use new deferred access functions. (cp_parser_simple_declaration): Likewise. (cp_parser_template_id): Likewise. (cp_parser_function_definition): Likewise. (cp_parser_class_specifier): Likewise. (cp_parser_lookup_name): Likewise. (cp_parser_single_declaration): Likewise. (cp_parser_pre_parsed_nested_name_specifier): Likewise. (cp_parser_parse_tentatively): Likewise. (cp_parser_parse_definitely): Likewise. (yyparse): Likewise. (cp_parser_init_declarator): Remove access_checks parameter. Use new deferred access functions. (cp_parser_function_definition_from_specifiers_and_declarator): Likewise. (cp_parser_class_head): Remove deferring_access_checks_p and saved_access_checks parameters. Use new deferred access functions. (cp_parser_member_specification_opt): Don't call reset_type_access_control. * search.c (type_access_control): Remove. * semantics.c: Include "gt-cp-semantics.h". (deferred_type_access_control): Remove. (deferred_access_stack): New variable. (deferred_access_free_list): Likewise. (push_deferring_access_checks): New function. (resume_deferring_access_checks): Likewise. (stop_deferring_access_checks): Likewise. (pop_deferring_access_checks): Likewise. (get_deferred_access_checks): Likewise. (pop_to_parent_deferring_access_checks): Likewise. (perform_deferred_access_checks): New function, adapted from cp_parser_perform_deferred_access_checks. (perform_or_defer_access_check): New function, adapted from cp_parser_defer_access_check. (current_type_lookups): Remove. (deferred_type_access_control): Likewise. (decl_type_access_control): Likewise. (save_type_access_control): Likewise. (reset_type_access_control): Likewise. (begin_function_definition): Adjust. (begin_class_definiton): Likewise. From-SVN: r61283
2003-01-14 14:40:53 +01:00
void perform_or_defer_access_check (tree binfo, tree decl)
config-lang.in: Add semantics.c to gtfiles. * config-lang.in: Add semantics.c to gtfiles. * cp-tree.h (flagged_type_tree_s): Remove lookups field. (saved_scope): Likewise. (type_lookups): Remove. (deferred_access): New structure. (type_access_control): Remove. (save_type_access_control): Likewise. (reset_type_access_control): Likewise. (decl_type_access_control): Likewise. (push_deferring_access_checks): Declare. (resume_deferring_access_checks): Likewise. (stop_deferring_access_checks): Likewise. (pop_deferring_access_checks): Likewise. (get_deferred_access_checks): Likewise. (pop_to_parent_deferring_access_checks): Likewise. (perform_deferred_access_checks): Likewise. (perform_or_defer_access_check): Likewise. * decl.c (make_typename_type): Use perform_or_defer_access_check. (make_unbound_class_template): Likewise. (grokdeclarator): Don't call decl_type_access_control. * parser.c (cp_parser_context): Remove deferred_access_checks and deferring_access_checks_p fields. (cp_parser_context_new): Adjust. (cp_parser): Remove access_checks_lists. (cp_parser_defer_access_check): Remove. (cp_parser_start_deferring_access_checks): Remove. (cp_parser_stop_deferring_access_checks): Remove. (cp_parser_perform_deferred_access_checks): Remove. (cp_parser_nested_name_specifier_opt): Use new deferred access functions. (cp_parser_simple_declaration): Likewise. (cp_parser_template_id): Likewise. (cp_parser_function_definition): Likewise. (cp_parser_class_specifier): Likewise. (cp_parser_lookup_name): Likewise. (cp_parser_single_declaration): Likewise. (cp_parser_pre_parsed_nested_name_specifier): Likewise. (cp_parser_parse_tentatively): Likewise. (cp_parser_parse_definitely): Likewise. (yyparse): Likewise. (cp_parser_init_declarator): Remove access_checks parameter. Use new deferred access functions. (cp_parser_function_definition_from_specifiers_and_declarator): Likewise. (cp_parser_class_head): Remove deferring_access_checks_p and saved_access_checks parameters. Use new deferred access functions. (cp_parser_member_specification_opt): Don't call reset_type_access_control. * search.c (type_access_control): Remove. * semantics.c: Include "gt-cp-semantics.h". (deferred_type_access_control): Remove. (deferred_access_stack): New variable. (deferred_access_free_list): Likewise. (push_deferring_access_checks): New function. (resume_deferring_access_checks): Likewise. (stop_deferring_access_checks): Likewise. (pop_deferring_access_checks): Likewise. (get_deferred_access_checks): Likewise. (pop_to_parent_deferring_access_checks): Likewise. (perform_deferred_access_checks): New function, adapted from cp_parser_perform_deferred_access_checks. (perform_or_defer_access_check): New function, adapted from cp_parser_defer_access_check. (current_type_lookups): Remove. (deferred_type_access_control): Likewise. (decl_type_access_control): Likewise. (save_type_access_control): Likewise. (reset_type_access_control): Likewise. (begin_function_definition): Adjust. (begin_class_definiton): Likewise. From-SVN: r61283
2003-01-14 14:40:53 +01:00
{
tree check;
my_friendly_assert (TREE_CODE (binfo) == TREE_VEC, 20030623);
config-lang.in: Add semantics.c to gtfiles. * config-lang.in: Add semantics.c to gtfiles. * cp-tree.h (flagged_type_tree_s): Remove lookups field. (saved_scope): Likewise. (type_lookups): Remove. (deferred_access): New structure. (type_access_control): Remove. (save_type_access_control): Likewise. (reset_type_access_control): Likewise. (decl_type_access_control): Likewise. (push_deferring_access_checks): Declare. (resume_deferring_access_checks): Likewise. (stop_deferring_access_checks): Likewise. (pop_deferring_access_checks): Likewise. (get_deferred_access_checks): Likewise. (pop_to_parent_deferring_access_checks): Likewise. (perform_deferred_access_checks): Likewise. (perform_or_defer_access_check): Likewise. * decl.c (make_typename_type): Use perform_or_defer_access_check. (make_unbound_class_template): Likewise. (grokdeclarator): Don't call decl_type_access_control. * parser.c (cp_parser_context): Remove deferred_access_checks and deferring_access_checks_p fields. (cp_parser_context_new): Adjust. (cp_parser): Remove access_checks_lists. (cp_parser_defer_access_check): Remove. (cp_parser_start_deferring_access_checks): Remove. (cp_parser_stop_deferring_access_checks): Remove. (cp_parser_perform_deferred_access_checks): Remove. (cp_parser_nested_name_specifier_opt): Use new deferred access functions. (cp_parser_simple_declaration): Likewise. (cp_parser_template_id): Likewise. (cp_parser_function_definition): Likewise. (cp_parser_class_specifier): Likewise. (cp_parser_lookup_name): Likewise. (cp_parser_single_declaration): Likewise. (cp_parser_pre_parsed_nested_name_specifier): Likewise. (cp_parser_parse_tentatively): Likewise. (cp_parser_parse_definitely): Likewise. (yyparse): Likewise. (cp_parser_init_declarator): Remove access_checks parameter. Use new deferred access functions. (cp_parser_function_definition_from_specifiers_and_declarator): Likewise. (cp_parser_class_head): Remove deferring_access_checks_p and saved_access_checks parameters. Use new deferred access functions. (cp_parser_member_specification_opt): Don't call reset_type_access_control. * search.c (type_access_control): Remove. * semantics.c: Include "gt-cp-semantics.h". (deferred_type_access_control): Remove. (deferred_access_stack): New variable. (deferred_access_free_list): Likewise. (push_deferring_access_checks): New function. (resume_deferring_access_checks): Likewise. (stop_deferring_access_checks): Likewise. (pop_deferring_access_checks): Likewise. (get_deferred_access_checks): Likewise. (pop_to_parent_deferring_access_checks): Likewise. (perform_deferred_access_checks): New function, adapted from cp_parser_perform_deferred_access_checks. (perform_or_defer_access_check): New function, adapted from cp_parser_defer_access_check. (current_type_lookups): Remove. (deferred_type_access_control): Likewise. (decl_type_access_control): Likewise. (save_type_access_control): Likewise. (reset_type_access_control): Likewise. (begin_function_definition): Adjust. (begin_class_definiton): Likewise. From-SVN: r61283
2003-01-14 14:40:53 +01:00
/* If we are not supposed to defer access checks, just check now. */
if (deferred_access_stack->deferring_access_checks_kind == dk_no_deferred)
config-lang.in: Add semantics.c to gtfiles. * config-lang.in: Add semantics.c to gtfiles. * cp-tree.h (flagged_type_tree_s): Remove lookups field. (saved_scope): Likewise. (type_lookups): Remove. (deferred_access): New structure. (type_access_control): Remove. (save_type_access_control): Likewise. (reset_type_access_control): Likewise. (decl_type_access_control): Likewise. (push_deferring_access_checks): Declare. (resume_deferring_access_checks): Likewise. (stop_deferring_access_checks): Likewise. (pop_deferring_access_checks): Likewise. (get_deferred_access_checks): Likewise. (pop_to_parent_deferring_access_checks): Likewise. (perform_deferred_access_checks): Likewise. (perform_or_defer_access_check): Likewise. * decl.c (make_typename_type): Use perform_or_defer_access_check. (make_unbound_class_template): Likewise. (grokdeclarator): Don't call decl_type_access_control. * parser.c (cp_parser_context): Remove deferred_access_checks and deferring_access_checks_p fields. (cp_parser_context_new): Adjust. (cp_parser): Remove access_checks_lists. (cp_parser_defer_access_check): Remove. (cp_parser_start_deferring_access_checks): Remove. (cp_parser_stop_deferring_access_checks): Remove. (cp_parser_perform_deferred_access_checks): Remove. (cp_parser_nested_name_specifier_opt): Use new deferred access functions. (cp_parser_simple_declaration): Likewise. (cp_parser_template_id): Likewise. (cp_parser_function_definition): Likewise. (cp_parser_class_specifier): Likewise. (cp_parser_lookup_name): Likewise. (cp_parser_single_declaration): Likewise. (cp_parser_pre_parsed_nested_name_specifier): Likewise. (cp_parser_parse_tentatively): Likewise. (cp_parser_parse_definitely): Likewise. (yyparse): Likewise. (cp_parser_init_declarator): Remove access_checks parameter. Use new deferred access functions. (cp_parser_function_definition_from_specifiers_and_declarator): Likewise. (cp_parser_class_head): Remove deferring_access_checks_p and saved_access_checks parameters. Use new deferred access functions. (cp_parser_member_specification_opt): Don't call reset_type_access_control. * search.c (type_access_control): Remove. * semantics.c: Include "gt-cp-semantics.h". (deferred_type_access_control): Remove. (deferred_access_stack): New variable. (deferred_access_free_list): Likewise. (push_deferring_access_checks): New function. (resume_deferring_access_checks): Likewise. (stop_deferring_access_checks): Likewise. (pop_deferring_access_checks): Likewise. (get_deferred_access_checks): Likewise. (pop_to_parent_deferring_access_checks): Likewise. (perform_deferred_access_checks): New function, adapted from cp_parser_perform_deferred_access_checks. (perform_or_defer_access_check): New function, adapted from cp_parser_defer_access_check. (current_type_lookups): Remove. (deferred_type_access_control): Likewise. (decl_type_access_control): Likewise. (save_type_access_control): Likewise. (reset_type_access_control): Likewise. (begin_function_definition): Adjust. (begin_class_definiton): Likewise. From-SVN: r61283
2003-01-14 14:40:53 +01:00
{
enforce_access (binfo, decl);
config-lang.in: Add semantics.c to gtfiles. * config-lang.in: Add semantics.c to gtfiles. * cp-tree.h (flagged_type_tree_s): Remove lookups field. (saved_scope): Likewise. (type_lookups): Remove. (deferred_access): New structure. (type_access_control): Remove. (save_type_access_control): Likewise. (reset_type_access_control): Likewise. (decl_type_access_control): Likewise. (push_deferring_access_checks): Declare. (resume_deferring_access_checks): Likewise. (stop_deferring_access_checks): Likewise. (pop_deferring_access_checks): Likewise. (get_deferred_access_checks): Likewise. (pop_to_parent_deferring_access_checks): Likewise. (perform_deferred_access_checks): Likewise. (perform_or_defer_access_check): Likewise. * decl.c (make_typename_type): Use perform_or_defer_access_check. (make_unbound_class_template): Likewise. (grokdeclarator): Don't call decl_type_access_control. * parser.c (cp_parser_context): Remove deferred_access_checks and deferring_access_checks_p fields. (cp_parser_context_new): Adjust. (cp_parser): Remove access_checks_lists. (cp_parser_defer_access_check): Remove. (cp_parser_start_deferring_access_checks): Remove. (cp_parser_stop_deferring_access_checks): Remove. (cp_parser_perform_deferred_access_checks): Remove. (cp_parser_nested_name_specifier_opt): Use new deferred access functions. (cp_parser_simple_declaration): Likewise. (cp_parser_template_id): Likewise. (cp_parser_function_definition): Likewise. (cp_parser_class_specifier): Likewise. (cp_parser_lookup_name): Likewise. (cp_parser_single_declaration): Likewise. (cp_parser_pre_parsed_nested_name_specifier): Likewise. (cp_parser_parse_tentatively): Likewise. (cp_parser_parse_definitely): Likewise. (yyparse): Likewise. (cp_parser_init_declarator): Remove access_checks parameter. Use new deferred access functions. (cp_parser_function_definition_from_specifiers_and_declarator): Likewise. (cp_parser_class_head): Remove deferring_access_checks_p and saved_access_checks parameters. Use new deferred access functions. (cp_parser_member_specification_opt): Don't call reset_type_access_control. * search.c (type_access_control): Remove. * semantics.c: Include "gt-cp-semantics.h". (deferred_type_access_control): Remove. (deferred_access_stack): New variable. (deferred_access_free_list): Likewise. (push_deferring_access_checks): New function. (resume_deferring_access_checks): Likewise. (stop_deferring_access_checks): Likewise. (pop_deferring_access_checks): Likewise. (get_deferred_access_checks): Likewise. (pop_to_parent_deferring_access_checks): Likewise. (perform_deferred_access_checks): New function, adapted from cp_parser_perform_deferred_access_checks. (perform_or_defer_access_check): New function, adapted from cp_parser_defer_access_check. (current_type_lookups): Remove. (deferred_type_access_control): Likewise. (decl_type_access_control): Likewise. (save_type_access_control): Likewise. (reset_type_access_control): Likewise. (begin_function_definition): Adjust. (begin_class_definiton): Likewise. From-SVN: r61283
2003-01-14 14:40:53 +01:00
return;
}
/* Exit if we are in a context that no access checking is performed. */
else if (deferred_access_stack->deferring_access_checks_kind == dk_no_check)
return;
config-lang.in: Add semantics.c to gtfiles. * config-lang.in: Add semantics.c to gtfiles. * cp-tree.h (flagged_type_tree_s): Remove lookups field. (saved_scope): Likewise. (type_lookups): Remove. (deferred_access): New structure. (type_access_control): Remove. (save_type_access_control): Likewise. (reset_type_access_control): Likewise. (decl_type_access_control): Likewise. (push_deferring_access_checks): Declare. (resume_deferring_access_checks): Likewise. (stop_deferring_access_checks): Likewise. (pop_deferring_access_checks): Likewise. (get_deferred_access_checks): Likewise. (pop_to_parent_deferring_access_checks): Likewise. (perform_deferred_access_checks): Likewise. (perform_or_defer_access_check): Likewise. * decl.c (make_typename_type): Use perform_or_defer_access_check. (make_unbound_class_template): Likewise. (grokdeclarator): Don't call decl_type_access_control. * parser.c (cp_parser_context): Remove deferred_access_checks and deferring_access_checks_p fields. (cp_parser_context_new): Adjust. (cp_parser): Remove access_checks_lists. (cp_parser_defer_access_check): Remove. (cp_parser_start_deferring_access_checks): Remove. (cp_parser_stop_deferring_access_checks): Remove. (cp_parser_perform_deferred_access_checks): Remove. (cp_parser_nested_name_specifier_opt): Use new deferred access functions. (cp_parser_simple_declaration): Likewise. (cp_parser_template_id): Likewise. (cp_parser_function_definition): Likewise. (cp_parser_class_specifier): Likewise. (cp_parser_lookup_name): Likewise. (cp_parser_single_declaration): Likewise. (cp_parser_pre_parsed_nested_name_specifier): Likewise. (cp_parser_parse_tentatively): Likewise. (cp_parser_parse_definitely): Likewise. (yyparse): Likewise. (cp_parser_init_declarator): Remove access_checks parameter. Use new deferred access functions. (cp_parser_function_definition_from_specifiers_and_declarator): Likewise. (cp_parser_class_head): Remove deferring_access_checks_p and saved_access_checks parameters. Use new deferred access functions. (cp_parser_member_specification_opt): Don't call reset_type_access_control. * search.c (type_access_control): Remove. * semantics.c: Include "gt-cp-semantics.h". (deferred_type_access_control): Remove. (deferred_access_stack): New variable. (deferred_access_free_list): Likewise. (push_deferring_access_checks): New function. (resume_deferring_access_checks): Likewise. (stop_deferring_access_checks): Likewise. (pop_deferring_access_checks): Likewise. (get_deferred_access_checks): Likewise. (pop_to_parent_deferring_access_checks): Likewise. (perform_deferred_access_checks): New function, adapted from cp_parser_perform_deferred_access_checks. (perform_or_defer_access_check): New function, adapted from cp_parser_defer_access_check. (current_type_lookups): Remove. (deferred_type_access_control): Likewise. (decl_type_access_control): Likewise. (save_type_access_control): Likewise. (reset_type_access_control): Likewise. (begin_function_definition): Adjust. (begin_class_definiton): Likewise. From-SVN: r61283
2003-01-14 14:40:53 +01:00
/* See if we are already going to perform this check. */
for (check = deferred_access_stack->deferred_access_checks;
check;
check = TREE_CHAIN (check))
if (TREE_VALUE (check) == decl && TREE_PURPOSE (check) == binfo)
config-lang.in: Add semantics.c to gtfiles. * config-lang.in: Add semantics.c to gtfiles. * cp-tree.h (flagged_type_tree_s): Remove lookups field. (saved_scope): Likewise. (type_lookups): Remove. (deferred_access): New structure. (type_access_control): Remove. (save_type_access_control): Likewise. (reset_type_access_control): Likewise. (decl_type_access_control): Likewise. (push_deferring_access_checks): Declare. (resume_deferring_access_checks): Likewise. (stop_deferring_access_checks): Likewise. (pop_deferring_access_checks): Likewise. (get_deferred_access_checks): Likewise. (pop_to_parent_deferring_access_checks): Likewise. (perform_deferred_access_checks): Likewise. (perform_or_defer_access_check): Likewise. * decl.c (make_typename_type): Use perform_or_defer_access_check. (make_unbound_class_template): Likewise. (grokdeclarator): Don't call decl_type_access_control. * parser.c (cp_parser_context): Remove deferred_access_checks and deferring_access_checks_p fields. (cp_parser_context_new): Adjust. (cp_parser): Remove access_checks_lists. (cp_parser_defer_access_check): Remove. (cp_parser_start_deferring_access_checks): Remove. (cp_parser_stop_deferring_access_checks): Remove. (cp_parser_perform_deferred_access_checks): Remove. (cp_parser_nested_name_specifier_opt): Use new deferred access functions. (cp_parser_simple_declaration): Likewise. (cp_parser_template_id): Likewise. (cp_parser_function_definition): Likewise. (cp_parser_class_specifier): Likewise. (cp_parser_lookup_name): Likewise. (cp_parser_single_declaration): Likewise. (cp_parser_pre_parsed_nested_name_specifier): Likewise. (cp_parser_parse_tentatively): Likewise. (cp_parser_parse_definitely): Likewise. (yyparse): Likewise. (cp_parser_init_declarator): Remove access_checks parameter. Use new deferred access functions. (cp_parser_function_definition_from_specifiers_and_declarator): Likewise. (cp_parser_class_head): Remove deferring_access_checks_p and saved_access_checks parameters. Use new deferred access functions. (cp_parser_member_specification_opt): Don't call reset_type_access_control. * search.c (type_access_control): Remove. * semantics.c: Include "gt-cp-semantics.h". (deferred_type_access_control): Remove. (deferred_access_stack): New variable. (deferred_access_free_list): Likewise. (push_deferring_access_checks): New function. (resume_deferring_access_checks): Likewise. (stop_deferring_access_checks): Likewise. (pop_deferring_access_checks): Likewise. (get_deferred_access_checks): Likewise. (pop_to_parent_deferring_access_checks): Likewise. (perform_deferred_access_checks): New function, adapted from cp_parser_perform_deferred_access_checks. (perform_or_defer_access_check): New function, adapted from cp_parser_defer_access_check. (current_type_lookups): Remove. (deferred_type_access_control): Likewise. (decl_type_access_control): Likewise. (save_type_access_control): Likewise. (reset_type_access_control): Likewise. (begin_function_definition): Adjust. (begin_class_definiton): Likewise. From-SVN: r61283
2003-01-14 14:40:53 +01:00
return;
/* If not, record the check. */
deferred_access_stack->deferred_access_checks
= tree_cons (binfo, decl,
config-lang.in: Add semantics.c to gtfiles. * config-lang.in: Add semantics.c to gtfiles. * cp-tree.h (flagged_type_tree_s): Remove lookups field. (saved_scope): Likewise. (type_lookups): Remove. (deferred_access): New structure. (type_access_control): Remove. (save_type_access_control): Likewise. (reset_type_access_control): Likewise. (decl_type_access_control): Likewise. (push_deferring_access_checks): Declare. (resume_deferring_access_checks): Likewise. (stop_deferring_access_checks): Likewise. (pop_deferring_access_checks): Likewise. (get_deferred_access_checks): Likewise. (pop_to_parent_deferring_access_checks): Likewise. (perform_deferred_access_checks): Likewise. (perform_or_defer_access_check): Likewise. * decl.c (make_typename_type): Use perform_or_defer_access_check. (make_unbound_class_template): Likewise. (grokdeclarator): Don't call decl_type_access_control. * parser.c (cp_parser_context): Remove deferred_access_checks and deferring_access_checks_p fields. (cp_parser_context_new): Adjust. (cp_parser): Remove access_checks_lists. (cp_parser_defer_access_check): Remove. (cp_parser_start_deferring_access_checks): Remove. (cp_parser_stop_deferring_access_checks): Remove. (cp_parser_perform_deferred_access_checks): Remove. (cp_parser_nested_name_specifier_opt): Use new deferred access functions. (cp_parser_simple_declaration): Likewise. (cp_parser_template_id): Likewise. (cp_parser_function_definition): Likewise. (cp_parser_class_specifier): Likewise. (cp_parser_lookup_name): Likewise. (cp_parser_single_declaration): Likewise. (cp_parser_pre_parsed_nested_name_specifier): Likewise. (cp_parser_parse_tentatively): Likewise. (cp_parser_parse_definitely): Likewise. (yyparse): Likewise. (cp_parser_init_declarator): Remove access_checks parameter. Use new deferred access functions. (cp_parser_function_definition_from_specifiers_and_declarator): Likewise. (cp_parser_class_head): Remove deferring_access_checks_p and saved_access_checks parameters. Use new deferred access functions. (cp_parser_member_specification_opt): Don't call reset_type_access_control. * search.c (type_access_control): Remove. * semantics.c: Include "gt-cp-semantics.h". (deferred_type_access_control): Remove. (deferred_access_stack): New variable. (deferred_access_free_list): Likewise. (push_deferring_access_checks): New function. (resume_deferring_access_checks): Likewise. (stop_deferring_access_checks): Likewise. (pop_deferring_access_checks): Likewise. (get_deferred_access_checks): Likewise. (pop_to_parent_deferring_access_checks): Likewise. (perform_deferred_access_checks): New function, adapted from cp_parser_perform_deferred_access_checks. (perform_or_defer_access_check): New function, adapted from cp_parser_defer_access_check. (current_type_lookups): Remove. (deferred_type_access_control): Likewise. (decl_type_access_control): Likewise. (save_type_access_control): Likewise. (reset_type_access_control): Likewise. (begin_function_definition): Adjust. (begin_class_definiton): Likewise. From-SVN: r61283
2003-01-14 14:40:53 +01:00
deferred_access_stack->deferred_access_checks);
}
/* Returns nonzero if the current statement is a full expression,
Makefile.in (C_AND_OBJC_OBJS): Added c-semantics.o. 2000-07-01 Benjamin Chelf <chelf@codesourcery.com> * Makefile.in (C_AND_OBJC_OBJS): Added c-semantics.o. (c-semantics.o): New target. * c-common.h (TREE_LANG_FLAG_?): Added documentation. (genrtl_do_pushlevel): Moved from cp/cp-tree.h. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (gerntl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_decl_cleanup): Likewise. (DECL_ANON_UNION_ELEMS): Likewise. (emit_local_var): Likewise. (make_rtl_for_local_static): Likewise. (expand_cond): Likewise. (expand_stmt): Likewise. (c_expand_return): Likewise. (c_expand_start_case): Likewise. (do_case): Likewise. (COMPOUND_STMT_NO_SCOPE): Likewise. (c_expand_asm_operands): Likewise. (NEW_FOR_SCOPE_P): New macro. (expand_expr_stmt_fn): New type. (set_current_function_name_declared): Likewise. (current_function_name_declared): Likewise. (lang_expand_stmt): Likewise. (stmts_are_full_exprs_p): Likewise. (anon_aggr_type_p): Likewise. (lang_expand_expr_stmt): Likewise. (build_case_label): Likewise. * c-decl.c (lang_expand_expr_stmt): Initialize. (stmts_are_full_exprs_p): Define. (current_function_name_declared): Likewise. (do_case): Likewise. (lang_expand_stmt): Likewise. (set_current_function_name_declared): Likewise. (anon_aggr_type_p): Likewise. (build_case_label): Likewise. * c-semantics.c: New file. (expand_cond): Moved from cp/semantics.c. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_decl_cleanup): Likewise. (make_rtl_for_local_static): Moved from cp/decl.c. (emit_local_var): Likewise. (expand_stmt): Define. * c-tree.h: (c_expand_asm_operands): Moved to c-common.h. (c_expand_return): Likewise. (c_expand_start_case): Likewise. * cp/Make-lang.in (cc1plus$(exeext)): Added c-semantics.o. * cp/Makefile.in (OBJS): Added ../c-semantics.o. (OBJDEPS): Likewise. * cp/cp-tree.h (TREE_LANG_FLAG_?): Moved common documentation to ../c-common.h. (struct stmt_tree): Added comment. (current_function_name_declared): Removed. (stmts_are_full_exprs_p): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (COMPOUND_STMT_NO_SCOPE): Moved to ../c-common.h. (DECL_ANON_UNION_ELEMS): Likewise. (emit_local_var): Likewise. (make_rtl_for_local_static): Likewise. (do_case): Likewise. (expand_stmt): Likewise. (genrtl_decl_cleanup): Likewise. (c_expand_asm_operands): Likewise. (c_expand_return): Likewise. (c_expand_start_case): Likewise. * cp/decl.c (make_rtl_for_local_static): Moved to c-semantics.c. (emit_local_var): Likewise. (initialize_local_var): Change reference to stmts_are_full_exprs_p to call to stmts_are_full_exprs_p(). Change reference to stmts_are_full_exprs_p to current_stmt_tree->stmts_are_full_exprs_p. (push_cp_function_context): Likewise. * cp/expect.c (expand_throw): Change reference to stmts_are_full_exprs_p. * cp/init.c (build_aggr_init): Change reference to stmts_are_full_exprs_p. (build_vec_init): Likewise. * cp/optimize.c (maybe_clone_body): Change reference to current_function_name_declared to cp_function_chain->name_declared. * cp/pt.c (instantiate_decl): Change reference to current_function_name_declared to cp_function_chain->name_declared. * cp/semantics.c (expand_cond): Moved declaration to c-common.h. (genrtl_do_pushlevel): Moved to c-semantics.c. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (gerntl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_decl_cleanup): Likewise. (expand_cond): Likewise. (expand_stmt): Renamed to ... (lang_expand_stmt): ... this. (lang_expand_expr_stmt): Initialize. (set_current_function_name_declared): Likewise. (stmts_are_full_exprs_p): Likewise. (current_function_name_declared): Likewise. (anon_aggr_type_p): Likewise. (do_poplevel): Change reference to stmts_are_full_exprs_p to call to stmts_are_full_exprs_p(). Change reference to stmts_are_full_exprs_p to current_stmt_tree->stmts_are_full_exprs_p. (add_tree): Likewise. (finish_expr_stmt): Likewise. (prep_stmt): Likewise. (lang_expand_stmt): Likewise. (begin_compound_stmt): Change reference to current_function_name_declared to cp_function_chain->name_declared and call to current_function_name_declared(). (setup_vtbl_ptr): Likewise. (genrtl_do_poplevel): Removed. From-SVN: r34827
2000-07-02 07:23:01 +02:00
i.e. temporaries created during that statement should be destroyed
at the end of the statement. */
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
Makefile.in (C_AND_OBJC_OBJS): Added c-semantics.o. 2000-07-01 Benjamin Chelf <chelf@codesourcery.com> * Makefile.in (C_AND_OBJC_OBJS): Added c-semantics.o. (c-semantics.o): New target. * c-common.h (TREE_LANG_FLAG_?): Added documentation. (genrtl_do_pushlevel): Moved from cp/cp-tree.h. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (gerntl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_decl_cleanup): Likewise. (DECL_ANON_UNION_ELEMS): Likewise. (emit_local_var): Likewise. (make_rtl_for_local_static): Likewise. (expand_cond): Likewise. (expand_stmt): Likewise. (c_expand_return): Likewise. (c_expand_start_case): Likewise. (do_case): Likewise. (COMPOUND_STMT_NO_SCOPE): Likewise. (c_expand_asm_operands): Likewise. (NEW_FOR_SCOPE_P): New macro. (expand_expr_stmt_fn): New type. (set_current_function_name_declared): Likewise. (current_function_name_declared): Likewise. (lang_expand_stmt): Likewise. (stmts_are_full_exprs_p): Likewise. (anon_aggr_type_p): Likewise. (lang_expand_expr_stmt): Likewise. (build_case_label): Likewise. * c-decl.c (lang_expand_expr_stmt): Initialize. (stmts_are_full_exprs_p): Define. (current_function_name_declared): Likewise. (do_case): Likewise. (lang_expand_stmt): Likewise. (set_current_function_name_declared): Likewise. (anon_aggr_type_p): Likewise. (build_case_label): Likewise. * c-semantics.c: New file. (expand_cond): Moved from cp/semantics.c. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_decl_cleanup): Likewise. (make_rtl_for_local_static): Moved from cp/decl.c. (emit_local_var): Likewise. (expand_stmt): Define. * c-tree.h: (c_expand_asm_operands): Moved to c-common.h. (c_expand_return): Likewise. (c_expand_start_case): Likewise. * cp/Make-lang.in (cc1plus$(exeext)): Added c-semantics.o. * cp/Makefile.in (OBJS): Added ../c-semantics.o. (OBJDEPS): Likewise. * cp/cp-tree.h (TREE_LANG_FLAG_?): Moved common documentation to ../c-common.h. (struct stmt_tree): Added comment. (current_function_name_declared): Removed. (stmts_are_full_exprs_p): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (COMPOUND_STMT_NO_SCOPE): Moved to ../c-common.h. (DECL_ANON_UNION_ELEMS): Likewise. (emit_local_var): Likewise. (make_rtl_for_local_static): Likewise. (do_case): Likewise. (expand_stmt): Likewise. (genrtl_decl_cleanup): Likewise. (c_expand_asm_operands): Likewise. (c_expand_return): Likewise. (c_expand_start_case): Likewise. * cp/decl.c (make_rtl_for_local_static): Moved to c-semantics.c. (emit_local_var): Likewise. (initialize_local_var): Change reference to stmts_are_full_exprs_p to call to stmts_are_full_exprs_p(). Change reference to stmts_are_full_exprs_p to current_stmt_tree->stmts_are_full_exprs_p. (push_cp_function_context): Likewise. * cp/expect.c (expand_throw): Change reference to stmts_are_full_exprs_p. * cp/init.c (build_aggr_init): Change reference to stmts_are_full_exprs_p. (build_vec_init): Likewise. * cp/optimize.c (maybe_clone_body): Change reference to current_function_name_declared to cp_function_chain->name_declared. * cp/pt.c (instantiate_decl): Change reference to current_function_name_declared to cp_function_chain->name_declared. * cp/semantics.c (expand_cond): Moved declaration to c-common.h. (genrtl_do_pushlevel): Moved to c-semantics.c. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (gerntl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_decl_cleanup): Likewise. (expand_cond): Likewise. (expand_stmt): Renamed to ... (lang_expand_stmt): ... this. (lang_expand_expr_stmt): Initialize. (set_current_function_name_declared): Likewise. (stmts_are_full_exprs_p): Likewise. (current_function_name_declared): Likewise. (anon_aggr_type_p): Likewise. (do_poplevel): Change reference to stmts_are_full_exprs_p to call to stmts_are_full_exprs_p(). Change reference to stmts_are_full_exprs_p to current_stmt_tree->stmts_are_full_exprs_p. (add_tree): Likewise. (finish_expr_stmt): Likewise. (prep_stmt): Likewise. (lang_expand_stmt): Likewise. (begin_compound_stmt): Change reference to current_function_name_declared to cp_function_chain->name_declared and call to current_function_name_declared(). (setup_vtbl_ptr): Likewise. (genrtl_do_poplevel): Removed. From-SVN: r34827
2000-07-02 07:23:01 +02:00
int
stmts_are_full_exprs_p (void)
Makefile.in (C_AND_OBJC_OBJS): Added c-semantics.o. 2000-07-01 Benjamin Chelf <chelf@codesourcery.com> * Makefile.in (C_AND_OBJC_OBJS): Added c-semantics.o. (c-semantics.o): New target. * c-common.h (TREE_LANG_FLAG_?): Added documentation. (genrtl_do_pushlevel): Moved from cp/cp-tree.h. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (gerntl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_decl_cleanup): Likewise. (DECL_ANON_UNION_ELEMS): Likewise. (emit_local_var): Likewise. (make_rtl_for_local_static): Likewise. (expand_cond): Likewise. (expand_stmt): Likewise. (c_expand_return): Likewise. (c_expand_start_case): Likewise. (do_case): Likewise. (COMPOUND_STMT_NO_SCOPE): Likewise. (c_expand_asm_operands): Likewise. (NEW_FOR_SCOPE_P): New macro. (expand_expr_stmt_fn): New type. (set_current_function_name_declared): Likewise. (current_function_name_declared): Likewise. (lang_expand_stmt): Likewise. (stmts_are_full_exprs_p): Likewise. (anon_aggr_type_p): Likewise. (lang_expand_expr_stmt): Likewise. (build_case_label): Likewise. * c-decl.c (lang_expand_expr_stmt): Initialize. (stmts_are_full_exprs_p): Define. (current_function_name_declared): Likewise. (do_case): Likewise. (lang_expand_stmt): Likewise. (set_current_function_name_declared): Likewise. (anon_aggr_type_p): Likewise. (build_case_label): Likewise. * c-semantics.c: New file. (expand_cond): Moved from cp/semantics.c. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_decl_cleanup): Likewise. (make_rtl_for_local_static): Moved from cp/decl.c. (emit_local_var): Likewise. (expand_stmt): Define. * c-tree.h: (c_expand_asm_operands): Moved to c-common.h. (c_expand_return): Likewise. (c_expand_start_case): Likewise. * cp/Make-lang.in (cc1plus$(exeext)): Added c-semantics.o. * cp/Makefile.in (OBJS): Added ../c-semantics.o. (OBJDEPS): Likewise. * cp/cp-tree.h (TREE_LANG_FLAG_?): Moved common documentation to ../c-common.h. (struct stmt_tree): Added comment. (current_function_name_declared): Removed. (stmts_are_full_exprs_p): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (COMPOUND_STMT_NO_SCOPE): Moved to ../c-common.h. (DECL_ANON_UNION_ELEMS): Likewise. (emit_local_var): Likewise. (make_rtl_for_local_static): Likewise. (do_case): Likewise. (expand_stmt): Likewise. (genrtl_decl_cleanup): Likewise. (c_expand_asm_operands): Likewise. (c_expand_return): Likewise. (c_expand_start_case): Likewise. * cp/decl.c (make_rtl_for_local_static): Moved to c-semantics.c. (emit_local_var): Likewise. (initialize_local_var): Change reference to stmts_are_full_exprs_p to call to stmts_are_full_exprs_p(). Change reference to stmts_are_full_exprs_p to current_stmt_tree->stmts_are_full_exprs_p. (push_cp_function_context): Likewise. * cp/expect.c (expand_throw): Change reference to stmts_are_full_exprs_p. * cp/init.c (build_aggr_init): Change reference to stmts_are_full_exprs_p. (build_vec_init): Likewise. * cp/optimize.c (maybe_clone_body): Change reference to current_function_name_declared to cp_function_chain->name_declared. * cp/pt.c (instantiate_decl): Change reference to current_function_name_declared to cp_function_chain->name_declared. * cp/semantics.c (expand_cond): Moved declaration to c-common.h. (genrtl_do_pushlevel): Moved to c-semantics.c. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (gerntl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_decl_cleanup): Likewise. (expand_cond): Likewise. (expand_stmt): Renamed to ... (lang_expand_stmt): ... this. (lang_expand_expr_stmt): Initialize. (set_current_function_name_declared): Likewise. (stmts_are_full_exprs_p): Likewise. (current_function_name_declared): Likewise. (anon_aggr_type_p): Likewise. (do_poplevel): Change reference to stmts_are_full_exprs_p to call to stmts_are_full_exprs_p(). Change reference to stmts_are_full_exprs_p to current_stmt_tree->stmts_are_full_exprs_p. (add_tree): Likewise. (finish_expr_stmt): Likewise. (prep_stmt): Likewise. (lang_expand_stmt): Likewise. (begin_compound_stmt): Change reference to current_function_name_declared to cp_function_chain->name_declared and call to current_function_name_declared(). (setup_vtbl_ptr): Likewise. (genrtl_do_poplevel): Removed. From-SVN: r34827
2000-07-02 07:23:01 +02:00
{
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
2000-09-07 03:36:11 +02:00
return current_stmt_tree ()->stmts_are_full_exprs_p;
}
/* 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 (void)
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
2000-09-07 03:36:11 +02:00
{
return (cfun
? &cfun->language->base.x_stmt_tree
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
2000-09-07 03:36:11 +02:00
: &scope_chain->x_stmt_tree);
Makefile.in (C_AND_OBJC_OBJS): Added c-semantics.o. 2000-07-01 Benjamin Chelf <chelf@codesourcery.com> * Makefile.in (C_AND_OBJC_OBJS): Added c-semantics.o. (c-semantics.o): New target. * c-common.h (TREE_LANG_FLAG_?): Added documentation. (genrtl_do_pushlevel): Moved from cp/cp-tree.h. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (gerntl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_decl_cleanup): Likewise. (DECL_ANON_UNION_ELEMS): Likewise. (emit_local_var): Likewise. (make_rtl_for_local_static): Likewise. (expand_cond): Likewise. (expand_stmt): Likewise. (c_expand_return): Likewise. (c_expand_start_case): Likewise. (do_case): Likewise. (COMPOUND_STMT_NO_SCOPE): Likewise. (c_expand_asm_operands): Likewise. (NEW_FOR_SCOPE_P): New macro. (expand_expr_stmt_fn): New type. (set_current_function_name_declared): Likewise. (current_function_name_declared): Likewise. (lang_expand_stmt): Likewise. (stmts_are_full_exprs_p): Likewise. (anon_aggr_type_p): Likewise. (lang_expand_expr_stmt): Likewise. (build_case_label): Likewise. * c-decl.c (lang_expand_expr_stmt): Initialize. (stmts_are_full_exprs_p): Define. (current_function_name_declared): Likewise. (do_case): Likewise. (lang_expand_stmt): Likewise. (set_current_function_name_declared): Likewise. (anon_aggr_type_p): Likewise. (build_case_label): Likewise. * c-semantics.c: New file. (expand_cond): Moved from cp/semantics.c. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_decl_cleanup): Likewise. (make_rtl_for_local_static): Moved from cp/decl.c. (emit_local_var): Likewise. (expand_stmt): Define. * c-tree.h: (c_expand_asm_operands): Moved to c-common.h. (c_expand_return): Likewise. (c_expand_start_case): Likewise. * cp/Make-lang.in (cc1plus$(exeext)): Added c-semantics.o. * cp/Makefile.in (OBJS): Added ../c-semantics.o. (OBJDEPS): Likewise. * cp/cp-tree.h (TREE_LANG_FLAG_?): Moved common documentation to ../c-common.h. (struct stmt_tree): Added comment. (current_function_name_declared): Removed. (stmts_are_full_exprs_p): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (COMPOUND_STMT_NO_SCOPE): Moved to ../c-common.h. (DECL_ANON_UNION_ELEMS): Likewise. (emit_local_var): Likewise. (make_rtl_for_local_static): Likewise. (do_case): Likewise. (expand_stmt): Likewise. (genrtl_decl_cleanup): Likewise. (c_expand_asm_operands): Likewise. (c_expand_return): Likewise. (c_expand_start_case): Likewise. * cp/decl.c (make_rtl_for_local_static): Moved to c-semantics.c. (emit_local_var): Likewise. (initialize_local_var): Change reference to stmts_are_full_exprs_p to call to stmts_are_full_exprs_p(). Change reference to stmts_are_full_exprs_p to current_stmt_tree->stmts_are_full_exprs_p. (push_cp_function_context): Likewise. * cp/expect.c (expand_throw): Change reference to stmts_are_full_exprs_p. * cp/init.c (build_aggr_init): Change reference to stmts_are_full_exprs_p. (build_vec_init): Likewise. * cp/optimize.c (maybe_clone_body): Change reference to current_function_name_declared to cp_function_chain->name_declared. * cp/pt.c (instantiate_decl): Change reference to current_function_name_declared to cp_function_chain->name_declared. * cp/semantics.c (expand_cond): Moved declaration to c-common.h. (genrtl_do_pushlevel): Moved to c-semantics.c. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (gerntl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_decl_cleanup): Likewise. (expand_cond): Likewise. (expand_stmt): Renamed to ... (lang_expand_stmt): ... this. (lang_expand_expr_stmt): Initialize. (set_current_function_name_declared): Likewise. (stmts_are_full_exprs_p): Likewise. (current_function_name_declared): Likewise. (anon_aggr_type_p): Likewise. (do_poplevel): Change reference to stmts_are_full_exprs_p to call to stmts_are_full_exprs_p(). Change reference to stmts_are_full_exprs_p to current_stmt_tree->stmts_are_full_exprs_p. (add_tree): Likewise. (finish_expr_stmt): Likewise. (prep_stmt): Likewise. (lang_expand_stmt): Likewise. (begin_compound_stmt): Change reference to current_function_name_declared to cp_function_chain->name_declared and call to current_function_name_declared(). (setup_vtbl_ptr): Likewise. (genrtl_do_poplevel): Removed. From-SVN: r34827
2000-07-02 07:23:01 +02:00
}
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
Makefile.in (C_AND_OBJC_OBJS): Added c-semantics.o. 2000-07-01 Benjamin Chelf <chelf@codesourcery.com> * Makefile.in (C_AND_OBJC_OBJS): Added c-semantics.o. (c-semantics.o): New target. * c-common.h (TREE_LANG_FLAG_?): Added documentation. (genrtl_do_pushlevel): Moved from cp/cp-tree.h. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (gerntl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_decl_cleanup): Likewise. (DECL_ANON_UNION_ELEMS): Likewise. (emit_local_var): Likewise. (make_rtl_for_local_static): Likewise. (expand_cond): Likewise. (expand_stmt): Likewise. (c_expand_return): Likewise. (c_expand_start_case): Likewise. (do_case): Likewise. (COMPOUND_STMT_NO_SCOPE): Likewise. (c_expand_asm_operands): Likewise. (NEW_FOR_SCOPE_P): New macro. (expand_expr_stmt_fn): New type. (set_current_function_name_declared): Likewise. (current_function_name_declared): Likewise. (lang_expand_stmt): Likewise. (stmts_are_full_exprs_p): Likewise. (anon_aggr_type_p): Likewise. (lang_expand_expr_stmt): Likewise. (build_case_label): Likewise. * c-decl.c (lang_expand_expr_stmt): Initialize. (stmts_are_full_exprs_p): Define. (current_function_name_declared): Likewise. (do_case): Likewise. (lang_expand_stmt): Likewise. (set_current_function_name_declared): Likewise. (anon_aggr_type_p): Likewise. (build_case_label): Likewise. * c-semantics.c: New file. (expand_cond): Moved from cp/semantics.c. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_decl_cleanup): Likewise. (make_rtl_for_local_static): Moved from cp/decl.c. (emit_local_var): Likewise. (expand_stmt): Define. * c-tree.h: (c_expand_asm_operands): Moved to c-common.h. (c_expand_return): Likewise. (c_expand_start_case): Likewise. * cp/Make-lang.in (cc1plus$(exeext)): Added c-semantics.o. * cp/Makefile.in (OBJS): Added ../c-semantics.o. (OBJDEPS): Likewise. * cp/cp-tree.h (TREE_LANG_FLAG_?): Moved common documentation to ../c-common.h. (struct stmt_tree): Added comment. (current_function_name_declared): Removed. (stmts_are_full_exprs_p): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (COMPOUND_STMT_NO_SCOPE): Moved to ../c-common.h. (DECL_ANON_UNION_ELEMS): Likewise. (emit_local_var): Likewise. (make_rtl_for_local_static): Likewise. (do_case): Likewise. (expand_stmt): Likewise. (genrtl_decl_cleanup): Likewise. (c_expand_asm_operands): Likewise. (c_expand_return): Likewise. (c_expand_start_case): Likewise. * cp/decl.c (make_rtl_for_local_static): Moved to c-semantics.c. (emit_local_var): Likewise. (initialize_local_var): Change reference to stmts_are_full_exprs_p to call to stmts_are_full_exprs_p(). Change reference to stmts_are_full_exprs_p to current_stmt_tree->stmts_are_full_exprs_p. (push_cp_function_context): Likewise. * cp/expect.c (expand_throw): Change reference to stmts_are_full_exprs_p. * cp/init.c (build_aggr_init): Change reference to stmts_are_full_exprs_p. (build_vec_init): Likewise. * cp/optimize.c (maybe_clone_body): Change reference to current_function_name_declared to cp_function_chain->name_declared. * cp/pt.c (instantiate_decl): Change reference to current_function_name_declared to cp_function_chain->name_declared. * cp/semantics.c (expand_cond): Moved declaration to c-common.h. (genrtl_do_pushlevel): Moved to c-semantics.c. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (gerntl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_decl_cleanup): Likewise. (expand_cond): Likewise. (expand_stmt): Renamed to ... (lang_expand_stmt): ... this. (lang_expand_expr_stmt): Initialize. (set_current_function_name_declared): Likewise. (stmts_are_full_exprs_p): Likewise. (current_function_name_declared): Likewise. (anon_aggr_type_p): Likewise. (do_poplevel): Change reference to stmts_are_full_exprs_p to call to stmts_are_full_exprs_p(). Change reference to stmts_are_full_exprs_p to current_stmt_tree->stmts_are_full_exprs_p. (add_tree): Likewise. (finish_expr_stmt): Likewise. (prep_stmt): Likewise. (lang_expand_stmt): Likewise. (begin_compound_stmt): Change reference to current_function_name_declared to cp_function_chain->name_declared and call to current_function_name_declared(). (setup_vtbl_ptr): Likewise. (genrtl_do_poplevel): Removed. From-SVN: r34827
2000-07-02 07:23:01 +02:00
/* Nonzero if TYPE is an anonymous union or struct type. We have to use a
flag for this because "A union for which objects or pointers are
declared is not an anonymous union" [class.union]. */
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
Makefile.in (C_AND_OBJC_OBJS): Added c-semantics.o. 2000-07-01 Benjamin Chelf <chelf@codesourcery.com> * Makefile.in (C_AND_OBJC_OBJS): Added c-semantics.o. (c-semantics.o): New target. * c-common.h (TREE_LANG_FLAG_?): Added documentation. (genrtl_do_pushlevel): Moved from cp/cp-tree.h. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (gerntl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_decl_cleanup): Likewise. (DECL_ANON_UNION_ELEMS): Likewise. (emit_local_var): Likewise. (make_rtl_for_local_static): Likewise. (expand_cond): Likewise. (expand_stmt): Likewise. (c_expand_return): Likewise. (c_expand_start_case): Likewise. (do_case): Likewise. (COMPOUND_STMT_NO_SCOPE): Likewise. (c_expand_asm_operands): Likewise. (NEW_FOR_SCOPE_P): New macro. (expand_expr_stmt_fn): New type. (set_current_function_name_declared): Likewise. (current_function_name_declared): Likewise. (lang_expand_stmt): Likewise. (stmts_are_full_exprs_p): Likewise. (anon_aggr_type_p): Likewise. (lang_expand_expr_stmt): Likewise. (build_case_label): Likewise. * c-decl.c (lang_expand_expr_stmt): Initialize. (stmts_are_full_exprs_p): Define. (current_function_name_declared): Likewise. (do_case): Likewise. (lang_expand_stmt): Likewise. (set_current_function_name_declared): Likewise. (anon_aggr_type_p): Likewise. (build_case_label): Likewise. * c-semantics.c: New file. (expand_cond): Moved from cp/semantics.c. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_decl_cleanup): Likewise. (make_rtl_for_local_static): Moved from cp/decl.c. (emit_local_var): Likewise. (expand_stmt): Define. * c-tree.h: (c_expand_asm_operands): Moved to c-common.h. (c_expand_return): Likewise. (c_expand_start_case): Likewise. * cp/Make-lang.in (cc1plus$(exeext)): Added c-semantics.o. * cp/Makefile.in (OBJS): Added ../c-semantics.o. (OBJDEPS): Likewise. * cp/cp-tree.h (TREE_LANG_FLAG_?): Moved common documentation to ../c-common.h. (struct stmt_tree): Added comment. (current_function_name_declared): Removed. (stmts_are_full_exprs_p): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (COMPOUND_STMT_NO_SCOPE): Moved to ../c-common.h. (DECL_ANON_UNION_ELEMS): Likewise. (emit_local_var): Likewise. (make_rtl_for_local_static): Likewise. (do_case): Likewise. (expand_stmt): Likewise. (genrtl_decl_cleanup): Likewise. (c_expand_asm_operands): Likewise. (c_expand_return): Likewise. (c_expand_start_case): Likewise. * cp/decl.c (make_rtl_for_local_static): Moved to c-semantics.c. (emit_local_var): Likewise. (initialize_local_var): Change reference to stmts_are_full_exprs_p to call to stmts_are_full_exprs_p(). Change reference to stmts_are_full_exprs_p to current_stmt_tree->stmts_are_full_exprs_p. (push_cp_function_context): Likewise. * cp/expect.c (expand_throw): Change reference to stmts_are_full_exprs_p. * cp/init.c (build_aggr_init): Change reference to stmts_are_full_exprs_p. (build_vec_init): Likewise. * cp/optimize.c (maybe_clone_body): Change reference to current_function_name_declared to cp_function_chain->name_declared. * cp/pt.c (instantiate_decl): Change reference to current_function_name_declared to cp_function_chain->name_declared. * cp/semantics.c (expand_cond): Moved declaration to c-common.h. (genrtl_do_pushlevel): Moved to c-semantics.c. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (gerntl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_decl_cleanup): Likewise. (expand_cond): Likewise. (expand_stmt): Renamed to ... (lang_expand_stmt): ... this. (lang_expand_expr_stmt): Initialize. (set_current_function_name_declared): Likewise. (stmts_are_full_exprs_p): Likewise. (current_function_name_declared): Likewise. (anon_aggr_type_p): Likewise. (do_poplevel): Change reference to stmts_are_full_exprs_p to call to stmts_are_full_exprs_p(). Change reference to stmts_are_full_exprs_p to current_stmt_tree->stmts_are_full_exprs_p. (add_tree): Likewise. (finish_expr_stmt): Likewise. (prep_stmt): Likewise. (lang_expand_stmt): Likewise. (begin_compound_stmt): Change reference to current_function_name_declared to cp_function_chain->name_declared and call to current_function_name_declared(). (setup_vtbl_ptr): Likewise. (genrtl_do_poplevel): Removed. From-SVN: r34827
2000-07-02 07:23:01 +02:00
int
anon_aggr_type_p (tree node)
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
{
return ANON_AGGR_TYPE_P (node);
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
}
Makefile.in (C_AND_OBJC_OBJS): Added c-semantics.o. 2000-07-01 Benjamin Chelf <chelf@codesourcery.com> * Makefile.in (C_AND_OBJC_OBJS): Added c-semantics.o. (c-semantics.o): New target. * c-common.h (TREE_LANG_FLAG_?): Added documentation. (genrtl_do_pushlevel): Moved from cp/cp-tree.h. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (gerntl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_decl_cleanup): Likewise. (DECL_ANON_UNION_ELEMS): Likewise. (emit_local_var): Likewise. (make_rtl_for_local_static): Likewise. (expand_cond): Likewise. (expand_stmt): Likewise. (c_expand_return): Likewise. (c_expand_start_case): Likewise. (do_case): Likewise. (COMPOUND_STMT_NO_SCOPE): Likewise. (c_expand_asm_operands): Likewise. (NEW_FOR_SCOPE_P): New macro. (expand_expr_stmt_fn): New type. (set_current_function_name_declared): Likewise. (current_function_name_declared): Likewise. (lang_expand_stmt): Likewise. (stmts_are_full_exprs_p): Likewise. (anon_aggr_type_p): Likewise. (lang_expand_expr_stmt): Likewise. (build_case_label): Likewise. * c-decl.c (lang_expand_expr_stmt): Initialize. (stmts_are_full_exprs_p): Define. (current_function_name_declared): Likewise. (do_case): Likewise. (lang_expand_stmt): Likewise. (set_current_function_name_declared): Likewise. (anon_aggr_type_p): Likewise. (build_case_label): Likewise. * c-semantics.c: New file. (expand_cond): Moved from cp/semantics.c. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_decl_cleanup): Likewise. (make_rtl_for_local_static): Moved from cp/decl.c. (emit_local_var): Likewise. (expand_stmt): Define. * c-tree.h: (c_expand_asm_operands): Moved to c-common.h. (c_expand_return): Likewise. (c_expand_start_case): Likewise. * cp/Make-lang.in (cc1plus$(exeext)): Added c-semantics.o. * cp/Makefile.in (OBJS): Added ../c-semantics.o. (OBJDEPS): Likewise. * cp/cp-tree.h (TREE_LANG_FLAG_?): Moved common documentation to ../c-common.h. (struct stmt_tree): Added comment. (current_function_name_declared): Removed. (stmts_are_full_exprs_p): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (COMPOUND_STMT_NO_SCOPE): Moved to ../c-common.h. (DECL_ANON_UNION_ELEMS): Likewise. (emit_local_var): Likewise. (make_rtl_for_local_static): Likewise. (do_case): Likewise. (expand_stmt): Likewise. (genrtl_decl_cleanup): Likewise. (c_expand_asm_operands): Likewise. (c_expand_return): Likewise. (c_expand_start_case): Likewise. * cp/decl.c (make_rtl_for_local_static): Moved to c-semantics.c. (emit_local_var): Likewise. (initialize_local_var): Change reference to stmts_are_full_exprs_p to call to stmts_are_full_exprs_p(). Change reference to stmts_are_full_exprs_p to current_stmt_tree->stmts_are_full_exprs_p. (push_cp_function_context): Likewise. * cp/expect.c (expand_throw): Change reference to stmts_are_full_exprs_p. * cp/init.c (build_aggr_init): Change reference to stmts_are_full_exprs_p. (build_vec_init): Likewise. * cp/optimize.c (maybe_clone_body): Change reference to current_function_name_declared to cp_function_chain->name_declared. * cp/pt.c (instantiate_decl): Change reference to current_function_name_declared to cp_function_chain->name_declared. * cp/semantics.c (expand_cond): Moved declaration to c-common.h. (genrtl_do_pushlevel): Moved to c-semantics.c. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (gerntl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_decl_cleanup): Likewise. (expand_cond): Likewise. (expand_stmt): Renamed to ... (lang_expand_stmt): ... this. (lang_expand_expr_stmt): Initialize. (set_current_function_name_declared): Likewise. (stmts_are_full_exprs_p): Likewise. (current_function_name_declared): Likewise. (anon_aggr_type_p): Likewise. (do_poplevel): Change reference to stmts_are_full_exprs_p to call to stmts_are_full_exprs_p(). Change reference to stmts_are_full_exprs_p to current_stmt_tree->stmts_are_full_exprs_p. (add_tree): Likewise. (finish_expr_stmt): Likewise. (prep_stmt): Likewise. (lang_expand_stmt): Likewise. (begin_compound_stmt): Change reference to current_function_name_declared to cp_function_chain->name_declared and call to current_function_name_declared(). (setup_vtbl_ptr): Likewise. (genrtl_do_poplevel): Removed. From-SVN: r34827
2000-07-02 07:23:01 +02:00
/* Finish a scope. */
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
tree
do_poplevel (void)
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
{
tree block = NULL_TREE;
Makefile.in (C_AND_OBJC_OBJS): Added c-semantics.o. 2000-07-01 Benjamin Chelf <chelf@codesourcery.com> * Makefile.in (C_AND_OBJC_OBJS): Added c-semantics.o. (c-semantics.o): New target. * c-common.h (TREE_LANG_FLAG_?): Added documentation. (genrtl_do_pushlevel): Moved from cp/cp-tree.h. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (gerntl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_decl_cleanup): Likewise. (DECL_ANON_UNION_ELEMS): Likewise. (emit_local_var): Likewise. (make_rtl_for_local_static): Likewise. (expand_cond): Likewise. (expand_stmt): Likewise. (c_expand_return): Likewise. (c_expand_start_case): Likewise. (do_case): Likewise. (COMPOUND_STMT_NO_SCOPE): Likewise. (c_expand_asm_operands): Likewise. (NEW_FOR_SCOPE_P): New macro. (expand_expr_stmt_fn): New type. (set_current_function_name_declared): Likewise. (current_function_name_declared): Likewise. (lang_expand_stmt): Likewise. (stmts_are_full_exprs_p): Likewise. (anon_aggr_type_p): Likewise. (lang_expand_expr_stmt): Likewise. (build_case_label): Likewise. * c-decl.c (lang_expand_expr_stmt): Initialize. (stmts_are_full_exprs_p): Define. (current_function_name_declared): Likewise. (do_case): Likewise. (lang_expand_stmt): Likewise. (set_current_function_name_declared): Likewise. (anon_aggr_type_p): Likewise. (build_case_label): Likewise. * c-semantics.c: New file. (expand_cond): Moved from cp/semantics.c. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_decl_cleanup): Likewise. (make_rtl_for_local_static): Moved from cp/decl.c. (emit_local_var): Likewise. (expand_stmt): Define. * c-tree.h: (c_expand_asm_operands): Moved to c-common.h. (c_expand_return): Likewise. (c_expand_start_case): Likewise. * cp/Make-lang.in (cc1plus$(exeext)): Added c-semantics.o. * cp/Makefile.in (OBJS): Added ../c-semantics.o. (OBJDEPS): Likewise. * cp/cp-tree.h (TREE_LANG_FLAG_?): Moved common documentation to ../c-common.h. (struct stmt_tree): Added comment. (current_function_name_declared): Removed. (stmts_are_full_exprs_p): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (COMPOUND_STMT_NO_SCOPE): Moved to ../c-common.h. (DECL_ANON_UNION_ELEMS): Likewise. (emit_local_var): Likewise. (make_rtl_for_local_static): Likewise. (do_case): Likewise. (expand_stmt): Likewise. (genrtl_decl_cleanup): Likewise. (c_expand_asm_operands): Likewise. (c_expand_return): Likewise. (c_expand_start_case): Likewise. * cp/decl.c (make_rtl_for_local_static): Moved to c-semantics.c. (emit_local_var): Likewise. (initialize_local_var): Change reference to stmts_are_full_exprs_p to call to stmts_are_full_exprs_p(). Change reference to stmts_are_full_exprs_p to current_stmt_tree->stmts_are_full_exprs_p. (push_cp_function_context): Likewise. * cp/expect.c (expand_throw): Change reference to stmts_are_full_exprs_p. * cp/init.c (build_aggr_init): Change reference to stmts_are_full_exprs_p. (build_vec_init): Likewise. * cp/optimize.c (maybe_clone_body): Change reference to current_function_name_declared to cp_function_chain->name_declared. * cp/pt.c (instantiate_decl): Change reference to current_function_name_declared to cp_function_chain->name_declared. * cp/semantics.c (expand_cond): Moved declaration to c-common.h. (genrtl_do_pushlevel): Moved to c-semantics.c. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (gerntl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_decl_cleanup): Likewise. (expand_cond): Likewise. (expand_stmt): Renamed to ... (lang_expand_stmt): ... this. (lang_expand_expr_stmt): Initialize. (set_current_function_name_declared): Likewise. (stmts_are_full_exprs_p): Likewise. (current_function_name_declared): Likewise. (anon_aggr_type_p): Likewise. (do_poplevel): Change reference to stmts_are_full_exprs_p to call to stmts_are_full_exprs_p(). Change reference to stmts_are_full_exprs_p to current_stmt_tree->stmts_are_full_exprs_p. (add_tree): Likewise. (finish_expr_stmt): Likewise. (prep_stmt): Likewise. (lang_expand_stmt): Likewise. (begin_compound_stmt): Change reference to current_function_name_declared to cp_function_chain->name_declared and call to current_function_name_declared(). (setup_vtbl_ptr): Likewise. (genrtl_do_poplevel): Removed. From-SVN: r34827
2000-07-02 07:23:01 +02:00
if (stmts_are_full_exprs_p ())
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
{
tree scope_stmts = NULL_TREE;
Makefile.in (C_AND_OBJC_OBJS): Added c-semantics.o. 2000-07-01 Benjamin Chelf <chelf@codesourcery.com> * Makefile.in (C_AND_OBJC_OBJS): Added c-semantics.o. (c-semantics.o): New target. * c-common.h (TREE_LANG_FLAG_?): Added documentation. (genrtl_do_pushlevel): Moved from cp/cp-tree.h. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (gerntl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_decl_cleanup): Likewise. (DECL_ANON_UNION_ELEMS): Likewise. (emit_local_var): Likewise. (make_rtl_for_local_static): Likewise. (expand_cond): Likewise. (expand_stmt): Likewise. (c_expand_return): Likewise. (c_expand_start_case): Likewise. (do_case): Likewise. (COMPOUND_STMT_NO_SCOPE): Likewise. (c_expand_asm_operands): Likewise. (NEW_FOR_SCOPE_P): New macro. (expand_expr_stmt_fn): New type. (set_current_function_name_declared): Likewise. (current_function_name_declared): Likewise. (lang_expand_stmt): Likewise. (stmts_are_full_exprs_p): Likewise. (anon_aggr_type_p): Likewise. (lang_expand_expr_stmt): Likewise. (build_case_label): Likewise. * c-decl.c (lang_expand_expr_stmt): Initialize. (stmts_are_full_exprs_p): Define. (current_function_name_declared): Likewise. (do_case): Likewise. (lang_expand_stmt): Likewise. (set_current_function_name_declared): Likewise. (anon_aggr_type_p): Likewise. (build_case_label): Likewise. * c-semantics.c: New file. (expand_cond): Moved from cp/semantics.c. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_decl_cleanup): Likewise. (make_rtl_for_local_static): Moved from cp/decl.c. (emit_local_var): Likewise. (expand_stmt): Define. * c-tree.h: (c_expand_asm_operands): Moved to c-common.h. (c_expand_return): Likewise. (c_expand_start_case): Likewise. * cp/Make-lang.in (cc1plus$(exeext)): Added c-semantics.o. * cp/Makefile.in (OBJS): Added ../c-semantics.o. (OBJDEPS): Likewise. * cp/cp-tree.h (TREE_LANG_FLAG_?): Moved common documentation to ../c-common.h. (struct stmt_tree): Added comment. (current_function_name_declared): Removed. (stmts_are_full_exprs_p): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (COMPOUND_STMT_NO_SCOPE): Moved to ../c-common.h. (DECL_ANON_UNION_ELEMS): Likewise. (emit_local_var): Likewise. (make_rtl_for_local_static): Likewise. (do_case): Likewise. (expand_stmt): Likewise. (genrtl_decl_cleanup): Likewise. (c_expand_asm_operands): Likewise. (c_expand_return): Likewise. (c_expand_start_case): Likewise. * cp/decl.c (make_rtl_for_local_static): Moved to c-semantics.c. (emit_local_var): Likewise. (initialize_local_var): Change reference to stmts_are_full_exprs_p to call to stmts_are_full_exprs_p(). Change reference to stmts_are_full_exprs_p to current_stmt_tree->stmts_are_full_exprs_p. (push_cp_function_context): Likewise. * cp/expect.c (expand_throw): Change reference to stmts_are_full_exprs_p. * cp/init.c (build_aggr_init): Change reference to stmts_are_full_exprs_p. (build_vec_init): Likewise. * cp/optimize.c (maybe_clone_body): Change reference to current_function_name_declared to cp_function_chain->name_declared. * cp/pt.c (instantiate_decl): Change reference to current_function_name_declared to cp_function_chain->name_declared. * cp/semantics.c (expand_cond): Moved declaration to c-common.h. (genrtl_do_pushlevel): Moved to c-semantics.c. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (gerntl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_decl_cleanup): Likewise. (expand_cond): Likewise. (expand_stmt): Renamed to ... (lang_expand_stmt): ... this. (lang_expand_expr_stmt): Initialize. (set_current_function_name_declared): Likewise. (stmts_are_full_exprs_p): Likewise. (current_function_name_declared): Likewise. (anon_aggr_type_p): Likewise. (do_poplevel): Change reference to stmts_are_full_exprs_p to call to stmts_are_full_exprs_p(). Change reference to stmts_are_full_exprs_p to current_stmt_tree->stmts_are_full_exprs_p. (add_tree): Likewise. (finish_expr_stmt): Likewise. (prep_stmt): Likewise. (lang_expand_stmt): Likewise. (begin_compound_stmt): Change reference to current_function_name_declared to cp_function_chain->name_declared and call to current_function_name_declared(). (setup_vtbl_ptr): Likewise. (genrtl_do_poplevel): Removed. From-SVN: r34827
2000-07-02 07:23:01 +02:00
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
block = poplevel (kept_level_p (), 1, 0);
if (!processing_template_decl)
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
{
/* This needs to come after the poplevel so that partial scopes
are properly nested. */
scope_stmts = add_scope_stmt (/*begin_p=*/0, /*partial_p=*/0);
if (block)
{
SCOPE_STMT_BLOCK (TREE_PURPOSE (scope_stmts)) = block;
SCOPE_STMT_BLOCK (TREE_VALUE (scope_stmts)) = block;
}
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
}
}
return block;
}
Makefile.in (C_AND_OBJC_OBJS): Added c-semantics.o. 2000-07-01 Benjamin Chelf <chelf@codesourcery.com> * Makefile.in (C_AND_OBJC_OBJS): Added c-semantics.o. (c-semantics.o): New target. * c-common.h (TREE_LANG_FLAG_?): Added documentation. (genrtl_do_pushlevel): Moved from cp/cp-tree.h. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (gerntl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_decl_cleanup): Likewise. (DECL_ANON_UNION_ELEMS): Likewise. (emit_local_var): Likewise. (make_rtl_for_local_static): Likewise. (expand_cond): Likewise. (expand_stmt): Likewise. (c_expand_return): Likewise. (c_expand_start_case): Likewise. (do_case): Likewise. (COMPOUND_STMT_NO_SCOPE): Likewise. (c_expand_asm_operands): Likewise. (NEW_FOR_SCOPE_P): New macro. (expand_expr_stmt_fn): New type. (set_current_function_name_declared): Likewise. (current_function_name_declared): Likewise. (lang_expand_stmt): Likewise. (stmts_are_full_exprs_p): Likewise. (anon_aggr_type_p): Likewise. (lang_expand_expr_stmt): Likewise. (build_case_label): Likewise. * c-decl.c (lang_expand_expr_stmt): Initialize. (stmts_are_full_exprs_p): Define. (current_function_name_declared): Likewise. (do_case): Likewise. (lang_expand_stmt): Likewise. (set_current_function_name_declared): Likewise. (anon_aggr_type_p): Likewise. (build_case_label): Likewise. * c-semantics.c: New file. (expand_cond): Moved from cp/semantics.c. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_decl_cleanup): Likewise. (make_rtl_for_local_static): Moved from cp/decl.c. (emit_local_var): Likewise. (expand_stmt): Define. * c-tree.h: (c_expand_asm_operands): Moved to c-common.h. (c_expand_return): Likewise. (c_expand_start_case): Likewise. * cp/Make-lang.in (cc1plus$(exeext)): Added c-semantics.o. * cp/Makefile.in (OBJS): Added ../c-semantics.o. (OBJDEPS): Likewise. * cp/cp-tree.h (TREE_LANG_FLAG_?): Moved common documentation to ../c-common.h. (struct stmt_tree): Added comment. (current_function_name_declared): Removed. (stmts_are_full_exprs_p): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (COMPOUND_STMT_NO_SCOPE): Moved to ../c-common.h. (DECL_ANON_UNION_ELEMS): Likewise. (emit_local_var): Likewise. (make_rtl_for_local_static): Likewise. (do_case): Likewise. (expand_stmt): Likewise. (genrtl_decl_cleanup): Likewise. (c_expand_asm_operands): Likewise. (c_expand_return): Likewise. (c_expand_start_case): Likewise. * cp/decl.c (make_rtl_for_local_static): Moved to c-semantics.c. (emit_local_var): Likewise. (initialize_local_var): Change reference to stmts_are_full_exprs_p to call to stmts_are_full_exprs_p(). Change reference to stmts_are_full_exprs_p to current_stmt_tree->stmts_are_full_exprs_p. (push_cp_function_context): Likewise. * cp/expect.c (expand_throw): Change reference to stmts_are_full_exprs_p. * cp/init.c (build_aggr_init): Change reference to stmts_are_full_exprs_p. (build_vec_init): Likewise. * cp/optimize.c (maybe_clone_body): Change reference to current_function_name_declared to cp_function_chain->name_declared. * cp/pt.c (instantiate_decl): Change reference to current_function_name_declared to cp_function_chain->name_declared. * cp/semantics.c (expand_cond): Moved declaration to c-common.h. (genrtl_do_pushlevel): Moved to c-semantics.c. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (gerntl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_decl_cleanup): Likewise. (expand_cond): Likewise. (expand_stmt): Renamed to ... (lang_expand_stmt): ... this. (lang_expand_expr_stmt): Initialize. (set_current_function_name_declared): Likewise. (stmts_are_full_exprs_p): Likewise. (current_function_name_declared): Likewise. (anon_aggr_type_p): Likewise. (do_poplevel): Change reference to stmts_are_full_exprs_p to call to stmts_are_full_exprs_p(). Change reference to stmts_are_full_exprs_p to current_stmt_tree->stmts_are_full_exprs_p. (add_tree): Likewise. (finish_expr_stmt): Likewise. (prep_stmt): Likewise. (lang_expand_stmt): Likewise. (begin_compound_stmt): Change reference to current_function_name_declared to cp_function_chain->name_declared and call to current_function_name_declared(). (setup_vtbl_ptr): Likewise. (genrtl_do_poplevel): Removed. From-SVN: r34827
2000-07-02 07:23:01 +02:00
/* Begin a new scope. */
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
void
do_pushlevel (scope_kind sk)
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
{
Makefile.in (C_AND_OBJC_OBJS): Added c-semantics.o. 2000-07-01 Benjamin Chelf <chelf@codesourcery.com> * Makefile.in (C_AND_OBJC_OBJS): Added c-semantics.o. (c-semantics.o): New target. * c-common.h (TREE_LANG_FLAG_?): Added documentation. (genrtl_do_pushlevel): Moved from cp/cp-tree.h. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (gerntl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_decl_cleanup): Likewise. (DECL_ANON_UNION_ELEMS): Likewise. (emit_local_var): Likewise. (make_rtl_for_local_static): Likewise. (expand_cond): Likewise. (expand_stmt): Likewise. (c_expand_return): Likewise. (c_expand_start_case): Likewise. (do_case): Likewise. (COMPOUND_STMT_NO_SCOPE): Likewise. (c_expand_asm_operands): Likewise. (NEW_FOR_SCOPE_P): New macro. (expand_expr_stmt_fn): New type. (set_current_function_name_declared): Likewise. (current_function_name_declared): Likewise. (lang_expand_stmt): Likewise. (stmts_are_full_exprs_p): Likewise. (anon_aggr_type_p): Likewise. (lang_expand_expr_stmt): Likewise. (build_case_label): Likewise. * c-decl.c (lang_expand_expr_stmt): Initialize. (stmts_are_full_exprs_p): Define. (current_function_name_declared): Likewise. (do_case): Likewise. (lang_expand_stmt): Likewise. (set_current_function_name_declared): Likewise. (anon_aggr_type_p): Likewise. (build_case_label): Likewise. * c-semantics.c: New file. (expand_cond): Moved from cp/semantics.c. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_decl_cleanup): Likewise. (make_rtl_for_local_static): Moved from cp/decl.c. (emit_local_var): Likewise. (expand_stmt): Define. * c-tree.h: (c_expand_asm_operands): Moved to c-common.h. (c_expand_return): Likewise. (c_expand_start_case): Likewise. * cp/Make-lang.in (cc1plus$(exeext)): Added c-semantics.o. * cp/Makefile.in (OBJS): Added ../c-semantics.o. (OBJDEPS): Likewise. * cp/cp-tree.h (TREE_LANG_FLAG_?): Moved common documentation to ../c-common.h. (struct stmt_tree): Added comment. (current_function_name_declared): Removed. (stmts_are_full_exprs_p): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (COMPOUND_STMT_NO_SCOPE): Moved to ../c-common.h. (DECL_ANON_UNION_ELEMS): Likewise. (emit_local_var): Likewise. (make_rtl_for_local_static): Likewise. (do_case): Likewise. (expand_stmt): Likewise. (genrtl_decl_cleanup): Likewise. (c_expand_asm_operands): Likewise. (c_expand_return): Likewise. (c_expand_start_case): Likewise. * cp/decl.c (make_rtl_for_local_static): Moved to c-semantics.c. (emit_local_var): Likewise. (initialize_local_var): Change reference to stmts_are_full_exprs_p to call to stmts_are_full_exprs_p(). Change reference to stmts_are_full_exprs_p to current_stmt_tree->stmts_are_full_exprs_p. (push_cp_function_context): Likewise. * cp/expect.c (expand_throw): Change reference to stmts_are_full_exprs_p. * cp/init.c (build_aggr_init): Change reference to stmts_are_full_exprs_p. (build_vec_init): Likewise. * cp/optimize.c (maybe_clone_body): Change reference to current_function_name_declared to cp_function_chain->name_declared. * cp/pt.c (instantiate_decl): Change reference to current_function_name_declared to cp_function_chain->name_declared. * cp/semantics.c (expand_cond): Moved declaration to c-common.h. (genrtl_do_pushlevel): Moved to c-semantics.c. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (gerntl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_decl_cleanup): Likewise. (expand_cond): Likewise. (expand_stmt): Renamed to ... (lang_expand_stmt): ... this. (lang_expand_expr_stmt): Initialize. (set_current_function_name_declared): Likewise. (stmts_are_full_exprs_p): Likewise. (current_function_name_declared): Likewise. (anon_aggr_type_p): Likewise. (do_poplevel): Change reference to stmts_are_full_exprs_p to call to stmts_are_full_exprs_p(). Change reference to stmts_are_full_exprs_p to current_stmt_tree->stmts_are_full_exprs_p. (add_tree): Likewise. (finish_expr_stmt): Likewise. (prep_stmt): Likewise. (lang_expand_stmt): Likewise. (begin_compound_stmt): Change reference to current_function_name_declared to cp_function_chain->name_declared and call to current_function_name_declared(). (setup_vtbl_ptr): Likewise. (genrtl_do_poplevel): Removed. From-SVN: r34827
2000-07-02 07:23:01 +02:00
if (stmts_are_full_exprs_p ())
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
{
Makefile.in (C_AND_OBJC_OBJS): Added c-semantics.o. 2000-07-01 Benjamin Chelf <chelf@codesourcery.com> * Makefile.in (C_AND_OBJC_OBJS): Added c-semantics.o. (c-semantics.o): New target. * c-common.h (TREE_LANG_FLAG_?): Added documentation. (genrtl_do_pushlevel): Moved from cp/cp-tree.h. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (gerntl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_decl_cleanup): Likewise. (DECL_ANON_UNION_ELEMS): Likewise. (emit_local_var): Likewise. (make_rtl_for_local_static): Likewise. (expand_cond): Likewise. (expand_stmt): Likewise. (c_expand_return): Likewise. (c_expand_start_case): Likewise. (do_case): Likewise. (COMPOUND_STMT_NO_SCOPE): Likewise. (c_expand_asm_operands): Likewise. (NEW_FOR_SCOPE_P): New macro. (expand_expr_stmt_fn): New type. (set_current_function_name_declared): Likewise. (current_function_name_declared): Likewise. (lang_expand_stmt): Likewise. (stmts_are_full_exprs_p): Likewise. (anon_aggr_type_p): Likewise. (lang_expand_expr_stmt): Likewise. (build_case_label): Likewise. * c-decl.c (lang_expand_expr_stmt): Initialize. (stmts_are_full_exprs_p): Define. (current_function_name_declared): Likewise. (do_case): Likewise. (lang_expand_stmt): Likewise. (set_current_function_name_declared): Likewise. (anon_aggr_type_p): Likewise. (build_case_label): Likewise. * c-semantics.c: New file. (expand_cond): Moved from cp/semantics.c. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_decl_cleanup): Likewise. (make_rtl_for_local_static): Moved from cp/decl.c. (emit_local_var): Likewise. (expand_stmt): Define. * c-tree.h: (c_expand_asm_operands): Moved to c-common.h. (c_expand_return): Likewise. (c_expand_start_case): Likewise. * cp/Make-lang.in (cc1plus$(exeext)): Added c-semantics.o. * cp/Makefile.in (OBJS): Added ../c-semantics.o. (OBJDEPS): Likewise. * cp/cp-tree.h (TREE_LANG_FLAG_?): Moved common documentation to ../c-common.h. (struct stmt_tree): Added comment. (current_function_name_declared): Removed. (stmts_are_full_exprs_p): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (COMPOUND_STMT_NO_SCOPE): Moved to ../c-common.h. (DECL_ANON_UNION_ELEMS): Likewise. (emit_local_var): Likewise. (make_rtl_for_local_static): Likewise. (do_case): Likewise. (expand_stmt): Likewise. (genrtl_decl_cleanup): Likewise. (c_expand_asm_operands): Likewise. (c_expand_return): Likewise. (c_expand_start_case): Likewise. * cp/decl.c (make_rtl_for_local_static): Moved to c-semantics.c. (emit_local_var): Likewise. (initialize_local_var): Change reference to stmts_are_full_exprs_p to call to stmts_are_full_exprs_p(). Change reference to stmts_are_full_exprs_p to current_stmt_tree->stmts_are_full_exprs_p. (push_cp_function_context): Likewise. * cp/expect.c (expand_throw): Change reference to stmts_are_full_exprs_p. * cp/init.c (build_aggr_init): Change reference to stmts_are_full_exprs_p. (build_vec_init): Likewise. * cp/optimize.c (maybe_clone_body): Change reference to current_function_name_declared to cp_function_chain->name_declared. * cp/pt.c (instantiate_decl): Change reference to current_function_name_declared to cp_function_chain->name_declared. * cp/semantics.c (expand_cond): Moved declaration to c-common.h. (genrtl_do_pushlevel): Moved to c-semantics.c. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (gerntl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_decl_cleanup): Likewise. (expand_cond): Likewise. (expand_stmt): Renamed to ... (lang_expand_stmt): ... this. (lang_expand_expr_stmt): Initialize. (set_current_function_name_declared): Likewise. (stmts_are_full_exprs_p): Likewise. (current_function_name_declared): Likewise. (anon_aggr_type_p): Likewise. (do_poplevel): Change reference to stmts_are_full_exprs_p to call to stmts_are_full_exprs_p(). Change reference to stmts_are_full_exprs_p to current_stmt_tree->stmts_are_full_exprs_p. (add_tree): Likewise. (finish_expr_stmt): Likewise. (prep_stmt): Likewise. (lang_expand_stmt): Likewise. (begin_compound_stmt): Change reference to current_function_name_declared to cp_function_chain->name_declared and call to current_function_name_declared(). (setup_vtbl_ptr): Likewise. (genrtl_do_poplevel): Removed. From-SVN: r34827
2000-07-02 07:23:01 +02:00
if (!processing_template_decl)
add_scope_stmt (/*begin_p=*/1, /*partial_p=*/0);
begin_scope (sk, NULL);
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
}
}
/* Finish a goto-statement. */
tree
finish_goto_stmt (tree destination)
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
{
if (TREE_CODE (destination) == IDENTIFIER_NODE)
destination = lookup_label (destination);
/* We warn about unused labels with -Wunused. That means we have to
mark the used labels as used. */
if (TREE_CODE (destination) == LABEL_DECL)
TREE_USED (destination) = 1;
else
{
/* The DESTINATION is being used as an rvalue. */
if (!processing_template_decl)
destination = decay_conversion (destination);
/* We don't inline calls to functions with computed gotos.
Those functions are typically up to some funny business,
and may be depending on the labels being at particular
addresses, or some such. */
DECL_UNINLINABLE (current_function_decl) = 1;
}
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
check_goto (destination);
return add_stmt (build_stmt (GOTO_STMT, destination));
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
}
/* COND is the condition-expression for an if, while, etc.,
statement. Convert it to a boolean value, if appropriate. */
static tree
maybe_convert_cond (tree cond)
{
/* Empty conditions remain empty. */
if (!cond)
return NULL_TREE;
/* Wait until we instantiate templates before doing conversion. */
if (processing_template_decl)
return cond;
/* Do the conversion. */
cond = convert_from_reference (cond);
return condition_conversion (cond);
}
Remove support for assigning to `this'. * NEWS: Note that fact. * class.c (build_vbase_path): Don't check flag_this_is_variable. * cp-tree.h (EXPR_STMT_ASSIGNS_THIS): Remove. (language_function): Remove assigns_this, just_assigned_this, and x_base_init_expr. Add x_vcalls_possible_p. Add vtbls_set_up_p. (base_init_expr): Remove. (current_vcalls_possible_p): New macro. (vtbls_set_up_p): Likewise. (emit_base_init): Change prototype. * decl.c (finish_destructor_body): New function, split out from finish_function. (current_function_assigns_this): Remove. (current_function_just_assigned_this): Likewise. (start_function): Don't set them. (finish_function): Don't check them. Don't emit base-initialization code here. Generate code for destructors when doing semantic analysis. (finish_stmt): Don't check current_function_just_assigned_this. * decl2.c (lang_f_options): Remove this-is-variable. (lang_decode_option): Likewise. (grokclassfn): Don't check flag_this_is_variable. * init.c (emit_base_init): Return the expression generated. (construct_virtual_bases): Don't push/pop obstacks. Fix typo. (build_new_1): Don't check flag_this_is_variable. (get_temp_regvar): Don't set DECL_REGISTER. (build_vec_init): Don't call use_variable. * lang-options.h: Remove "-fthis-is-variable" and "-fno-this-is-variable". * pt.c (tsubst_expr): Don't check EXPR_STMT_ASSIGNS_THIS. * search.c (expand_upcast_fixups): Use finish_expr_stmt, not expand_expr_stmt. * semantics.c (finish_expr_stmt_real): Rename to ... (finish_expr_stmt): This. Remove assigned_this parameter. (begin_if_stmt): Call do_pushlevel before starting the statement. (begin_compound_stmt): Don't declare __FUNCTION__ in scope-less blocks. (setup_vtbl_ptr): Emit initialization code for bases and members at semantic-analysis time. Emit code to initialize vtables in destructors here. (expand_stmt): Use finish_expr_stmt, not finish_expr_stmt_real. Don't handle CTOR_INITIALIZER any more. * typeck.c (build_modify_expr): Don't check for assignments to this. (c_expand_return): Don't suggest assigning to `this'. * Makefile.in (decl.o): Depend on RTL_H. (decl2.o): Likewise. (class.o): Likewise. (call.o): Likewise. (method.o): Likewise. (search.o): Likewise. (tree.o): Likewise. (pt.o): Likewise. * decl.c (duplicate_decls): When a builtin function is redeclared as static, make sure it is mangled correctly. * ir.texi (CTOR_INITIALIZER): Remove mention. Fix typo. Add detail about the statement-tree. From-SVN: r29531
1999-09-20 22:19:04 +02:00
/* Finish an expression-statement, whose EXPRESSION is as indicated. */
tree
finish_expr_stmt (tree expr)
{
tree r = NULL_TREE;
if (expr != NULL_TREE)
{
if (!processing_template_decl)
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
expr = convert_to_void (expr, "statement");
else if (!type_dependent_expression_p (expr))
convert_to_void (build_non_dependent_expr (expr), "statement");
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
r = add_stmt (build_stmt (EXPR_STMT, expr));
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
}
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
finish_stmt ();
cp-tree.def (STMT_EXPR): New tree node. * cp-tree.def (STMT_EXPR): New tree node. * cp-tree.h (STMT_EXPR_STMT): New macro. (store_return_init): Change prototype. (finish_named_return_value): New function. (expand_stmt): Likewise. (expand_body): Likewise. (begin_stmt_tree): Likewise. (finish_stmt_tree): Likewise. (expanding_p): New variable. (last_expr_type): Likewise. (building_stmt_tree): New macro. * decl.c (start_function): Use building_stmt_tree, not processing_template_decl, where appropriate. (store_parm_decls): Likewise. (store_return_init): Move most of the body to semantics.c. (finish_function): Use building_stmt_tree. (finish_stmt): Clear last_expr_type here. (cp_function): Add expanding_p, last_tree, last_expr_type. (push_cp_function_context): Save them. (pop_cp_function_context): Restore them. * decl2.c (setup_vtbl_ptr): Move to semantics.c. * error.c (dump_expr): Handle STMT_EXPR. * except.c (expand_start_catch_block): Use building_stmt_tree. Use add_decl_stmt. * expr.c (cplus_expand_expr): Handle STMT_EXPR. (do_case): Move add_tree call to semantics.c. * parse.y (return_init): Use finish_named_return_value. (for.init.statement): Use finish_expr_stmt. * parse.c: Regenerated. * pt.c (do_pushlevel): Move to semantics.c. (do_poplevel): Likewise. (tsubst_copy): Handle STMT_EXPR instead of BIND_EXPR. (tsubst_expr): Don't expand all the way to RTL here. Handle RETURN_INIT and CTOR_INITIALIZER. (instantiate_decl): Call expand_body after tsubst'ing into DECL_SAVED_TREE. * semantics.c (expand_stmts): New function. (expanding_p): New variable. (last_expr_type): Likewise. (finish_expr_stmt): Use building_stmt_tree. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (fnish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_for_stmt): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (finish_switch_cond): Likewise. (finish_switch_stmt): Likewise. (finish_case_label): Call add_tree here if necessary. (finish_goto_statement): Use building_stmt_tree. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_named_return_value): New function. (setup_vtbl_ptr): Moved here from decl2.c. (do_pushlevel): Moved here from pt.c. (do_poplevel): Likewise. (begin_stmt_expr): Use building_stmt_tree. (finish_stmt_expr): Likewise. Build a STMT_EXPR, not a BIND_EXPR, when building_stmt_tree. (begin_stmt_tree): New function. (finish_stmt_tree): Likewise. (expand_stmt): Likewise. (expand_body): Likewise. * tree.c (build_cplus_method_type): Make sure the argument types end up on the same obstack as the METHOD_TYPE. (search_tree): Handle COMPOUND_EXPR, MODIFY_EXPR, THROW_EXPR, STMT_EXPR. (mapcar): Break out common cases. Handle COMPOUND_EXPR, MODIFY_EXPR, THROW_EXPR, STMT_EXPR, RTL_EXPR. Abort, rather than sorry, if an unsupported node is encountered. * typeck.c (require_complete_type_in_void): Handle BIND_EXPR. (c_expand_return): Don't call add_tree here. From-SVN: r28729
1999-08-16 21:01:36 +02:00
return r;
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
}
/* Begin an if-statement. Returns a newly created IF_STMT if
appropriate. */
tree
begin_if_stmt (void)
{
tree r;
do_pushlevel (sk_block);
c-common.h (build_stmt): Declare. 2000-07-10 Benjamin Chelf <chelf@codesourcery.com> * c-common.h (build_stmt): Declare. (build_continue_stmt): Likewise. (build_break_stmt): Likewise. (build_return_stmt): Likewise. * c-decl.c (do_case): Rewrite to do what previously done in c-parse.in. * c-semantics.c (build_stmt): Define. (build_return_stmt): Likewise. (build_break_stmt): Likewise. (build_continue_stmt): Likewise. (build_case_label): Likewise. * c-parse.in (BREAK): Change to build tree, then generate RTL. (CONTINUE): Likewise. (RETURN): Likewise. (CASE): Likewise. (DEFAULT): Likewise. * c-parse.y: Regenerate. * c-pasre.c: Likewise. * cp/semantics.c (finish_for_stmt): Remove call to emit_line_note. (finish_continue_stmt): Likewise. (begin_for_stmt): Remove call to note_level_for_for. (finish_goto_stmt): Change call from build_min_nt to build_stmt. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_stmt): Likewise. (finish_break_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_case_label): Likewise. (genrtl_try_block): Likewise. (begin_try_block): Likewise. (begin_handler): Likewise. (begin_compound_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. * cp/decl.c (finish_constructor_body): Likewise. (finish_destructor_body): Likewise. * cp/optimize.c (copy_body_r): Likewise. (initialize_inlined_parameters): Likewise. (declare_return_variable): Likewise. (expand_call_inline): Likewise. From-SVN: r34943
2000-07-10 12:56:23 +02:00
r = build_stmt (IF_STMT, NULL_TREE, NULL_TREE, NULL_TREE);
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
2000-09-07 03:36:11 +02:00
add_stmt (r);
return r;
}
/* Process the COND of an if-statement, which may be given by
IF_STMT. */
void
finish_if_stmt_cond (tree cond, tree if_stmt)
{
cond = maybe_convert_cond (cond);
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
FINISH_COND (cond, if_stmt, IF_COND (if_stmt));
}
/* Finish the then-clause of an if-statement, which may be given by
IF_STMT. */
tree
finish_then_clause (tree if_stmt)
{
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
RECHAIN_STMTS (if_stmt, THEN_CLAUSE (if_stmt));
return if_stmt;
}
/* Begin the else-clause of an if-statement. */
void
begin_else_clause (void)
{
}
/* Finish the else-clause of an if-statement, which may be given by
IF_STMT. */
void
finish_else_clause (tree if_stmt)
{
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
RECHAIN_STMTS (if_stmt, ELSE_CLAUSE (if_stmt));
}
/* Finish an if-statement. */
void
finish_if_stmt (void)
{
finish_stmt ();
do_poplevel ();
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
}
/* Begin a while-statement. Returns a newly created WHILE_STMT if
appropriate. */
tree
begin_while_stmt (void)
{
tree r;
c-common.h (build_stmt): Declare. 2000-07-10 Benjamin Chelf <chelf@codesourcery.com> * c-common.h (build_stmt): Declare. (build_continue_stmt): Likewise. (build_break_stmt): Likewise. (build_return_stmt): Likewise. * c-decl.c (do_case): Rewrite to do what previously done in c-parse.in. * c-semantics.c (build_stmt): Define. (build_return_stmt): Likewise. (build_break_stmt): Likewise. (build_continue_stmt): Likewise. (build_case_label): Likewise. * c-parse.in (BREAK): Change to build tree, then generate RTL. (CONTINUE): Likewise. (RETURN): Likewise. (CASE): Likewise. (DEFAULT): Likewise. * c-parse.y: Regenerate. * c-pasre.c: Likewise. * cp/semantics.c (finish_for_stmt): Remove call to emit_line_note. (finish_continue_stmt): Likewise. (begin_for_stmt): Remove call to note_level_for_for. (finish_goto_stmt): Change call from build_min_nt to build_stmt. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_stmt): Likewise. (finish_break_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_case_label): Likewise. (genrtl_try_block): Likewise. (begin_try_block): Likewise. (begin_handler): Likewise. (begin_compound_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. * cp/decl.c (finish_constructor_body): Likewise. (finish_destructor_body): Likewise. * cp/optimize.c (copy_body_r): Likewise. (initialize_inlined_parameters): Likewise. (declare_return_variable): Likewise. (expand_call_inline): Likewise. From-SVN: r34943
2000-07-10 12:56:23 +02:00
r = build_stmt (WHILE_STMT, NULL_TREE, NULL_TREE);
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
2000-09-07 03:36:11 +02:00
add_stmt (r);
do_pushlevel (sk_block);
return r;
}
/* Process the COND of a while-statement, which may be given by
WHILE_STMT. */
void
finish_while_stmt_cond (tree cond, tree while_stmt)
{
cond = maybe_convert_cond (cond);
if (processing_template_decl)
/* Don't mess with condition decls in a template. */
FINISH_COND (cond, while_stmt, WHILE_COND (while_stmt));
else if (getdecls () == NULL_TREE)
/* It was a simple condition; install it. */
WHILE_COND (while_stmt) = cond;
else
{
/* If there was a declaration in the condition, we can't leave it
there; transform
while (A x = 42) { }
to
while (true) { A x = 42; if (!x) break; } */
tree if_stmt;
WHILE_COND (while_stmt) = boolean_true_node;
if_stmt = begin_if_stmt ();
cond = build_unary_op (TRUTH_NOT_EXPR, cond, 0);
finish_if_stmt_cond (cond, if_stmt);
finish_break_stmt ();
finish_then_clause (if_stmt);
finish_if_stmt ();
}
}
/* Finish a while-statement, which may be given by WHILE_STMT. */
void
finish_while_stmt (tree while_stmt)
{
do_poplevel ();
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
RECHAIN_STMTS (while_stmt, WHILE_BODY (while_stmt));
finish_stmt ();
}
/* Begin a do-statement. Returns a newly created DO_STMT if
appropriate. */
tree
begin_do_stmt (void)
{
c-common.h (build_stmt): Declare. 2000-07-10 Benjamin Chelf <chelf@codesourcery.com> * c-common.h (build_stmt): Declare. (build_continue_stmt): Likewise. (build_break_stmt): Likewise. (build_return_stmt): Likewise. * c-decl.c (do_case): Rewrite to do what previously done in c-parse.in. * c-semantics.c (build_stmt): Define. (build_return_stmt): Likewise. (build_break_stmt): Likewise. (build_continue_stmt): Likewise. (build_case_label): Likewise. * c-parse.in (BREAK): Change to build tree, then generate RTL. (CONTINUE): Likewise. (RETURN): Likewise. (CASE): Likewise. (DEFAULT): Likewise. * c-parse.y: Regenerate. * c-pasre.c: Likewise. * cp/semantics.c (finish_for_stmt): Remove call to emit_line_note. (finish_continue_stmt): Likewise. (begin_for_stmt): Remove call to note_level_for_for. (finish_goto_stmt): Change call from build_min_nt to build_stmt. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_stmt): Likewise. (finish_break_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_case_label): Likewise. (genrtl_try_block): Likewise. (begin_try_block): Likewise. (begin_handler): Likewise. (begin_compound_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. * cp/decl.c (finish_constructor_body): Likewise. (finish_destructor_body): Likewise. * cp/optimize.c (copy_body_r): Likewise. (initialize_inlined_parameters): Likewise. (declare_return_variable): Likewise. (expand_call_inline): Likewise. From-SVN: r34943
2000-07-10 12:56:23 +02:00
tree r = build_stmt (DO_STMT, NULL_TREE, NULL_TREE);
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
2000-09-07 03:36:11 +02:00
add_stmt (r);
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
return r;
}
/* Finish the body of a do-statement, which may be given by DO_STMT. */
void
finish_do_body (tree do_stmt)
{
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
RECHAIN_STMTS (do_stmt, DO_BODY (do_stmt));
}
/* Finish a do-statement, which may be given by DO_STMT, and whose
COND is as indicated. */
void
finish_do_stmt (tree cond, tree do_stmt)
{
cond = maybe_convert_cond (cond);
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
DO_COND (do_stmt) = cond;
finish_stmt ();
}
/* Finish a return-statement. The EXPRESSION returned, if any, is as
indicated. */
tree
finish_return_stmt (tree expr)
{
tree r;
expr = check_return_expr (expr);
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
if (!processing_template_decl)
{
if (DECL_DESTRUCTOR_P (current_function_decl))
{
/* Similarly, all destructors must run destructors for
base-classes before returning. So, all returns in a
destructor get sent to the DTOR_LABEL; finish_function emits
code to return a value there. */
return finish_goto_stmt (dtor_label);
}
}
r = add_stmt (build_stmt (RETURN_STMT, expr));
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
finish_stmt ();
return r;
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
}
/* Begin a for-statement. Returns a new FOR_STMT if appropriate. */
tree
begin_for_stmt (void)
{
tree r;
c-common.h (build_stmt): Declare. 2000-07-10 Benjamin Chelf <chelf@codesourcery.com> * c-common.h (build_stmt): Declare. (build_continue_stmt): Likewise. (build_break_stmt): Likewise. (build_return_stmt): Likewise. * c-decl.c (do_case): Rewrite to do what previously done in c-parse.in. * c-semantics.c (build_stmt): Define. (build_return_stmt): Likewise. (build_break_stmt): Likewise. (build_continue_stmt): Likewise. (build_case_label): Likewise. * c-parse.in (BREAK): Change to build tree, then generate RTL. (CONTINUE): Likewise. (RETURN): Likewise. (CASE): Likewise. (DEFAULT): Likewise. * c-parse.y: Regenerate. * c-pasre.c: Likewise. * cp/semantics.c (finish_for_stmt): Remove call to emit_line_note. (finish_continue_stmt): Likewise. (begin_for_stmt): Remove call to note_level_for_for. (finish_goto_stmt): Change call from build_min_nt to build_stmt. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_stmt): Likewise. (finish_break_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_case_label): Likewise. (genrtl_try_block): Likewise. (begin_try_block): Likewise. (begin_handler): Likewise. (begin_compound_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. * cp/decl.c (finish_constructor_body): Likewise. (finish_destructor_body): Likewise. * cp/optimize.c (copy_body_r): Likewise. (initialize_inlined_parameters): Likewise. (declare_return_variable): Likewise. (expand_call_inline): Likewise. From-SVN: r34943
2000-07-10 12:56:23 +02:00
r = build_stmt (FOR_STMT, NULL_TREE, NULL_TREE,
NULL_TREE, NULL_TREE);
Makefile.in (C_AND_OBJC_OBJS): Added c-semantics.o. 2000-07-01 Benjamin Chelf <chelf@codesourcery.com> * Makefile.in (C_AND_OBJC_OBJS): Added c-semantics.o. (c-semantics.o): New target. * c-common.h (TREE_LANG_FLAG_?): Added documentation. (genrtl_do_pushlevel): Moved from cp/cp-tree.h. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (gerntl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_decl_cleanup): Likewise. (DECL_ANON_UNION_ELEMS): Likewise. (emit_local_var): Likewise. (make_rtl_for_local_static): Likewise. (expand_cond): Likewise. (expand_stmt): Likewise. (c_expand_return): Likewise. (c_expand_start_case): Likewise. (do_case): Likewise. (COMPOUND_STMT_NO_SCOPE): Likewise. (c_expand_asm_operands): Likewise. (NEW_FOR_SCOPE_P): New macro. (expand_expr_stmt_fn): New type. (set_current_function_name_declared): Likewise. (current_function_name_declared): Likewise. (lang_expand_stmt): Likewise. (stmts_are_full_exprs_p): Likewise. (anon_aggr_type_p): Likewise. (lang_expand_expr_stmt): Likewise. (build_case_label): Likewise. * c-decl.c (lang_expand_expr_stmt): Initialize. (stmts_are_full_exprs_p): Define. (current_function_name_declared): Likewise. (do_case): Likewise. (lang_expand_stmt): Likewise. (set_current_function_name_declared): Likewise. (anon_aggr_type_p): Likewise. (build_case_label): Likewise. * c-semantics.c: New file. (expand_cond): Moved from cp/semantics.c. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_decl_cleanup): Likewise. (make_rtl_for_local_static): Moved from cp/decl.c. (emit_local_var): Likewise. (expand_stmt): Define. * c-tree.h: (c_expand_asm_operands): Moved to c-common.h. (c_expand_return): Likewise. (c_expand_start_case): Likewise. * cp/Make-lang.in (cc1plus$(exeext)): Added c-semantics.o. * cp/Makefile.in (OBJS): Added ../c-semantics.o. (OBJDEPS): Likewise. * cp/cp-tree.h (TREE_LANG_FLAG_?): Moved common documentation to ../c-common.h. (struct stmt_tree): Added comment. (current_function_name_declared): Removed. (stmts_are_full_exprs_p): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (COMPOUND_STMT_NO_SCOPE): Moved to ../c-common.h. (DECL_ANON_UNION_ELEMS): Likewise. (emit_local_var): Likewise. (make_rtl_for_local_static): Likewise. (do_case): Likewise. (expand_stmt): Likewise. (genrtl_decl_cleanup): Likewise. (c_expand_asm_operands): Likewise. (c_expand_return): Likewise. (c_expand_start_case): Likewise. * cp/decl.c (make_rtl_for_local_static): Moved to c-semantics.c. (emit_local_var): Likewise. (initialize_local_var): Change reference to stmts_are_full_exprs_p to call to stmts_are_full_exprs_p(). Change reference to stmts_are_full_exprs_p to current_stmt_tree->stmts_are_full_exprs_p. (push_cp_function_context): Likewise. * cp/expect.c (expand_throw): Change reference to stmts_are_full_exprs_p. * cp/init.c (build_aggr_init): Change reference to stmts_are_full_exprs_p. (build_vec_init): Likewise. * cp/optimize.c (maybe_clone_body): Change reference to current_function_name_declared to cp_function_chain->name_declared. * cp/pt.c (instantiate_decl): Change reference to current_function_name_declared to cp_function_chain->name_declared. * cp/semantics.c (expand_cond): Moved declaration to c-common.h. (genrtl_do_pushlevel): Moved to c-semantics.c. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (gerntl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_decl_cleanup): Likewise. (expand_cond): Likewise. (expand_stmt): Renamed to ... (lang_expand_stmt): ... this. (lang_expand_expr_stmt): Initialize. (set_current_function_name_declared): Likewise. (stmts_are_full_exprs_p): Likewise. (current_function_name_declared): Likewise. (anon_aggr_type_p): Likewise. (do_poplevel): Change reference to stmts_are_full_exprs_p to call to stmts_are_full_exprs_p(). Change reference to stmts_are_full_exprs_p to current_stmt_tree->stmts_are_full_exprs_p. (add_tree): Likewise. (finish_expr_stmt): Likewise. (prep_stmt): Likewise. (lang_expand_stmt): Likewise. (begin_compound_stmt): Change reference to current_function_name_declared to cp_function_chain->name_declared and call to current_function_name_declared(). (setup_vtbl_ptr): Likewise. (genrtl_do_poplevel): Removed. From-SVN: r34827
2000-07-02 07:23:01 +02:00
NEW_FOR_SCOPE_P (r) = flag_new_for_scope > 0;
if (NEW_FOR_SCOPE_P (r))
do_pushlevel (sk_for);
add_stmt (r);
return r;
}
/* Finish the for-init-statement of a for-statement, which may be
given by FOR_STMT. */
void
finish_for_init_stmt (tree for_stmt)
{
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
if (last_tree != for_stmt)
RECHAIN_STMTS (for_stmt, FOR_INIT_STMT (for_stmt));
do_pushlevel (sk_block);
}
/* Finish the COND of a for-statement, which may be given by
FOR_STMT. */
void
finish_for_cond (tree cond, tree for_stmt)
{
cond = maybe_convert_cond (cond);
if (processing_template_decl)
/* Don't mess with condition decls in a template. */
FINISH_COND (cond, for_stmt, FOR_COND (for_stmt));
else if (getdecls () == NULL_TREE)
/* It was a simple condition; install it. */
FOR_COND (for_stmt) = cond;
else
{
/* If there was a declaration in the condition, we can't leave it
there; transform
for (; A x = 42;) { }
to
for (;;) { A x = 42; if (!x) break; } */
tree if_stmt;
FOR_COND (for_stmt) = NULL_TREE;
if_stmt = begin_if_stmt ();
cond = build_unary_op (TRUTH_NOT_EXPR, cond, 0);
finish_if_stmt_cond (cond, if_stmt);
finish_break_stmt ();
finish_then_clause (if_stmt);
finish_if_stmt ();
}
}
/* Finish the increment-EXPRESSION in a for-statement, which may be
given by FOR_STMT. */
void
finish_for_expr (tree expr, tree for_stmt)
{
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
FOR_EXPR (for_stmt) = expr;
}
/* Finish the body of a for-statement, which may be given by
FOR_STMT. The increment-EXPR for the loop must be
provided. */
void
finish_for_stmt (tree for_stmt)
{
/* Pop the scope for the body of the loop. */
do_poplevel ();
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
RECHAIN_STMTS (for_stmt, FOR_BODY (for_stmt));
Makefile.in (C_AND_OBJC_OBJS): Added c-semantics.o. 2000-07-01 Benjamin Chelf <chelf@codesourcery.com> * Makefile.in (C_AND_OBJC_OBJS): Added c-semantics.o. (c-semantics.o): New target. * c-common.h (TREE_LANG_FLAG_?): Added documentation. (genrtl_do_pushlevel): Moved from cp/cp-tree.h. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (gerntl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_decl_cleanup): Likewise. (DECL_ANON_UNION_ELEMS): Likewise. (emit_local_var): Likewise. (make_rtl_for_local_static): Likewise. (expand_cond): Likewise. (expand_stmt): Likewise. (c_expand_return): Likewise. (c_expand_start_case): Likewise. (do_case): Likewise. (COMPOUND_STMT_NO_SCOPE): Likewise. (c_expand_asm_operands): Likewise. (NEW_FOR_SCOPE_P): New macro. (expand_expr_stmt_fn): New type. (set_current_function_name_declared): Likewise. (current_function_name_declared): Likewise. (lang_expand_stmt): Likewise. (stmts_are_full_exprs_p): Likewise. (anon_aggr_type_p): Likewise. (lang_expand_expr_stmt): Likewise. (build_case_label): Likewise. * c-decl.c (lang_expand_expr_stmt): Initialize. (stmts_are_full_exprs_p): Define. (current_function_name_declared): Likewise. (do_case): Likewise. (lang_expand_stmt): Likewise. (set_current_function_name_declared): Likewise. (anon_aggr_type_p): Likewise. (build_case_label): Likewise. * c-semantics.c: New file. (expand_cond): Moved from cp/semantics.c. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_decl_cleanup): Likewise. (make_rtl_for_local_static): Moved from cp/decl.c. (emit_local_var): Likewise. (expand_stmt): Define. * c-tree.h: (c_expand_asm_operands): Moved to c-common.h. (c_expand_return): Likewise. (c_expand_start_case): Likewise. * cp/Make-lang.in (cc1plus$(exeext)): Added c-semantics.o. * cp/Makefile.in (OBJS): Added ../c-semantics.o. (OBJDEPS): Likewise. * cp/cp-tree.h (TREE_LANG_FLAG_?): Moved common documentation to ../c-common.h. (struct stmt_tree): Added comment. (current_function_name_declared): Removed. (stmts_are_full_exprs_p): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (COMPOUND_STMT_NO_SCOPE): Moved to ../c-common.h. (DECL_ANON_UNION_ELEMS): Likewise. (emit_local_var): Likewise. (make_rtl_for_local_static): Likewise. (do_case): Likewise. (expand_stmt): Likewise. (genrtl_decl_cleanup): Likewise. (c_expand_asm_operands): Likewise. (c_expand_return): Likewise. (c_expand_start_case): Likewise. * cp/decl.c (make_rtl_for_local_static): Moved to c-semantics.c. (emit_local_var): Likewise. (initialize_local_var): Change reference to stmts_are_full_exprs_p to call to stmts_are_full_exprs_p(). Change reference to stmts_are_full_exprs_p to current_stmt_tree->stmts_are_full_exprs_p. (push_cp_function_context): Likewise. * cp/expect.c (expand_throw): Change reference to stmts_are_full_exprs_p. * cp/init.c (build_aggr_init): Change reference to stmts_are_full_exprs_p. (build_vec_init): Likewise. * cp/optimize.c (maybe_clone_body): Change reference to current_function_name_declared to cp_function_chain->name_declared. * cp/pt.c (instantiate_decl): Change reference to current_function_name_declared to cp_function_chain->name_declared. * cp/semantics.c (expand_cond): Moved declaration to c-common.h. (genrtl_do_pushlevel): Moved to c-semantics.c. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (gerntl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_decl_cleanup): Likewise. (expand_cond): Likewise. (expand_stmt): Renamed to ... (lang_expand_stmt): ... this. (lang_expand_expr_stmt): Initialize. (set_current_function_name_declared): Likewise. (stmts_are_full_exprs_p): Likewise. (current_function_name_declared): Likewise. (anon_aggr_type_p): Likewise. (do_poplevel): Change reference to stmts_are_full_exprs_p to call to stmts_are_full_exprs_p(). Change reference to stmts_are_full_exprs_p to current_stmt_tree->stmts_are_full_exprs_p. (add_tree): Likewise. (finish_expr_stmt): Likewise. (prep_stmt): Likewise. (lang_expand_stmt): Likewise. (begin_compound_stmt): Change reference to current_function_name_declared to cp_function_chain->name_declared and call to current_function_name_declared(). (setup_vtbl_ptr): Likewise. (genrtl_do_poplevel): Removed. From-SVN: r34827
2000-07-02 07:23:01 +02:00
if (NEW_FOR_SCOPE_P (for_stmt))
do_poplevel ();
finish_stmt ();
}
/* Finish a break-statement. */
tree
finish_break_stmt (void)
{
return add_stmt (build_break_stmt ());
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
}
/* Finish a continue-statement. */
tree
finish_continue_stmt (void)
{
return add_stmt (build_continue_stmt ());
}
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
/* Begin a switch-statement. Returns a new SWITCH_STMT if
appropriate. */
tree
begin_switch_stmt (void)
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
{
tree r;
do_pushlevel (sk_block);
r = build_stmt (SWITCH_STMT, NULL_TREE, NULL_TREE, NULL_TREE);
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
2000-09-07 03:36:11 +02:00
add_stmt (r);
return r;
}
/* Finish the cond of a switch-statement. */
void
finish_switch_cond (tree cond, tree switch_stmt)
{
tree orig_type = NULL;
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
if (!processing_template_decl)
{
c-common.h (add_stmt): Change prototype. * c-common.h (add_stmt): Change prototype. (RECHAIN_STMTS): New macro. (CASE_LABEL_DECL): Likewise. (genrtl_case_label): Change prototype. (c_expand_start_case): Remove prototype. (build_case_label): Change prototype. (decl_constant_value): Declare. * c-common.c (check_case_value): Handle C++'s extensions to C semantics. * c-commnon.def (CASE_LABEL): Add room for the CASE_LABEL_DECL field. * c-parse.in (stmt): Adjust handling of return statements and case laels. * c-semantics.c (add_stmt): Return the new statement. (genrtl_return_stmt): Take the RETURN_STMT as input, not the returned expression. Directly generate RTL, rather than calling c_expand_return. (genrtl_switch_stmt): Don't call c_expand_start_case. (build_case_label): Take the LABEL_DECL as input, too. (genrtl_case_label): Just call add_case_node. (expand_stmt): Adjust calls to genrtl_return_stmt and genrtl_case_label. * c-tree.h (c_expand_start_case): Declare. * c-typeck.c (decl_constant_value): Give it external linkage. (c_expand_return): Don't call expand_return or expand_null_return; use genrtl_return_stmt instead. * stmt.c (struct nesting): Remove num_ranges field. (add_case_node): Give it external linkage. (expand_start_case): Don't set num_ranges. (expand_start_case_dummy): Don't clear it. (pushcase): Rely on add_case_node to handle `default' labels. (add_case_node): Handle `default' labels. * tree.c (tree_int_cst_compare): New function. * tree.h (tree_int_cst_compare): Declare. (add_case_node): Likewise. * cp-tree.h (push_switch): Change prototype. (check_cp_case_value): Remove declaration. (decl_constant_value): Likewise. * decl.c (struct cp_switch): Add switch_stmt and cases. (case_compare): New function. (push_switch): Set switch_stmt. Initialize cases. (pop_switch): Clean up cases. (define_case_label): Rename to ... (finish_case_label): ... this. Do semantic analysis for case labels here. (start_function): Correct comment. * decl2.c (check_cp_case_value): Remove. * expr.c (do_case): Remove. * pt.c (tsubst_expr): Adjust call to finish_case_label. * semantics.c (genrtl_do_poplevel): Remove declaration. (RECHAIN_STMTS): Remove. (finish_break_stmt): Use build_break_stmt. (finish_continue_stmt): Use build_continue_stmt. (finish_switch_cond): Adjust condition here, rater than in c_expand_start_case. (finish_case_label): Remove. * typeck.c (c_expand_return): Remove. (c_expand_start_case): Likewise. From-SVN: r36305
2000-09-10 23:34:41 +02:00
tree index;
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
/* Convert the condition to an integer or enumeration type. */
cond = build_expr_type_conversion (WANT_INT | WANT_ENUM, cond, true);
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
if (cond == NULL_TREE)
{
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
error ("switch quantity not an integer");
cond = error_mark_node;
}
orig_type = TREE_TYPE (cond);
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
if (cond != error_mark_node)
{
/* [stmt.switch]
Integral promotions are performed. */
cond = perform_integral_promotions (cond);
cond = fold (build1 (CLEANUP_POINT_EXPR, TREE_TYPE (cond), cond));
}
c-common.h (add_stmt): Change prototype. * c-common.h (add_stmt): Change prototype. (RECHAIN_STMTS): New macro. (CASE_LABEL_DECL): Likewise. (genrtl_case_label): Change prototype. (c_expand_start_case): Remove prototype. (build_case_label): Change prototype. (decl_constant_value): Declare. * c-common.c (check_case_value): Handle C++'s extensions to C semantics. * c-commnon.def (CASE_LABEL): Add room for the CASE_LABEL_DECL field. * c-parse.in (stmt): Adjust handling of return statements and case laels. * c-semantics.c (add_stmt): Return the new statement. (genrtl_return_stmt): Take the RETURN_STMT as input, not the returned expression. Directly generate RTL, rather than calling c_expand_return. (genrtl_switch_stmt): Don't call c_expand_start_case. (build_case_label): Take the LABEL_DECL as input, too. (genrtl_case_label): Just call add_case_node. (expand_stmt): Adjust calls to genrtl_return_stmt and genrtl_case_label. * c-tree.h (c_expand_start_case): Declare. * c-typeck.c (decl_constant_value): Give it external linkage. (c_expand_return): Don't call expand_return or expand_null_return; use genrtl_return_stmt instead. * stmt.c (struct nesting): Remove num_ranges field. (add_case_node): Give it external linkage. (expand_start_case): Don't set num_ranges. (expand_start_case_dummy): Don't clear it. (pushcase): Rely on add_case_node to handle `default' labels. (add_case_node): Handle `default' labels. * tree.c (tree_int_cst_compare): New function. * tree.h (tree_int_cst_compare): Declare. (add_case_node): Likewise. * cp-tree.h (push_switch): Change prototype. (check_cp_case_value): Remove declaration. (decl_constant_value): Likewise. * decl.c (struct cp_switch): Add switch_stmt and cases. (case_compare): New function. (push_switch): Set switch_stmt. Initialize cases. (pop_switch): Clean up cases. (define_case_label): Rename to ... (finish_case_label): ... this. Do semantic analysis for case labels here. (start_function): Correct comment. * decl2.c (check_cp_case_value): Remove. * expr.c (do_case): Remove. * pt.c (tsubst_expr): Adjust call to finish_case_label. * semantics.c (genrtl_do_poplevel): Remove declaration. (RECHAIN_STMTS): Remove. (finish_break_stmt): Use build_break_stmt. (finish_continue_stmt): Use build_continue_stmt. (finish_switch_cond): Adjust condition here, rater than in c_expand_start_case. (finish_case_label): Remove. * typeck.c (c_expand_return): Remove. (c_expand_start_case): Likewise. From-SVN: r36305
2000-09-10 23:34:41 +02:00
if (cond != error_mark_node)
{
index = get_unwidened (cond, NULL_TREE);
/* We can't strip a conversion from a signed type to an unsigned,
because if we did, int_fits_type_p would do the wrong thing
when checking case values for being in range,
and it's too hard to do the right thing. */
if (TREE_UNSIGNED (TREE_TYPE (cond))
== TREE_UNSIGNED (TREE_TYPE (index)))
cond = index;
}
}
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
FINISH_COND (cond, switch_stmt, SWITCH_COND (switch_stmt));
SWITCH_TYPE (switch_stmt) = orig_type;
c-common.h (add_stmt): Change prototype. * c-common.h (add_stmt): Change prototype. (RECHAIN_STMTS): New macro. (CASE_LABEL_DECL): Likewise. (genrtl_case_label): Change prototype. (c_expand_start_case): Remove prototype. (build_case_label): Change prototype. (decl_constant_value): Declare. * c-common.c (check_case_value): Handle C++'s extensions to C semantics. * c-commnon.def (CASE_LABEL): Add room for the CASE_LABEL_DECL field. * c-parse.in (stmt): Adjust handling of return statements and case laels. * c-semantics.c (add_stmt): Return the new statement. (genrtl_return_stmt): Take the RETURN_STMT as input, not the returned expression. Directly generate RTL, rather than calling c_expand_return. (genrtl_switch_stmt): Don't call c_expand_start_case. (build_case_label): Take the LABEL_DECL as input, too. (genrtl_case_label): Just call add_case_node. (expand_stmt): Adjust calls to genrtl_return_stmt and genrtl_case_label. * c-tree.h (c_expand_start_case): Declare. * c-typeck.c (decl_constant_value): Give it external linkage. (c_expand_return): Don't call expand_return or expand_null_return; use genrtl_return_stmt instead. * stmt.c (struct nesting): Remove num_ranges field. (add_case_node): Give it external linkage. (expand_start_case): Don't set num_ranges. (expand_start_case_dummy): Don't clear it. (pushcase): Rely on add_case_node to handle `default' labels. (add_case_node): Handle `default' labels. * tree.c (tree_int_cst_compare): New function. * tree.h (tree_int_cst_compare): Declare. (add_case_node): Likewise. * cp-tree.h (push_switch): Change prototype. (check_cp_case_value): Remove declaration. (decl_constant_value): Likewise. * decl.c (struct cp_switch): Add switch_stmt and cases. (case_compare): New function. (push_switch): Set switch_stmt. Initialize cases. (pop_switch): Clean up cases. (define_case_label): Rename to ... (finish_case_label): ... this. Do semantic analysis for case labels here. (start_function): Correct comment. * decl2.c (check_cp_case_value): Remove. * expr.c (do_case): Remove. * pt.c (tsubst_expr): Adjust call to finish_case_label. * semantics.c (genrtl_do_poplevel): Remove declaration. (RECHAIN_STMTS): Remove. (finish_break_stmt): Use build_break_stmt. (finish_continue_stmt): Use build_continue_stmt. (finish_switch_cond): Adjust condition here, rater than in c_expand_start_case. (finish_case_label): Remove. * typeck.c (c_expand_return): Remove. (c_expand_start_case): Likewise. From-SVN: r36305
2000-09-10 23:34:41 +02:00
push_switch (switch_stmt);
}
/* Finish the body of a switch-statement, which may be given by
SWITCH_STMT. The COND to switch on is indicated. */
void
finish_switch_stmt (tree switch_stmt)
{
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
RECHAIN_STMTS (switch_stmt, SWITCH_BODY (switch_stmt));
pop_switch ();
finish_stmt ();
do_poplevel ();
}
/* Generate the RTL for T, which is a TRY_BLOCK. */
static void
genrtl_try_block (tree t)
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
{
if (CLEANUP_P (t))
{
expand_eh_region_start ();
expand_stmt (TRY_STMTS (t));
expand_eh_region_end_cleanup (TRY_HANDLERS (t));
Make-lang.in (CXX_SRCS): Add optimize.c. 1999-11-25 Mark Mitchell <mark@codesourcery.com> * Make-lang.in (CXX_SRCS): Add optimize.c. * Makefile.in (CXX_OBJS): Add optimize.o. (CXX_TREE_H): Add splay-tree.h, system.h, and $(CONFIG_H). (spew.o, lex.o, decl.o, decl2.o, typeck2.o, typeck.o): Adjust. (class.o, call.o, friend.o, init.o, method.o, cvt.o): Likewise. (search.o, tree.o, ptree.o, rtti.o, except.o, expr.o): Likewise. (xref.o, pt.o, error.o, errfn.o, repo.o, semantics.o): Likewise. (dump.o): Likewise. (optimize.o): New target. * class.c: Don't include splay-tree.h. * cp-tree.def (CTOR_COMPLETE): Rename to CTOR_STMT. * cp-tree.h: Include splay-tree.h. (DECL_UNINLINABLE): New macro. (CTOR_BEGIN_P, CTOR_END_P): New macros. (flag_inline_trees): New variable. (local_variable_p): New function. (nonstatic_local_decl_p): Likewise. (optimize_function): Likewise. (cplus_unsave_expr_now): Remove. (copy_tree_r): Declare. (remap_save_expr): Likewise. * decl.c (local_variable_p): Don't make it static. (local_variable_p_walkfn): New function. (make_rtl_for_local_static): Remove code to try to avoid writing out static constants. (emit_local_var): Fix indentation. (nonstatic_local_decl_p): New function. (check_default_argument): Use local_variable_p_walkfn, not local_variable_p, when walking the tree. (start_function): Set the DECL_CONTEXT for automatically generated labels. (finish_constructor_body): Use CTOR_STMT to mark the end of a constructor. * decl2.c: Don't include splay-tree.h. (flag_inline_trees): Define. * dump.c: Don't include splay-tree.h. * except.c (expand_end_catch_block): Fix comment formatting. (expand_end_eh_spec): Set DECL_CONTEXT on temporary variables. (expand_throw): Tidy comment. * init.c (build_vec_delete_1): Use create_temporary_var. * lex.c (cplus_tree_code_type): Make it static. (cplus_tree_code_length): Likewise. (cplus_tree_code_name): Likewise. * optimize.c: New file. * semantics.c (finish_goto_stmt): Set DECL_UNLINABLE for functions with computed gotos. (setup_vtbl_ptr): Mark the beginnings of constructors with CTOR_STMT. (expand_stmt): Handle CTOR_STMT, not CTOR_COMPLETE. (expand_body): Call optimize_function. Save bodies if we're doing inlining on trees. * tree.c: Don't include splay-tree.h. Include insn-config.h and integrate.h. (copy_tree_r): Make it public. (statement_code_p): New function. (mark_local_for_remap_r): Likewise. (cp_usave_r): Likewise. (cp_unsave): Likewise. (build_cplus_new): Set DECL_CONTEXT for temporary variables. (walk_tree): Walk into `s' class nodes. Walk statement chains. (copy_tree_r): Handle 's' class nodes. Restore chains for statements. Nullify scopes. Don't copy types. (init_tree): Set lang_unsave to cp_unsave. (remap_save_expr): Define. * ir.texi: Document CTOR_STMT. From-SVN: r30669
1999-11-25 21:32:04 +01:00
}
else
{
c-common.h (genrtl_clear_out_block): Remove. * c-common.h (genrtl_clear_out_block): Remove. * c-semantics.c (genrtl_clear_out_block): Remove. (genrtl_while_stmt): Don't call it. (genrtl_for_stmt): Likewise. * cp-tree.h (struct saved_scope): Remove x_function_parms. (current_function_parms): Don't define. (struct cp_language_function): Remove parms_stored. (current_function_just_assigned_this): Don't define. (current_function_parms_stored): Likewise. (static_ctors): Declare. (static_dtors): Likewise. (SF_EXPAND): Don't define. (expand_start_early_try_stmts): Remove declaration. (store_parm_decls): Likewise. * decl.c (static_ctors): Don't declare. (static_dtors): Likewise. (struct binding_level): Remove this_block. (poplevel): Remove dead code. (set_block): Likewise. (mark_binding_level): Don't mark this_block. (mark_saved_scope): Don't mark x_function_parms. (init_decl_processing): Don't add current_function_parms as a GC root. (check_function_type): Change prototype. (start_function): Remove RTL-generation code. (expand_start_early_try_stmts): Remove. (store_parm_decls): Give it internal linkage. Remove RTL-generation code. (finish_function): Remove RTL-generation code. * decl2.c (static_ctors): Fix formatting. (static_dtors): Likewise. * method.c (use_thunk): Don't call store_parm_decls. (synthesize_method): Likewise. * optimize.c (maybe_clone_body): Likewise. * parse.y (fn.def2): Likewise. (.set_base_init): Likewise. (nodecls): Likewise. * pt.c (instantiate_decl): Likewise. * rtti.c (synthesize_tinfo_fn): Likewise. * semantics.c (genrtl_try_block): Simplify. (expand_body): Use genrtl_start_function and genrtl_finish_function. (genrtl_start_function): New function. (genrtl_finish_function): Likewise. From-SVN: r36350
2000-09-12 08:46:00 +02:00
if (!FN_TRY_BLOCK_P (t))
rtl.h (emit_line_note): Take a location_t. * rtl.h (emit_line_note): Take a location_t. (emit_line_note_force): Remove. (set_file_and_line_for_statement): Take a location_t. * tree.g (emit_line_note): Take a location_t. * emit-rtl.c (emit_line_note): Take a location_t. (emit_line_note_force): Remove. * function.c (init_function_start): Adjust emit_line_note call. (expand_function_end): Use force_next_line_note, not emit_line_note_force. * c-parse.in (maybe_type_qual): Adjust emit_line_note calls. * c-semantics.c (genrtl_do_pushlevel, genrtl_goto_stmt, genrtl_expr_stmt_value, genrtl_decl_stmt, genrtl_if_stmt, genrtl_while_stmt, genrtl_do_stmt_1, genrtl_return_stmt, genrtl_for_stmt, genrtl_break_stmt, genrtl_continue_stmt, genrtl_continue_stmt, genrtl_switch_stmt, genrtl_asm_stmt): Likewise. * expr.c (expand_expr): Likewise. * integrate.c (expand_inline_function): Likewise. * stmt.c (set_file_and_line_for_stmt): Take a location_t. (expand_decl_init): Adjust emit_line_note call. * ada/trans.c (build_unit_elab, set_lineno): Adjust emit_line_note calls. * cp/semantics.c: (genrtl_try_block) Adjust emit_line_note calls. * f/com.c (bison_rule_pushlevel_, bison_rule_compstmt_): Adjust emit_line_note calls. * f/ste.c (ffeste_emit_line_note_): Likewise. * java/expr.c (expand_byte_code): * treelang/treetree.c (tree_code_if_start, tree_code_if_else, tree_code_if_end, tree_code_create_function_initial, tree_code_create_function_wrapup, tree_code_generate_return, tree_code_output_expression_statement): Adjust emit_line_note calls. From-SVN: r69047
2003-07-07 19:57:30 +02:00
emit_line_note (input_location);
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
expand_eh_region_start ();
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
expand_stmt (TRY_STMTS (t));
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
if (FN_TRY_BLOCK_P (t))
{
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
expand_start_all_catch ();
in_function_try_handler = 1;
expand_stmt (TRY_HANDLERS (t));
in_function_try_handler = 0;
expand_end_all_catch ();
}
else
{
expand_start_all_catch ();
expand_stmt (TRY_HANDLERS (t));
expand_end_all_catch ();
}
}
}
/* Generate the RTL for T, which is an EH_SPEC_BLOCK. */
static void
genrtl_eh_spec_block (tree t)
{
expand_eh_region_start ();
expand_stmt (EH_SPEC_STMTS (t));
expand_eh_region_end_allowed (EH_SPEC_RAISES (t),
build_call (call_unexpected_node,
tree_cons (NULL_TREE,
build_exc_ptr (),
NULL_TREE)));
}
/* Begin a try-block. Returns a newly-created TRY_BLOCK if
appropriate. */
tree
begin_try_block (void)
{
c-common.h (build_stmt): Declare. 2000-07-10 Benjamin Chelf <chelf@codesourcery.com> * c-common.h (build_stmt): Declare. (build_continue_stmt): Likewise. (build_break_stmt): Likewise. (build_return_stmt): Likewise. * c-decl.c (do_case): Rewrite to do what previously done in c-parse.in. * c-semantics.c (build_stmt): Define. (build_return_stmt): Likewise. (build_break_stmt): Likewise. (build_continue_stmt): Likewise. (build_case_label): Likewise. * c-parse.in (BREAK): Change to build tree, then generate RTL. (CONTINUE): Likewise. (RETURN): Likewise. (CASE): Likewise. (DEFAULT): Likewise. * c-parse.y: Regenerate. * c-pasre.c: Likewise. * cp/semantics.c (finish_for_stmt): Remove call to emit_line_note. (finish_continue_stmt): Likewise. (begin_for_stmt): Remove call to note_level_for_for. (finish_goto_stmt): Change call from build_min_nt to build_stmt. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_stmt): Likewise. (finish_break_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_case_label): Likewise. (genrtl_try_block): Likewise. (begin_try_block): Likewise. (begin_handler): Likewise. (begin_compound_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. * cp/decl.c (finish_constructor_body): Likewise. (finish_destructor_body): Likewise. * cp/optimize.c (copy_body_r): Likewise. (initialize_inlined_parameters): Likewise. (declare_return_variable): Likewise. (expand_call_inline): Likewise. From-SVN: r34943
2000-07-10 12:56:23 +02:00
tree r = build_stmt (TRY_BLOCK, NULL_TREE, NULL_TREE);
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
2000-09-07 03:36:11 +02:00
add_stmt (r);
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
return r;
}
/* Likewise, for a function-try-block. */
tree
begin_function_try_block (void)
{
c-common.h (build_stmt): Declare. 2000-07-10 Benjamin Chelf <chelf@codesourcery.com> * c-common.h (build_stmt): Declare. (build_continue_stmt): Likewise. (build_break_stmt): Likewise. (build_return_stmt): Likewise. * c-decl.c (do_case): Rewrite to do what previously done in c-parse.in. * c-semantics.c (build_stmt): Define. (build_return_stmt): Likewise. (build_break_stmt): Likewise. (build_continue_stmt): Likewise. (build_case_label): Likewise. * c-parse.in (BREAK): Change to build tree, then generate RTL. (CONTINUE): Likewise. (RETURN): Likewise. (CASE): Likewise. (DEFAULT): Likewise. * c-parse.y: Regenerate. * c-pasre.c: Likewise. * cp/semantics.c (finish_for_stmt): Remove call to emit_line_note. (finish_continue_stmt): Likewise. (begin_for_stmt): Remove call to note_level_for_for. (finish_goto_stmt): Change call from build_min_nt to build_stmt. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_stmt): Likewise. (finish_break_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_case_label): Likewise. (genrtl_try_block): Likewise. (begin_try_block): Likewise. (begin_handler): Likewise. (begin_compound_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. * cp/decl.c (finish_constructor_body): Likewise. (finish_destructor_body): Likewise. * cp/optimize.c (copy_body_r): Likewise. (initialize_inlined_parameters): Likewise. (declare_return_variable): Likewise. (expand_call_inline): Likewise. From-SVN: r34943
2000-07-10 12:56:23 +02:00
tree r = build_stmt (TRY_BLOCK, NULL_TREE, NULL_TREE);
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
FN_TRY_BLOCK_P (r) = 1;
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
2000-09-07 03:36:11 +02:00
add_stmt (r);
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
return r;
}
/* Finish a try-block, which may be given by TRY_BLOCK. */
void
finish_try_block (tree try_block)
{
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
RECHAIN_STMTS (try_block, TRY_STMTS (try_block));
}
/* Finish the body of a cleanup try-block, which may be given by
TRY_BLOCK. */
void
finish_cleanup_try_block (tree try_block)
{
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
RECHAIN_STMTS (try_block, TRY_STMTS (try_block));
}
cp-tree.def (SUBOBJECT): New tree node. * cp-tree.def (SUBOBJECT): New tree node. * cp-tree.h (CLEANUP_P): New macro. (SUBOBJECT_CLEANUP): Likewise. (keep_next_level): Add parameter. (get_temp_regvar): Don't declare. (emit_base_init): Remove parameter. (expand_aggr_init): Rename to build_aggr_init. (expand_vec_init): Rename to build_vec_init. (do_pushlevel): Remove. (do_poplevel): Likewise. (finish_cleanup): New function. (finish_subobject): Likewise. (stmts_are_full_exprs_p): New variable. * decl.c (keep_next_level): Add parameter. (cp_finish_decl): Use build_aggr_init, not expand_aggr_init. Use finish_expr_stmt to expand the code. (expand_static_init): Use tree-generating, not RTL-generating, functions to handle the initialization. (start_function): Remove dead code. Always have a momentary obstack inside the function, even before hitting the first curly brace. (cplus_expand_expr_stmt): Move calls to expand_{start,end}_target_temps into semantics.c. (cp_function): Add stmts_are_full_exprs_p. (push_cp_function_context): Save it. (pop_cp_function_context): Restore it. * decl2.c (get_temp_regvar): Move to init.c. (do_static_initialization): Use build_{aggr,vec}_init. (do_static_destruction): Fix typo in comment. * dump.c (dequeue_and_dump): Handle INIT_EXPR. * except.c (expand_throw): Use create_temporary_var. * expr.c (cplus_expand_expr): Use build_{aggr,vec}_init. * init.c (expand_vec_init_try_block): Remove. (expand_vec_init_catch_clause): Likewise. (get_temp_regvar): New function. (begin_init_stmts): Likewise. (finish_init_stmts): Likewise. (perform_member_init): Use build_{aggr,vec}_init. Build up tree structure here. (emit_base_init): Likewise. Remove unused parameter. (expand_virtual_init): Likewise. (expand_cleanup_for_base): Use finish_subobject. (expand_aggr_vbase_init_1): Simplify. (construct_virtual_bases): Use tree-generating functions to build up initialization. (expand_aggr_init): Likewise. Rename to build_aggr_init. (expand_default_init): Likewise. (expand_aggr_init_1): Likewise. (expand_vec_init): Rename to build_vec_init. * method.c (do_build_copy_constructor): Use tree-generating functions. Don't call clear_last_expr. (do_build_assign_ref): Likewise. (synthesize_method): Call clear_last_expr here. * parse.y (base_init): Don't call clear_last_expr here. (nodecls): Likewise. * pt.c (tsubst_expr): Handle a TRY_BLOCK with CLEANUP_P set. * semantics.c (do_pushlevel): Move to here. (do_poplevel): Likewise. (stmts_are_full_exprs_p): New variable. (finish_expr_stmt): Handle logic for temoprary cleanup here. (finish_for_stmt): Use finish_expr_stmt. (finish_cleanup): New function. (finish_function_try_block): Fix indentation. (finish_subobject): New function. (setup_vtbl_ptr): Call keep_next_level here. (finish_stmt_expr): Handle a block with no scope inside the statement-expression. (expand_stmt): Handle a TRY_BLOCK with CLEANUP_P set. Handle SUBOBJECT. * tree.c (search_tree): Handle INIT_EXPR. (mapcar): Likewise. * typeck.c (build_modify_expr): Don't build an RTL_EXPR. * typeck2.c (store_init_value): Change expand_aggr_init to build_aggr_init in comment. From-SVN: r28878
1999-08-26 00:07:18 +02:00
/* Finish an implicitly generated try-block, with a cleanup is given
by CLEANUP. */
void
finish_cleanup (tree cleanup, tree try_block)
cp-tree.def (SUBOBJECT): New tree node. * cp-tree.def (SUBOBJECT): New tree node. * cp-tree.h (CLEANUP_P): New macro. (SUBOBJECT_CLEANUP): Likewise. (keep_next_level): Add parameter. (get_temp_regvar): Don't declare. (emit_base_init): Remove parameter. (expand_aggr_init): Rename to build_aggr_init. (expand_vec_init): Rename to build_vec_init. (do_pushlevel): Remove. (do_poplevel): Likewise. (finish_cleanup): New function. (finish_subobject): Likewise. (stmts_are_full_exprs_p): New variable. * decl.c (keep_next_level): Add parameter. (cp_finish_decl): Use build_aggr_init, not expand_aggr_init. Use finish_expr_stmt to expand the code. (expand_static_init): Use tree-generating, not RTL-generating, functions to handle the initialization. (start_function): Remove dead code. Always have a momentary obstack inside the function, even before hitting the first curly brace. (cplus_expand_expr_stmt): Move calls to expand_{start,end}_target_temps into semantics.c. (cp_function): Add stmts_are_full_exprs_p. (push_cp_function_context): Save it. (pop_cp_function_context): Restore it. * decl2.c (get_temp_regvar): Move to init.c. (do_static_initialization): Use build_{aggr,vec}_init. (do_static_destruction): Fix typo in comment. * dump.c (dequeue_and_dump): Handle INIT_EXPR. * except.c (expand_throw): Use create_temporary_var. * expr.c (cplus_expand_expr): Use build_{aggr,vec}_init. * init.c (expand_vec_init_try_block): Remove. (expand_vec_init_catch_clause): Likewise. (get_temp_regvar): New function. (begin_init_stmts): Likewise. (finish_init_stmts): Likewise. (perform_member_init): Use build_{aggr,vec}_init. Build up tree structure here. (emit_base_init): Likewise. Remove unused parameter. (expand_virtual_init): Likewise. (expand_cleanup_for_base): Use finish_subobject. (expand_aggr_vbase_init_1): Simplify. (construct_virtual_bases): Use tree-generating functions to build up initialization. (expand_aggr_init): Likewise. Rename to build_aggr_init. (expand_default_init): Likewise. (expand_aggr_init_1): Likewise. (expand_vec_init): Rename to build_vec_init. * method.c (do_build_copy_constructor): Use tree-generating functions. Don't call clear_last_expr. (do_build_assign_ref): Likewise. (synthesize_method): Call clear_last_expr here. * parse.y (base_init): Don't call clear_last_expr here. (nodecls): Likewise. * pt.c (tsubst_expr): Handle a TRY_BLOCK with CLEANUP_P set. * semantics.c (do_pushlevel): Move to here. (do_poplevel): Likewise. (stmts_are_full_exprs_p): New variable. (finish_expr_stmt): Handle logic for temoprary cleanup here. (finish_for_stmt): Use finish_expr_stmt. (finish_cleanup): New function. (finish_function_try_block): Fix indentation. (finish_subobject): New function. (setup_vtbl_ptr): Call keep_next_level here. (finish_stmt_expr): Handle a block with no scope inside the statement-expression. (expand_stmt): Handle a TRY_BLOCK with CLEANUP_P set. Handle SUBOBJECT. * tree.c (search_tree): Handle INIT_EXPR. (mapcar): Likewise. * typeck.c (build_modify_expr): Don't build an RTL_EXPR. * typeck2.c (store_init_value): Change expand_aggr_init to build_aggr_init in comment. From-SVN: r28878
1999-08-26 00:07:18 +02:00
{
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
TRY_HANDLERS (try_block) = cleanup;
CLEANUP_P (try_block) = 1;
cp-tree.def (SUBOBJECT): New tree node. * cp-tree.def (SUBOBJECT): New tree node. * cp-tree.h (CLEANUP_P): New macro. (SUBOBJECT_CLEANUP): Likewise. (keep_next_level): Add parameter. (get_temp_regvar): Don't declare. (emit_base_init): Remove parameter. (expand_aggr_init): Rename to build_aggr_init. (expand_vec_init): Rename to build_vec_init. (do_pushlevel): Remove. (do_poplevel): Likewise. (finish_cleanup): New function. (finish_subobject): Likewise. (stmts_are_full_exprs_p): New variable. * decl.c (keep_next_level): Add parameter. (cp_finish_decl): Use build_aggr_init, not expand_aggr_init. Use finish_expr_stmt to expand the code. (expand_static_init): Use tree-generating, not RTL-generating, functions to handle the initialization. (start_function): Remove dead code. Always have a momentary obstack inside the function, even before hitting the first curly brace. (cplus_expand_expr_stmt): Move calls to expand_{start,end}_target_temps into semantics.c. (cp_function): Add stmts_are_full_exprs_p. (push_cp_function_context): Save it. (pop_cp_function_context): Restore it. * decl2.c (get_temp_regvar): Move to init.c. (do_static_initialization): Use build_{aggr,vec}_init. (do_static_destruction): Fix typo in comment. * dump.c (dequeue_and_dump): Handle INIT_EXPR. * except.c (expand_throw): Use create_temporary_var. * expr.c (cplus_expand_expr): Use build_{aggr,vec}_init. * init.c (expand_vec_init_try_block): Remove. (expand_vec_init_catch_clause): Likewise. (get_temp_regvar): New function. (begin_init_stmts): Likewise. (finish_init_stmts): Likewise. (perform_member_init): Use build_{aggr,vec}_init. Build up tree structure here. (emit_base_init): Likewise. Remove unused parameter. (expand_virtual_init): Likewise. (expand_cleanup_for_base): Use finish_subobject. (expand_aggr_vbase_init_1): Simplify. (construct_virtual_bases): Use tree-generating functions to build up initialization. (expand_aggr_init): Likewise. Rename to build_aggr_init. (expand_default_init): Likewise. (expand_aggr_init_1): Likewise. (expand_vec_init): Rename to build_vec_init. * method.c (do_build_copy_constructor): Use tree-generating functions. Don't call clear_last_expr. (do_build_assign_ref): Likewise. (synthesize_method): Call clear_last_expr here. * parse.y (base_init): Don't call clear_last_expr here. (nodecls): Likewise. * pt.c (tsubst_expr): Handle a TRY_BLOCK with CLEANUP_P set. * semantics.c (do_pushlevel): Move to here. (do_poplevel): Likewise. (stmts_are_full_exprs_p): New variable. (finish_expr_stmt): Handle logic for temoprary cleanup here. (finish_for_stmt): Use finish_expr_stmt. (finish_cleanup): New function. (finish_function_try_block): Fix indentation. (finish_subobject): New function. (setup_vtbl_ptr): Call keep_next_level here. (finish_stmt_expr): Handle a block with no scope inside the statement-expression. (expand_stmt): Handle a TRY_BLOCK with CLEANUP_P set. Handle SUBOBJECT. * tree.c (search_tree): Handle INIT_EXPR. (mapcar): Likewise. * typeck.c (build_modify_expr): Don't build an RTL_EXPR. * typeck2.c (store_init_value): Change expand_aggr_init to build_aggr_init in comment. From-SVN: r28878
1999-08-26 00:07:18 +02:00
}
/* Likewise, for a function-try-block. */
void
finish_function_try_block (tree try_block)
{
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
if (TREE_CHAIN (try_block)
&& TREE_CODE (TREE_CHAIN (try_block)) == CTOR_INITIALIZER)
{
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
/* Chain the compound statement after the CTOR_INITIALIZER. */
TREE_CHAIN (TREE_CHAIN (try_block)) = last_tree;
/* And make the CTOR_INITIALIZER the body of the try-block. */
RECHAIN_STMTS (try_block, TRY_STMTS (try_block));
}
else
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
RECHAIN_STMTS (try_block, TRY_STMTS (try_block));
Turn on function-at-a-time processing. * cp-tree.h (doing_semantic_analysis_p): New macro. (SF_DEFAULT): Define to zero, not SF_EXPAND. (start_handler_parms): Change prototype. (expand_start_catch_block): Likewise. (expand_end_catch_block): Likewise. (expand_start_eh_spec): Likewise. (expand_end_eh_spec): Declare. (finish_handler_parms): Change prototype. (begin_catch_block): Declare. (finish_handler): Change prototype. (do_pushlevel): Declare. (do_poplevel): Likewise. * decl.c (pushlevel): Don't create binding levels when not doing semantic analysis. (poplevel): Don't pop them. (pushdecl): Assert that we are never called when not doing semantic analysis. (pushdecl_top_level): Use push_to_top_level. (make_label_decl): Don't fiddle with obstacks. Make RTL For the label when expanding. (cp_finish_decl): Only inject for-scope variables when doing semantic analysis. Add comments. (start_handler_parms): Return the handler parm. (start_function): Reorganize. Don't clear DECL_INITIAL if it is already set. Reinitialize from saved function data if available. Don't pushlevel when not doing semantic analysis. (store_parm_decls): Only generate RTL when expanding. Only pushdecl when doing semantic analysis. Set current_eh_spec_try_block if appropriate. (finish_function): Simplify. Use do_pushlevel and do_poplevel. Combine common code. Don't poplevel when not doing semantic analysis. (push_cp_function_context): Don't expand functions without an explicit call to expand_body. (mark_lang_function): Make eh_spec_try_block and x_scope_stmt_stack. * except.c (expand_end_eh_spec): Don't declare. (process_start_catch_block): Likewise. (push_eh_cleanup): Use finish_decl_cleanup. (initialize_handler_parm): New function. (expand_start_catch_block): Use it. (expand_end_catch_block): Use tree-generation functions, not RTL-generation functions. (expand_start_eh_spec): Likewise. (expand_end_eh_spec): Likewise. (expand_exception_blocks): Simplify. (start_anon_func): Use do_pushlevel. (end_anon_func): Use do_poplvel. Call expand_body for the function. * expr.c (do_case): Don't call define_case_label. * init.c (create_temporary_var): Set DECL_CONTEXT for local variables. * method.c (emit_thunk): Call expand_body for the thunk. (sythesize_method): Likewise. * parse.y (handler_args): Give it ttype. (eat_saved_input): Call expand_body. (base_init): Use do_pushlevel. (pending_inline): Call expand_body. (handler): Adjust calls to finish_handler_parms and finish_handler. (handler_args): Don't call expand_start_catch_block. Return the catch parameter. * pt.c (tsubst_expr): Adjust HANDLER handling. * parse.c: Regenerated. * rtti.c (synthesize_tinfo_fn): Call finish_function. * semantics.c (do_pushlevel): Give it external linkage. Build SCOPE_STMTs. (do_poplevel): Likewise. (finish_case_label): Call define_case_label when doing semantic analysis. (finish_goto_stmt): Create RTL for labels. (finish_function_try_block): Set in_function_try_handler unconditionally. (finish_function_handler_sequence): Unset it. (finish_handler_parms): Use expand_start_catch_block even when building a statement-tree. (begin_catch_block): New function. (finish_handler): Move a little RTL-generation logic here. (finish_decl_cleanup): Allow cleanups for empty declarations. (finish_named_return_value): Don't pushdecl when not doing semantic analysis. (expand_stmt): Don't do semantic analysis for variable declarations. Handle START_CATCH_STMT. Call expand_label directly for a LABEL_STMT. Tweak handling of GOTO_STMT. Adjust HANDLERs. Handle SCOPE_STMT, CTOR_INITIALIZER, and RETURN_INIT. (expand_body): Let expand_stmt handle CTOR_INITIALIZER, RETURN_INIT and function try blocks. From-SVN: r29490
1999-09-18 03:23:20 +02:00
in_function_try_handler = 1;
}
/* Finish a handler-sequence for a try-block, which may be given by
TRY_BLOCK. */
void
finish_handler_sequence (tree try_block)
{
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
RECHAIN_STMTS (try_block, TRY_HANDLERS (try_block));
check_handlers (TRY_HANDLERS (try_block));
}
/* Likewise, for a function-try-block. */
void
finish_function_handler_sequence (tree try_block)
{
Turn on function-at-a-time processing. * cp-tree.h (doing_semantic_analysis_p): New macro. (SF_DEFAULT): Define to zero, not SF_EXPAND. (start_handler_parms): Change prototype. (expand_start_catch_block): Likewise. (expand_end_catch_block): Likewise. (expand_start_eh_spec): Likewise. (expand_end_eh_spec): Declare. (finish_handler_parms): Change prototype. (begin_catch_block): Declare. (finish_handler): Change prototype. (do_pushlevel): Declare. (do_poplevel): Likewise. * decl.c (pushlevel): Don't create binding levels when not doing semantic analysis. (poplevel): Don't pop them. (pushdecl): Assert that we are never called when not doing semantic analysis. (pushdecl_top_level): Use push_to_top_level. (make_label_decl): Don't fiddle with obstacks. Make RTL For the label when expanding. (cp_finish_decl): Only inject for-scope variables when doing semantic analysis. Add comments. (start_handler_parms): Return the handler parm. (start_function): Reorganize. Don't clear DECL_INITIAL if it is already set. Reinitialize from saved function data if available. Don't pushlevel when not doing semantic analysis. (store_parm_decls): Only generate RTL when expanding. Only pushdecl when doing semantic analysis. Set current_eh_spec_try_block if appropriate. (finish_function): Simplify. Use do_pushlevel and do_poplevel. Combine common code. Don't poplevel when not doing semantic analysis. (push_cp_function_context): Don't expand functions without an explicit call to expand_body. (mark_lang_function): Make eh_spec_try_block and x_scope_stmt_stack. * except.c (expand_end_eh_spec): Don't declare. (process_start_catch_block): Likewise. (push_eh_cleanup): Use finish_decl_cleanup. (initialize_handler_parm): New function. (expand_start_catch_block): Use it. (expand_end_catch_block): Use tree-generation functions, not RTL-generation functions. (expand_start_eh_spec): Likewise. (expand_end_eh_spec): Likewise. (expand_exception_blocks): Simplify. (start_anon_func): Use do_pushlevel. (end_anon_func): Use do_poplvel. Call expand_body for the function. * expr.c (do_case): Don't call define_case_label. * init.c (create_temporary_var): Set DECL_CONTEXT for local variables. * method.c (emit_thunk): Call expand_body for the thunk. (sythesize_method): Likewise. * parse.y (handler_args): Give it ttype. (eat_saved_input): Call expand_body. (base_init): Use do_pushlevel. (pending_inline): Call expand_body. (handler): Adjust calls to finish_handler_parms and finish_handler. (handler_args): Don't call expand_start_catch_block. Return the catch parameter. * pt.c (tsubst_expr): Adjust HANDLER handling. * parse.c: Regenerated. * rtti.c (synthesize_tinfo_fn): Call finish_function. * semantics.c (do_pushlevel): Give it external linkage. Build SCOPE_STMTs. (do_poplevel): Likewise. (finish_case_label): Call define_case_label when doing semantic analysis. (finish_goto_stmt): Create RTL for labels. (finish_function_try_block): Set in_function_try_handler unconditionally. (finish_function_handler_sequence): Unset it. (finish_handler_parms): Use expand_start_catch_block even when building a statement-tree. (begin_catch_block): New function. (finish_handler): Move a little RTL-generation logic here. (finish_decl_cleanup): Allow cleanups for empty declarations. (finish_named_return_value): Don't pushdecl when not doing semantic analysis. (expand_stmt): Don't do semantic analysis for variable declarations. Handle START_CATCH_STMT. Call expand_label directly for a LABEL_STMT. Tweak handling of GOTO_STMT. Adjust HANDLERs. Handle SCOPE_STMT, CTOR_INITIALIZER, and RETURN_INIT. (expand_body): Let expand_stmt handle CTOR_INITIALIZER, RETURN_INIT and function try blocks. From-SVN: r29490
1999-09-18 03:23:20 +02:00
in_function_try_handler = 0;
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
RECHAIN_STMTS (try_block, TRY_HANDLERS (try_block));
check_handlers (TRY_HANDLERS (try_block));
}
/* Generate the RTL for T, which is a HANDLER. */
Turn on function-at-a-time processing. * cp-tree.h (doing_semantic_analysis_p): New macro. (SF_DEFAULT): Define to zero, not SF_EXPAND. (start_handler_parms): Change prototype. (expand_start_catch_block): Likewise. (expand_end_catch_block): Likewise. (expand_start_eh_spec): Likewise. (expand_end_eh_spec): Declare. (finish_handler_parms): Change prototype. (begin_catch_block): Declare. (finish_handler): Change prototype. (do_pushlevel): Declare. (do_poplevel): Likewise. * decl.c (pushlevel): Don't create binding levels when not doing semantic analysis. (poplevel): Don't pop them. (pushdecl): Assert that we are never called when not doing semantic analysis. (pushdecl_top_level): Use push_to_top_level. (make_label_decl): Don't fiddle with obstacks. Make RTL For the label when expanding. (cp_finish_decl): Only inject for-scope variables when doing semantic analysis. Add comments. (start_handler_parms): Return the handler parm. (start_function): Reorganize. Don't clear DECL_INITIAL if it is already set. Reinitialize from saved function data if available. Don't pushlevel when not doing semantic analysis. (store_parm_decls): Only generate RTL when expanding. Only pushdecl when doing semantic analysis. Set current_eh_spec_try_block if appropriate. (finish_function): Simplify. Use do_pushlevel and do_poplevel. Combine common code. Don't poplevel when not doing semantic analysis. (push_cp_function_context): Don't expand functions without an explicit call to expand_body. (mark_lang_function): Make eh_spec_try_block and x_scope_stmt_stack. * except.c (expand_end_eh_spec): Don't declare. (process_start_catch_block): Likewise. (push_eh_cleanup): Use finish_decl_cleanup. (initialize_handler_parm): New function. (expand_start_catch_block): Use it. (expand_end_catch_block): Use tree-generation functions, not RTL-generation functions. (expand_start_eh_spec): Likewise. (expand_end_eh_spec): Likewise. (expand_exception_blocks): Simplify. (start_anon_func): Use do_pushlevel. (end_anon_func): Use do_poplvel. Call expand_body for the function. * expr.c (do_case): Don't call define_case_label. * init.c (create_temporary_var): Set DECL_CONTEXT for local variables. * method.c (emit_thunk): Call expand_body for the thunk. (sythesize_method): Likewise. * parse.y (handler_args): Give it ttype. (eat_saved_input): Call expand_body. (base_init): Use do_pushlevel. (pending_inline): Call expand_body. (handler): Adjust calls to finish_handler_parms and finish_handler. (handler_args): Don't call expand_start_catch_block. Return the catch parameter. * pt.c (tsubst_expr): Adjust HANDLER handling. * parse.c: Regenerated. * rtti.c (synthesize_tinfo_fn): Call finish_function. * semantics.c (do_pushlevel): Give it external linkage. Build SCOPE_STMTs. (do_poplevel): Likewise. (finish_case_label): Call define_case_label when doing semantic analysis. (finish_goto_stmt): Create RTL for labels. (finish_function_try_block): Set in_function_try_handler unconditionally. (finish_function_handler_sequence): Unset it. (finish_handler_parms): Use expand_start_catch_block even when building a statement-tree. (begin_catch_block): New function. (finish_handler): Move a little RTL-generation logic here. (finish_decl_cleanup): Allow cleanups for empty declarations. (finish_named_return_value): Don't pushdecl when not doing semantic analysis. (expand_stmt): Don't do semantic analysis for variable declarations. Handle START_CATCH_STMT. Call expand_label directly for a LABEL_STMT. Tweak handling of GOTO_STMT. Adjust HANDLERs. Handle SCOPE_STMT, CTOR_INITIALIZER, and RETURN_INIT. (expand_body): Let expand_stmt handle CTOR_INITIALIZER, RETURN_INIT and function try blocks. From-SVN: r29490
1999-09-18 03:23:20 +02:00
static void
genrtl_handler (tree t)
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
{
genrtl_do_pushlevel ();
if (!processing_template_decl)
expand_start_catch (HANDLER_TYPE (t));
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
expand_stmt (HANDLER_BODY (t));
if (!processing_template_decl)
expand_end_catch ();
}
/* Begin a handler. Returns a HANDLER if appropriate. */
tree
begin_handler (void)
{
tree r;
c-common.h (build_stmt): Declare. 2000-07-10 Benjamin Chelf <chelf@codesourcery.com> * c-common.h (build_stmt): Declare. (build_continue_stmt): Likewise. (build_break_stmt): Likewise. (build_return_stmt): Likewise. * c-decl.c (do_case): Rewrite to do what previously done in c-parse.in. * c-semantics.c (build_stmt): Define. (build_return_stmt): Likewise. (build_break_stmt): Likewise. (build_continue_stmt): Likewise. (build_case_label): Likewise. * c-parse.in (BREAK): Change to build tree, then generate RTL. (CONTINUE): Likewise. (RETURN): Likewise. (CASE): Likewise. (DEFAULT): Likewise. * c-parse.y: Regenerate. * c-pasre.c: Likewise. * cp/semantics.c (finish_for_stmt): Remove call to emit_line_note. (finish_continue_stmt): Likewise. (begin_for_stmt): Remove call to note_level_for_for. (finish_goto_stmt): Change call from build_min_nt to build_stmt. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_stmt): Likewise. (finish_break_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_case_label): Likewise. (genrtl_try_block): Likewise. (begin_try_block): Likewise. (begin_handler): Likewise. (begin_compound_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. * cp/decl.c (finish_constructor_body): Likewise. (finish_destructor_body): Likewise. * cp/optimize.c (copy_body_r): Likewise. (initialize_inlined_parameters): Likewise. (declare_return_variable): Likewise. (expand_call_inline): Likewise. From-SVN: r34943
2000-07-10 12:56:23 +02:00
r = build_stmt (HANDLER, NULL_TREE, NULL_TREE);
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
2000-09-07 03:36:11 +02:00
add_stmt (r);
/* Create a binding level for the eh_info and the exception object
cleanup. */
do_pushlevel (sk_catch);
return r;
}
/* Finish the handler-parameters for a handler, which may be given by
Turn on function-at-a-time processing. * cp-tree.h (doing_semantic_analysis_p): New macro. (SF_DEFAULT): Define to zero, not SF_EXPAND. (start_handler_parms): Change prototype. (expand_start_catch_block): Likewise. (expand_end_catch_block): Likewise. (expand_start_eh_spec): Likewise. (expand_end_eh_spec): Declare. (finish_handler_parms): Change prototype. (begin_catch_block): Declare. (finish_handler): Change prototype. (do_pushlevel): Declare. (do_poplevel): Likewise. * decl.c (pushlevel): Don't create binding levels when not doing semantic analysis. (poplevel): Don't pop them. (pushdecl): Assert that we are never called when not doing semantic analysis. (pushdecl_top_level): Use push_to_top_level. (make_label_decl): Don't fiddle with obstacks. Make RTL For the label when expanding. (cp_finish_decl): Only inject for-scope variables when doing semantic analysis. Add comments. (start_handler_parms): Return the handler parm. (start_function): Reorganize. Don't clear DECL_INITIAL if it is already set. Reinitialize from saved function data if available. Don't pushlevel when not doing semantic analysis. (store_parm_decls): Only generate RTL when expanding. Only pushdecl when doing semantic analysis. Set current_eh_spec_try_block if appropriate. (finish_function): Simplify. Use do_pushlevel and do_poplevel. Combine common code. Don't poplevel when not doing semantic analysis. (push_cp_function_context): Don't expand functions without an explicit call to expand_body. (mark_lang_function): Make eh_spec_try_block and x_scope_stmt_stack. * except.c (expand_end_eh_spec): Don't declare. (process_start_catch_block): Likewise. (push_eh_cleanup): Use finish_decl_cleanup. (initialize_handler_parm): New function. (expand_start_catch_block): Use it. (expand_end_catch_block): Use tree-generation functions, not RTL-generation functions. (expand_start_eh_spec): Likewise. (expand_end_eh_spec): Likewise. (expand_exception_blocks): Simplify. (start_anon_func): Use do_pushlevel. (end_anon_func): Use do_poplvel. Call expand_body for the function. * expr.c (do_case): Don't call define_case_label. * init.c (create_temporary_var): Set DECL_CONTEXT for local variables. * method.c (emit_thunk): Call expand_body for the thunk. (sythesize_method): Likewise. * parse.y (handler_args): Give it ttype. (eat_saved_input): Call expand_body. (base_init): Use do_pushlevel. (pending_inline): Call expand_body. (handler): Adjust calls to finish_handler_parms and finish_handler. (handler_args): Don't call expand_start_catch_block. Return the catch parameter. * pt.c (tsubst_expr): Adjust HANDLER handling. * parse.c: Regenerated. * rtti.c (synthesize_tinfo_fn): Call finish_function. * semantics.c (do_pushlevel): Give it external linkage. Build SCOPE_STMTs. (do_poplevel): Likewise. (finish_case_label): Call define_case_label when doing semantic analysis. (finish_goto_stmt): Create RTL for labels. (finish_function_try_block): Set in_function_try_handler unconditionally. (finish_function_handler_sequence): Unset it. (finish_handler_parms): Use expand_start_catch_block even when building a statement-tree. (begin_catch_block): New function. (finish_handler): Move a little RTL-generation logic here. (finish_decl_cleanup): Allow cleanups for empty declarations. (finish_named_return_value): Don't pushdecl when not doing semantic analysis. (expand_stmt): Don't do semantic analysis for variable declarations. Handle START_CATCH_STMT. Call expand_label directly for a LABEL_STMT. Tweak handling of GOTO_STMT. Adjust HANDLERs. Handle SCOPE_STMT, CTOR_INITIALIZER, and RETURN_INIT. (expand_body): Let expand_stmt handle CTOR_INITIALIZER, RETURN_INIT and function try blocks. From-SVN: r29490
1999-09-18 03:23:20 +02:00
HANDLER. DECL is the declaration for the catch parameter, or NULL
if this is a `catch (...)' clause. */
void
finish_handler_parms (tree decl, tree handler)
Turn on function-at-a-time processing. * cp-tree.h (doing_semantic_analysis_p): New macro. (SF_DEFAULT): Define to zero, not SF_EXPAND. (start_handler_parms): Change prototype. (expand_start_catch_block): Likewise. (expand_end_catch_block): Likewise. (expand_start_eh_spec): Likewise. (expand_end_eh_spec): Declare. (finish_handler_parms): Change prototype. (begin_catch_block): Declare. (finish_handler): Change prototype. (do_pushlevel): Declare. (do_poplevel): Likewise. * decl.c (pushlevel): Don't create binding levels when not doing semantic analysis. (poplevel): Don't pop them. (pushdecl): Assert that we are never called when not doing semantic analysis. (pushdecl_top_level): Use push_to_top_level. (make_label_decl): Don't fiddle with obstacks. Make RTL For the label when expanding. (cp_finish_decl): Only inject for-scope variables when doing semantic analysis. Add comments. (start_handler_parms): Return the handler parm. (start_function): Reorganize. Don't clear DECL_INITIAL if it is already set. Reinitialize from saved function data if available. Don't pushlevel when not doing semantic analysis. (store_parm_decls): Only generate RTL when expanding. Only pushdecl when doing semantic analysis. Set current_eh_spec_try_block if appropriate. (finish_function): Simplify. Use do_pushlevel and do_poplevel. Combine common code. Don't poplevel when not doing semantic analysis. (push_cp_function_context): Don't expand functions without an explicit call to expand_body. (mark_lang_function): Make eh_spec_try_block and x_scope_stmt_stack. * except.c (expand_end_eh_spec): Don't declare. (process_start_catch_block): Likewise. (push_eh_cleanup): Use finish_decl_cleanup. (initialize_handler_parm): New function. (expand_start_catch_block): Use it. (expand_end_catch_block): Use tree-generation functions, not RTL-generation functions. (expand_start_eh_spec): Likewise. (expand_end_eh_spec): Likewise. (expand_exception_blocks): Simplify. (start_anon_func): Use do_pushlevel. (end_anon_func): Use do_poplvel. Call expand_body for the function. * expr.c (do_case): Don't call define_case_label. * init.c (create_temporary_var): Set DECL_CONTEXT for local variables. * method.c (emit_thunk): Call expand_body for the thunk. (sythesize_method): Likewise. * parse.y (handler_args): Give it ttype. (eat_saved_input): Call expand_body. (base_init): Use do_pushlevel. (pending_inline): Call expand_body. (handler): Adjust calls to finish_handler_parms and finish_handler. (handler_args): Don't call expand_start_catch_block. Return the catch parameter. * pt.c (tsubst_expr): Adjust HANDLER handling. * parse.c: Regenerated. * rtti.c (synthesize_tinfo_fn): Call finish_function. * semantics.c (do_pushlevel): Give it external linkage. Build SCOPE_STMTs. (do_poplevel): Likewise. (finish_case_label): Call define_case_label when doing semantic analysis. (finish_goto_stmt): Create RTL for labels. (finish_function_try_block): Set in_function_try_handler unconditionally. (finish_function_handler_sequence): Unset it. (finish_handler_parms): Use expand_start_catch_block even when building a statement-tree. (begin_catch_block): New function. (finish_handler): Move a little RTL-generation logic here. (finish_decl_cleanup): Allow cleanups for empty declarations. (finish_named_return_value): Don't pushdecl when not doing semantic analysis. (expand_stmt): Don't do semantic analysis for variable declarations. Handle START_CATCH_STMT. Call expand_label directly for a LABEL_STMT. Tweak handling of GOTO_STMT. Adjust HANDLERs. Handle SCOPE_STMT, CTOR_INITIALIZER, and RETURN_INIT. (expand_body): Let expand_stmt handle CTOR_INITIALIZER, RETURN_INIT and function try blocks. From-SVN: r29490
1999-09-18 03:23:20 +02:00
{
tree type = NULL_TREE;
Turn on function-at-a-time processing. * cp-tree.h (doing_semantic_analysis_p): New macro. (SF_DEFAULT): Define to zero, not SF_EXPAND. (start_handler_parms): Change prototype. (expand_start_catch_block): Likewise. (expand_end_catch_block): Likewise. (expand_start_eh_spec): Likewise. (expand_end_eh_spec): Declare. (finish_handler_parms): Change prototype. (begin_catch_block): Declare. (finish_handler): Change prototype. (do_pushlevel): Declare. (do_poplevel): Likewise. * decl.c (pushlevel): Don't create binding levels when not doing semantic analysis. (poplevel): Don't pop them. (pushdecl): Assert that we are never called when not doing semantic analysis. (pushdecl_top_level): Use push_to_top_level. (make_label_decl): Don't fiddle with obstacks. Make RTL For the label when expanding. (cp_finish_decl): Only inject for-scope variables when doing semantic analysis. Add comments. (start_handler_parms): Return the handler parm. (start_function): Reorganize. Don't clear DECL_INITIAL if it is already set. Reinitialize from saved function data if available. Don't pushlevel when not doing semantic analysis. (store_parm_decls): Only generate RTL when expanding. Only pushdecl when doing semantic analysis. Set current_eh_spec_try_block if appropriate. (finish_function): Simplify. Use do_pushlevel and do_poplevel. Combine common code. Don't poplevel when not doing semantic analysis. (push_cp_function_context): Don't expand functions without an explicit call to expand_body. (mark_lang_function): Make eh_spec_try_block and x_scope_stmt_stack. * except.c (expand_end_eh_spec): Don't declare. (process_start_catch_block): Likewise. (push_eh_cleanup): Use finish_decl_cleanup. (initialize_handler_parm): New function. (expand_start_catch_block): Use it. (expand_end_catch_block): Use tree-generation functions, not RTL-generation functions. (expand_start_eh_spec): Likewise. (expand_end_eh_spec): Likewise. (expand_exception_blocks): Simplify. (start_anon_func): Use do_pushlevel. (end_anon_func): Use do_poplvel. Call expand_body for the function. * expr.c (do_case): Don't call define_case_label. * init.c (create_temporary_var): Set DECL_CONTEXT for local variables. * method.c (emit_thunk): Call expand_body for the thunk. (sythesize_method): Likewise. * parse.y (handler_args): Give it ttype. (eat_saved_input): Call expand_body. (base_init): Use do_pushlevel. (pending_inline): Call expand_body. (handler): Adjust calls to finish_handler_parms and finish_handler. (handler_args): Don't call expand_start_catch_block. Return the catch parameter. * pt.c (tsubst_expr): Adjust HANDLER handling. * parse.c: Regenerated. * rtti.c (synthesize_tinfo_fn): Call finish_function. * semantics.c (do_pushlevel): Give it external linkage. Build SCOPE_STMTs. (do_poplevel): Likewise. (finish_case_label): Call define_case_label when doing semantic analysis. (finish_goto_stmt): Create RTL for labels. (finish_function_try_block): Set in_function_try_handler unconditionally. (finish_function_handler_sequence): Unset it. (finish_handler_parms): Use expand_start_catch_block even when building a statement-tree. (begin_catch_block): New function. (finish_handler): Move a little RTL-generation logic here. (finish_decl_cleanup): Allow cleanups for empty declarations. (finish_named_return_value): Don't pushdecl when not doing semantic analysis. (expand_stmt): Don't do semantic analysis for variable declarations. Handle START_CATCH_STMT. Call expand_label directly for a LABEL_STMT. Tweak handling of GOTO_STMT. Adjust HANDLERs. Handle SCOPE_STMT, CTOR_INITIALIZER, and RETURN_INIT. (expand_body): Let expand_stmt handle CTOR_INITIALIZER, RETURN_INIT and function try blocks. From-SVN: r29490
1999-09-18 03:23:20 +02:00
if (processing_template_decl)
{
if (decl)
{
decl = pushdecl (decl);
decl = push_template_decl (decl);
add_decl_stmt (decl);
RECHAIN_STMTS (handler, HANDLER_PARMS (handler));
type = TREE_TYPE (decl);
Turn on function-at-a-time processing. * cp-tree.h (doing_semantic_analysis_p): New macro. (SF_DEFAULT): Define to zero, not SF_EXPAND. (start_handler_parms): Change prototype. (expand_start_catch_block): Likewise. (expand_end_catch_block): Likewise. (expand_start_eh_spec): Likewise. (expand_end_eh_spec): Declare. (finish_handler_parms): Change prototype. (begin_catch_block): Declare. (finish_handler): Change prototype. (do_pushlevel): Declare. (do_poplevel): Likewise. * decl.c (pushlevel): Don't create binding levels when not doing semantic analysis. (poplevel): Don't pop them. (pushdecl): Assert that we are never called when not doing semantic analysis. (pushdecl_top_level): Use push_to_top_level. (make_label_decl): Don't fiddle with obstacks. Make RTL For the label when expanding. (cp_finish_decl): Only inject for-scope variables when doing semantic analysis. Add comments. (start_handler_parms): Return the handler parm. (start_function): Reorganize. Don't clear DECL_INITIAL if it is already set. Reinitialize from saved function data if available. Don't pushlevel when not doing semantic analysis. (store_parm_decls): Only generate RTL when expanding. Only pushdecl when doing semantic analysis. Set current_eh_spec_try_block if appropriate. (finish_function): Simplify. Use do_pushlevel and do_poplevel. Combine common code. Don't poplevel when not doing semantic analysis. (push_cp_function_context): Don't expand functions without an explicit call to expand_body. (mark_lang_function): Make eh_spec_try_block and x_scope_stmt_stack. * except.c (expand_end_eh_spec): Don't declare. (process_start_catch_block): Likewise. (push_eh_cleanup): Use finish_decl_cleanup. (initialize_handler_parm): New function. (expand_start_catch_block): Use it. (expand_end_catch_block): Use tree-generation functions, not RTL-generation functions. (expand_start_eh_spec): Likewise. (expand_end_eh_spec): Likewise. (expand_exception_blocks): Simplify. (start_anon_func): Use do_pushlevel. (end_anon_func): Use do_poplvel. Call expand_body for the function. * expr.c (do_case): Don't call define_case_label. * init.c (create_temporary_var): Set DECL_CONTEXT for local variables. * method.c (emit_thunk): Call expand_body for the thunk. (sythesize_method): Likewise. * parse.y (handler_args): Give it ttype. (eat_saved_input): Call expand_body. (base_init): Use do_pushlevel. (pending_inline): Call expand_body. (handler): Adjust calls to finish_handler_parms and finish_handler. (handler_args): Don't call expand_start_catch_block. Return the catch parameter. * pt.c (tsubst_expr): Adjust HANDLER handling. * parse.c: Regenerated. * rtti.c (synthesize_tinfo_fn): Call finish_function. * semantics.c (do_pushlevel): Give it external linkage. Build SCOPE_STMTs. (do_poplevel): Likewise. (finish_case_label): Call define_case_label when doing semantic analysis. (finish_goto_stmt): Create RTL for labels. (finish_function_try_block): Set in_function_try_handler unconditionally. (finish_function_handler_sequence): Unset it. (finish_handler_parms): Use expand_start_catch_block even when building a statement-tree. (begin_catch_block): New function. (finish_handler): Move a little RTL-generation logic here. (finish_decl_cleanup): Allow cleanups for empty declarations. (finish_named_return_value): Don't pushdecl when not doing semantic analysis. (expand_stmt): Don't do semantic analysis for variable declarations. Handle START_CATCH_STMT. Call expand_label directly for a LABEL_STMT. Tweak handling of GOTO_STMT. Adjust HANDLERs. Handle SCOPE_STMT, CTOR_INITIALIZER, and RETURN_INIT. (expand_body): Let expand_stmt handle CTOR_INITIALIZER, RETURN_INIT and function try blocks. From-SVN: r29490
1999-09-18 03:23:20 +02:00
}
}
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
else
type = expand_start_catch_block (decl);
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
HANDLER_TYPE (handler) = type;
if (type)
mark_used (eh_type_info (type));
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
}
/* Finish a handler, which may be given by HANDLER. The BLOCKs are
the return value from the matching call to finish_handler_parms. */
void
finish_handler (tree handler)
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
{
if (!processing_template_decl)
expand_end_catch_block ();
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
do_poplevel ();
RECHAIN_STMTS (handler, HANDLER_BODY (handler));
}
/* Begin a compound-statement. If HAS_NO_SCOPE is true, the
compound-statement does not define a scope. Returns a new
COMPOUND_STMT. */
tree
begin_compound_stmt (bool has_no_scope)
{
tree r;
int is_try = 0;
c-common.h (build_stmt): Declare. 2000-07-10 Benjamin Chelf <chelf@codesourcery.com> * c-common.h (build_stmt): Declare. (build_continue_stmt): Likewise. (build_break_stmt): Likewise. (build_return_stmt): Likewise. * c-decl.c (do_case): Rewrite to do what previously done in c-parse.in. * c-semantics.c (build_stmt): Define. (build_return_stmt): Likewise. (build_break_stmt): Likewise. (build_continue_stmt): Likewise. (build_case_label): Likewise. * c-parse.in (BREAK): Change to build tree, then generate RTL. (CONTINUE): Likewise. (RETURN): Likewise. (CASE): Likewise. (DEFAULT): Likewise. * c-parse.y: Regenerate. * c-pasre.c: Likewise. * cp/semantics.c (finish_for_stmt): Remove call to emit_line_note. (finish_continue_stmt): Likewise. (begin_for_stmt): Remove call to note_level_for_for. (finish_goto_stmt): Change call from build_min_nt to build_stmt. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_stmt): Likewise. (finish_break_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_case_label): Likewise. (genrtl_try_block): Likewise. (begin_try_block): Likewise. (begin_handler): Likewise. (begin_compound_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. * cp/decl.c (finish_constructor_body): Likewise. (finish_destructor_body): Likewise. * cp/optimize.c (copy_body_r): Likewise. (initialize_inlined_parameters): Likewise. (declare_return_variable): Likewise. (expand_call_inline): Likewise. From-SVN: r34943
2000-07-10 12:56:23 +02:00
r = build_stmt (COMPOUND_STMT, NULL_TREE);
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
if (last_tree && TREE_CODE (last_tree) == TRY_BLOCK)
is_try = 1;
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
2000-09-07 03:36:11 +02:00
add_stmt (r);
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
if (has_no_scope)
COMPOUND_STMT_NO_SCOPE (r) = 1;
cp-tree.def (STMT_EXPR): New tree node. * cp-tree.def (STMT_EXPR): New tree node. * cp-tree.h (STMT_EXPR_STMT): New macro. (store_return_init): Change prototype. (finish_named_return_value): New function. (expand_stmt): Likewise. (expand_body): Likewise. (begin_stmt_tree): Likewise. (finish_stmt_tree): Likewise. (expanding_p): New variable. (last_expr_type): Likewise. (building_stmt_tree): New macro. * decl.c (start_function): Use building_stmt_tree, not processing_template_decl, where appropriate. (store_parm_decls): Likewise. (store_return_init): Move most of the body to semantics.c. (finish_function): Use building_stmt_tree. (finish_stmt): Clear last_expr_type here. (cp_function): Add expanding_p, last_tree, last_expr_type. (push_cp_function_context): Save them. (pop_cp_function_context): Restore them. * decl2.c (setup_vtbl_ptr): Move to semantics.c. * error.c (dump_expr): Handle STMT_EXPR. * except.c (expand_start_catch_block): Use building_stmt_tree. Use add_decl_stmt. * expr.c (cplus_expand_expr): Handle STMT_EXPR. (do_case): Move add_tree call to semantics.c. * parse.y (return_init): Use finish_named_return_value. (for.init.statement): Use finish_expr_stmt. * parse.c: Regenerated. * pt.c (do_pushlevel): Move to semantics.c. (do_poplevel): Likewise. (tsubst_copy): Handle STMT_EXPR instead of BIND_EXPR. (tsubst_expr): Don't expand all the way to RTL here. Handle RETURN_INIT and CTOR_INITIALIZER. (instantiate_decl): Call expand_body after tsubst'ing into DECL_SAVED_TREE. * semantics.c (expand_stmts): New function. (expanding_p): New variable. (last_expr_type): Likewise. (finish_expr_stmt): Use building_stmt_tree. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (fnish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_for_stmt): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (finish_switch_cond): Likewise. (finish_switch_stmt): Likewise. (finish_case_label): Call add_tree here if necessary. (finish_goto_statement): Use building_stmt_tree. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_named_return_value): New function. (setup_vtbl_ptr): Moved here from decl2.c. (do_pushlevel): Moved here from pt.c. (do_poplevel): Likewise. (begin_stmt_expr): Use building_stmt_tree. (finish_stmt_expr): Likewise. Build a STMT_EXPR, not a BIND_EXPR, when building_stmt_tree. (begin_stmt_tree): New function. (finish_stmt_tree): Likewise. (expand_stmt): Likewise. (expand_body): Likewise. * tree.c (build_cplus_method_type): Make sure the argument types end up on the same obstack as the METHOD_TYPE. (search_tree): Handle COMPOUND_EXPR, MODIFY_EXPR, THROW_EXPR, STMT_EXPR. (mapcar): Break out common cases. Handle COMPOUND_EXPR, MODIFY_EXPR, THROW_EXPR, STMT_EXPR, RTL_EXPR. Abort, rather than sorry, if an unsupported node is encountered. * typeck.c (require_complete_type_in_void): Handle BIND_EXPR. (c_expand_return): Don't call add_tree here. From-SVN: r28729
1999-08-16 21:01:36 +02:00
last_expr_type = NULL_TREE;
if (!has_no_scope)
do_pushlevel (is_try ? sk_try : sk_block);
cp-tree.def (SUBOBJECT): New tree node. * cp-tree.def (SUBOBJECT): New tree node. * cp-tree.h (CLEANUP_P): New macro. (SUBOBJECT_CLEANUP): Likewise. (keep_next_level): Add parameter. (get_temp_regvar): Don't declare. (emit_base_init): Remove parameter. (expand_aggr_init): Rename to build_aggr_init. (expand_vec_init): Rename to build_vec_init. (do_pushlevel): Remove. (do_poplevel): Likewise. (finish_cleanup): New function. (finish_subobject): Likewise. (stmts_are_full_exprs_p): New variable. * decl.c (keep_next_level): Add parameter. (cp_finish_decl): Use build_aggr_init, not expand_aggr_init. Use finish_expr_stmt to expand the code. (expand_static_init): Use tree-generating, not RTL-generating, functions to handle the initialization. (start_function): Remove dead code. Always have a momentary obstack inside the function, even before hitting the first curly brace. (cplus_expand_expr_stmt): Move calls to expand_{start,end}_target_temps into semantics.c. (cp_function): Add stmts_are_full_exprs_p. (push_cp_function_context): Save it. (pop_cp_function_context): Restore it. * decl2.c (get_temp_regvar): Move to init.c. (do_static_initialization): Use build_{aggr,vec}_init. (do_static_destruction): Fix typo in comment. * dump.c (dequeue_and_dump): Handle INIT_EXPR. * except.c (expand_throw): Use create_temporary_var. * expr.c (cplus_expand_expr): Use build_{aggr,vec}_init. * init.c (expand_vec_init_try_block): Remove. (expand_vec_init_catch_clause): Likewise. (get_temp_regvar): New function. (begin_init_stmts): Likewise. (finish_init_stmts): Likewise. (perform_member_init): Use build_{aggr,vec}_init. Build up tree structure here. (emit_base_init): Likewise. Remove unused parameter. (expand_virtual_init): Likewise. (expand_cleanup_for_base): Use finish_subobject. (expand_aggr_vbase_init_1): Simplify. (construct_virtual_bases): Use tree-generating functions to build up initialization. (expand_aggr_init): Likewise. Rename to build_aggr_init. (expand_default_init): Likewise. (expand_aggr_init_1): Likewise. (expand_vec_init): Rename to build_vec_init. * method.c (do_build_copy_constructor): Use tree-generating functions. Don't call clear_last_expr. (do_build_assign_ref): Likewise. (synthesize_method): Call clear_last_expr here. * parse.y (base_init): Don't call clear_last_expr here. (nodecls): Likewise. * pt.c (tsubst_expr): Handle a TRY_BLOCK with CLEANUP_P set. * semantics.c (do_pushlevel): Move to here. (do_poplevel): Likewise. (stmts_are_full_exprs_p): New variable. (finish_expr_stmt): Handle logic for temoprary cleanup here. (finish_for_stmt): Use finish_expr_stmt. (finish_cleanup): New function. (finish_function_try_block): Fix indentation. (finish_subobject): New function. (setup_vtbl_ptr): Call keep_next_level here. (finish_stmt_expr): Handle a block with no scope inside the statement-expression. (expand_stmt): Handle a TRY_BLOCK with CLEANUP_P set. Handle SUBOBJECT. * tree.c (search_tree): Handle INIT_EXPR. (mapcar): Likewise. * typeck.c (build_modify_expr): Don't build an RTL_EXPR. * typeck2.c (store_init_value): Change expand_aggr_init to build_aggr_init in comment. From-SVN: r28878
1999-08-26 00:07:18 +02:00
else
/* Normally, we try hard to keep the BLOCK for a
statement-expression. But, if it's a statement-expression with
a scopeless block, there's nothing to keep, and we don't want
to accidentally keep a block *inside* the scopeless block. */
keep_next_level (false);
return r;
}
/* Finish a compound-statement, which is given by COMPOUND_STMT. */
tree
finish_compound_stmt (tree compound_stmt)
{
tree r;
cp-tree.def (STMT_EXPR): New tree node. * cp-tree.def (STMT_EXPR): New tree node. * cp-tree.h (STMT_EXPR_STMT): New macro. (store_return_init): Change prototype. (finish_named_return_value): New function. (expand_stmt): Likewise. (expand_body): Likewise. (begin_stmt_tree): Likewise. (finish_stmt_tree): Likewise. (expanding_p): New variable. (last_expr_type): Likewise. (building_stmt_tree): New macro. * decl.c (start_function): Use building_stmt_tree, not processing_template_decl, where appropriate. (store_parm_decls): Likewise. (store_return_init): Move most of the body to semantics.c. (finish_function): Use building_stmt_tree. (finish_stmt): Clear last_expr_type here. (cp_function): Add expanding_p, last_tree, last_expr_type. (push_cp_function_context): Save them. (pop_cp_function_context): Restore them. * decl2.c (setup_vtbl_ptr): Move to semantics.c. * error.c (dump_expr): Handle STMT_EXPR. * except.c (expand_start_catch_block): Use building_stmt_tree. Use add_decl_stmt. * expr.c (cplus_expand_expr): Handle STMT_EXPR. (do_case): Move add_tree call to semantics.c. * parse.y (return_init): Use finish_named_return_value. (for.init.statement): Use finish_expr_stmt. * parse.c: Regenerated. * pt.c (do_pushlevel): Move to semantics.c. (do_poplevel): Likewise. (tsubst_copy): Handle STMT_EXPR instead of BIND_EXPR. (tsubst_expr): Don't expand all the way to RTL here. Handle RETURN_INIT and CTOR_INITIALIZER. (instantiate_decl): Call expand_body after tsubst'ing into DECL_SAVED_TREE. * semantics.c (expand_stmts): New function. (expanding_p): New variable. (last_expr_type): Likewise. (finish_expr_stmt): Use building_stmt_tree. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (fnish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_for_stmt): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (finish_switch_cond): Likewise. (finish_switch_stmt): Likewise. (finish_case_label): Call add_tree here if necessary. (finish_goto_statement): Use building_stmt_tree. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_named_return_value): New function. (setup_vtbl_ptr): Moved here from decl2.c. (do_pushlevel): Moved here from pt.c. (do_poplevel): Likewise. (begin_stmt_expr): Use building_stmt_tree. (finish_stmt_expr): Likewise. Build a STMT_EXPR, not a BIND_EXPR, when building_stmt_tree. (begin_stmt_tree): New function. (finish_stmt_tree): Likewise. (expand_stmt): Likewise. (expand_body): Likewise. * tree.c (build_cplus_method_type): Make sure the argument types end up on the same obstack as the METHOD_TYPE. (search_tree): Handle COMPOUND_EXPR, MODIFY_EXPR, THROW_EXPR, STMT_EXPR. (mapcar): Break out common cases. Handle COMPOUND_EXPR, MODIFY_EXPR, THROW_EXPR, STMT_EXPR, RTL_EXPR. Abort, rather than sorry, if an unsupported node is encountered. * typeck.c (require_complete_type_in_void): Handle BIND_EXPR. (c_expand_return): Don't call add_tree here. From-SVN: r28729
1999-08-16 21:01:36 +02:00
tree t;
if (COMPOUND_STMT_NO_SCOPE (compound_stmt))
r = NULL_TREE;
else
r = do_poplevel ();
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
RECHAIN_STMTS (compound_stmt, COMPOUND_BODY (compound_stmt));
/* When we call finish_stmt we will lose LAST_EXPR_TYPE. But, since
cp-tree.def (STMT_EXPR): New tree node. * cp-tree.def (STMT_EXPR): New tree node. * cp-tree.h (STMT_EXPR_STMT): New macro. (store_return_init): Change prototype. (finish_named_return_value): New function. (expand_stmt): Likewise. (expand_body): Likewise. (begin_stmt_tree): Likewise. (finish_stmt_tree): Likewise. (expanding_p): New variable. (last_expr_type): Likewise. (building_stmt_tree): New macro. * decl.c (start_function): Use building_stmt_tree, not processing_template_decl, where appropriate. (store_parm_decls): Likewise. (store_return_init): Move most of the body to semantics.c. (finish_function): Use building_stmt_tree. (finish_stmt): Clear last_expr_type here. (cp_function): Add expanding_p, last_tree, last_expr_type. (push_cp_function_context): Save them. (pop_cp_function_context): Restore them. * decl2.c (setup_vtbl_ptr): Move to semantics.c. * error.c (dump_expr): Handle STMT_EXPR. * except.c (expand_start_catch_block): Use building_stmt_tree. Use add_decl_stmt. * expr.c (cplus_expand_expr): Handle STMT_EXPR. (do_case): Move add_tree call to semantics.c. * parse.y (return_init): Use finish_named_return_value. (for.init.statement): Use finish_expr_stmt. * parse.c: Regenerated. * pt.c (do_pushlevel): Move to semantics.c. (do_poplevel): Likewise. (tsubst_copy): Handle STMT_EXPR instead of BIND_EXPR. (tsubst_expr): Don't expand all the way to RTL here. Handle RETURN_INIT and CTOR_INITIALIZER. (instantiate_decl): Call expand_body after tsubst'ing into DECL_SAVED_TREE. * semantics.c (expand_stmts): New function. (expanding_p): New variable. (last_expr_type): Likewise. (finish_expr_stmt): Use building_stmt_tree. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (fnish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_for_stmt): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (finish_switch_cond): Likewise. (finish_switch_stmt): Likewise. (finish_case_label): Call add_tree here if necessary. (finish_goto_statement): Use building_stmt_tree. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_named_return_value): New function. (setup_vtbl_ptr): Moved here from decl2.c. (do_pushlevel): Moved here from pt.c. (do_poplevel): Likewise. (begin_stmt_expr): Use building_stmt_tree. (finish_stmt_expr): Likewise. Build a STMT_EXPR, not a BIND_EXPR, when building_stmt_tree. (begin_stmt_tree): New function. (finish_stmt_tree): Likewise. (expand_stmt): Likewise. (expand_body): Likewise. * tree.c (build_cplus_method_type): Make sure the argument types end up on the same obstack as the METHOD_TYPE. (search_tree): Handle COMPOUND_EXPR, MODIFY_EXPR, THROW_EXPR, STMT_EXPR. (mapcar): Break out common cases. Handle COMPOUND_EXPR, MODIFY_EXPR, THROW_EXPR, STMT_EXPR, RTL_EXPR. Abort, rather than sorry, if an unsupported node is encountered. * typeck.c (require_complete_type_in_void): Handle BIND_EXPR. (c_expand_return): Don't call add_tree here. From-SVN: r28729
1999-08-16 21:01:36 +02:00
the precise purpose of that variable is store the type of the
last expression statement within the last compound statement, we
preserve the value. */
t = last_expr_type;
finish_stmt ();
cp-tree.def (STMT_EXPR): New tree node. * cp-tree.def (STMT_EXPR): New tree node. * cp-tree.h (STMT_EXPR_STMT): New macro. (store_return_init): Change prototype. (finish_named_return_value): New function. (expand_stmt): Likewise. (expand_body): Likewise. (begin_stmt_tree): Likewise. (finish_stmt_tree): Likewise. (expanding_p): New variable. (last_expr_type): Likewise. (building_stmt_tree): New macro. * decl.c (start_function): Use building_stmt_tree, not processing_template_decl, where appropriate. (store_parm_decls): Likewise. (store_return_init): Move most of the body to semantics.c. (finish_function): Use building_stmt_tree. (finish_stmt): Clear last_expr_type here. (cp_function): Add expanding_p, last_tree, last_expr_type. (push_cp_function_context): Save them. (pop_cp_function_context): Restore them. * decl2.c (setup_vtbl_ptr): Move to semantics.c. * error.c (dump_expr): Handle STMT_EXPR. * except.c (expand_start_catch_block): Use building_stmt_tree. Use add_decl_stmt. * expr.c (cplus_expand_expr): Handle STMT_EXPR. (do_case): Move add_tree call to semantics.c. * parse.y (return_init): Use finish_named_return_value. (for.init.statement): Use finish_expr_stmt. * parse.c: Regenerated. * pt.c (do_pushlevel): Move to semantics.c. (do_poplevel): Likewise. (tsubst_copy): Handle STMT_EXPR instead of BIND_EXPR. (tsubst_expr): Don't expand all the way to RTL here. Handle RETURN_INIT and CTOR_INITIALIZER. (instantiate_decl): Call expand_body after tsubst'ing into DECL_SAVED_TREE. * semantics.c (expand_stmts): New function. (expanding_p): New variable. (last_expr_type): Likewise. (finish_expr_stmt): Use building_stmt_tree. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (fnish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_for_stmt): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (finish_switch_cond): Likewise. (finish_switch_stmt): Likewise. (finish_case_label): Call add_tree here if necessary. (finish_goto_statement): Use building_stmt_tree. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_named_return_value): New function. (setup_vtbl_ptr): Moved here from decl2.c. (do_pushlevel): Moved here from pt.c. (do_poplevel): Likewise. (begin_stmt_expr): Use building_stmt_tree. (finish_stmt_expr): Likewise. Build a STMT_EXPR, not a BIND_EXPR, when building_stmt_tree. (begin_stmt_tree): New function. (finish_stmt_tree): Likewise. (expand_stmt): Likewise. (expand_body): Likewise. * tree.c (build_cplus_method_type): Make sure the argument types end up on the same obstack as the METHOD_TYPE. (search_tree): Handle COMPOUND_EXPR, MODIFY_EXPR, THROW_EXPR, STMT_EXPR. (mapcar): Break out common cases. Handle COMPOUND_EXPR, MODIFY_EXPR, THROW_EXPR, STMT_EXPR, RTL_EXPR. Abort, rather than sorry, if an unsupported node is encountered. * typeck.c (require_complete_type_in_void): Handle BIND_EXPR. (c_expand_return): Don't call add_tree here. From-SVN: r28729
1999-08-16 21:01:36 +02:00
last_expr_type = t;
return r;
}
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
/* Finish an asm-statement, whose components are a CV_QUALIFIER, a
STRING, some OUTPUT_OPERANDS, some INPUT_OPERANDS, and some
CLOBBERS. */
tree
finish_asm_stmt (tree cv_qualifier,
tree string,
tree output_operands,
tree input_operands,
tree clobbers)
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
{
tree r;
tree t;
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
if (cv_qualifier != NULL_TREE
&& cv_qualifier != ridpointers[(int) RID_VOLATILE])
{
warning ("%s qualifier ignored on asm",
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
IDENTIFIER_POINTER (cv_qualifier));
cv_qualifier = NULL_TREE;
}
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
if (!processing_template_decl)
{
int i;
int ninputs;
int noutputs;
for (t = input_operands; t; t = TREE_CHAIN (t))
{
tree converted_operand
= decay_conversion (TREE_VALUE (t));
/* If the type of the operand hasn't been determined (e.g.,
because it involves an overloaded function), then issue
an error message. There's no context available to
resolve the overloading. */
if (TREE_TYPE (converted_operand) == unknown_type_node)
{
error ("type of asm operand `%E' could not be determined",
TREE_VALUE (t));
converted_operand = error_mark_node;
}
TREE_VALUE (t) = converted_operand;
}
ninputs = list_length (input_operands);
noutputs = list_length (output_operands);
for (i = 0, t = output_operands; t; t = TREE_CHAIN (t), ++i)
{
bool allows_mem;
bool allows_reg;
bool is_inout;
const char *constraint;
tree operand;
constraint = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (t)));
operand = TREE_VALUE (t);
if (!parse_output_constraint (&constraint,
i, ninputs, noutputs,
&allows_mem,
&allows_reg,
&is_inout))
{
Make-lang.in (po-generated): Remove parse.c. * Make-lang.in (po-generated): Remove parse.c. (CXX_OBJS): Remove parse.o and spew.o. Add parser.o. ($(srcdir)/cp/parse.h): Remove target. ($(srcdir)/cp/parse.c): Likewise. (gt-cp-parse.h): Likewise. (gt-cp-parser.h): New target. (c++.distclean): Do not remove parse.output. (c++.maintainer-clean): Do not remove parse.c or parse.h. (cp/spew.o): Remove target. (cp/lex.o): Adjust dependencies. (cp/pt.o): Likewise. (cp/parse.o): Likewise. (cp/TAGS): Do not mention parse.c. (cp/parser.o): New target. * NEWS: Mention the new parser. * call.c (build_scoped_method_call): Simplify. (build_method_call): Likewise. (build_new_function_call): Adjust calls to add_function_candidate and add_template_candidate. (build_new_op): Improve handling of erroroneous operands. (convert_default_arg): Remove circular argument processing. (name_as_c_string): New function. (build_new_method_call): Use it. (perform_implicit_conversion): Use error_operand_p. * class.c (finish_struct_anon): Use constructor_name_p. (check_field_decls): Likewise. (pop_nested_class): Use OVL_NEXT, not OVL_CHAIN. (resolve_address_of_overloaded_function): Likewise. (instantiate_type): Tweak pointer-to-member handling. (get_primary_binfo): Remove incorrect assertion. * config-lang.in (gtfiles): Add parser.c, remove parse.c. * cp-tree.h (DEFARG_TOKENS): New macro. (default_arg): New structure. (cp_tree_node_structure_enum): Add TS_CP_DEFAULT_ARG. (lang_tree_node): Add default_arg. (cp_tree_index): Add CPTI_TYPE_INFO_REF_TYPE. (type_info_ref_type): New macro. (saved_scope): Make processing_explicit_instantiation a boolean. (check_access): New field. (unparsed_text): Remove. (language_function): Remove unparsed_inlines. (error_operand_p): New macro. (lang_decl): Adjust pending_inline_info. (DEFARG_POINTER): Remove. (tag_types): Add typenames. (lookup_ualified_name): Declare. (lookup_name_real): Likewise. (shadow_tag): Adjust prototype. (get_scope_of_declarator): Declare it. (process_next_inline): Remove it. (check_for_missing_semicolon): Likewise. (maybe_get_template_decl_from_type_decl): Declare it. (finish_label_stmt): Adjust prototype. (finish_non_static_data_meber): Declare it. (finish_pseudo_destructor_call_expr): Rename to ... (finish_pseudo_destructor_expr): ... this. (finish_compound_literal): Declare it. (begin_inline_definitions): Remove it. (init_spew): Remove. (peekyylex): Likewise. (arbitrate_lookup): Likewise. (frob_opname): Likewise. (maybe_snarf_defarg): Likewise. (add_defarg_fn): Likewise. (do_pending_defargs): Likewise. (done_pending_defargs): Likewise. (unprocessed_defarg_fn): Likewise. (replace_defarg): Likewise. (end_input): Likewise. (get_overloaded_fn): Likewise. * cvt.c (convert_to_reference): Improve error handling. * decl.c (lookup_name_real): Do not declare it static. (maybe_push_to_top_level): Set check_access. (identifier_type_value): Adjust call to lookup_name_real. (lookup_qualified_name): New method. (lookup_name_real): Remove special-case parsing code. (lookup_name-nonclass): Adjust call to lookup_name_real. (lookup_name_namespace_only): Likewise. (lookup_name): Likewise. (check_tag_decl): Return the type declared. (shadow_tag): Likewise. (register_dtor_fn): Tweak check_access. (grokfndecl): Use constructor_name_p. (get_scope_of_declarator): New function. (grokdeclarator): Obscure tweaks for slightly different declarator representations. (start_method): Return error_mark_node to indicate failure. (cp_tree_node_structure_enum): Use TS_CP_DEFAULT_ARG for DEFAULT_ARGs. * decl2.c (constructor_name_full): Simplify. (constructor_name): Use it. (build_expr_from_tree): Adjust for changes to do new parser. (push_scope): Improve robustness. (validate_nonmember_using_decl): Process declarations, not names. (do_class_using_decl): Likewise. (handle_class_head): Do not mess with CLASSTYPE_DECLARED_CLASS here. * error.c (dump_expr): Handle IDENTIFIER_NODEs and BASELINKs. * expr.c (cxx_expand_expr): Handle BASELINKs. * init.c (member_init_ok_or_else): Issue more errors. (build_offset_ref): Tweak handling of FUNCTION_DECLs. * lex.c: Do not include parse.h. (yypring): Do not declare. (yylval): Likewise. (make_reference_declarator): Remove error-generating code. (rid_to_yy): Remove. (cxx_init): Do not call init_spew. (yypring): Remove. (check_for_missing_semicolon): Remove. * lex.h (got_scope): Remove. (got_object): Remove. * method.c (hack_identifier): Use finish_non_static_data_member. (implicitly_declare_fn): Adjust use of constructor_name. * parser.c: New file. * pt.c (parse.h): Do not include it. (maybe_get_template_decl_from_template): Do not declare it. (finish_member_template_decl): Tweak. (begin_explicit_instantiation): Adjust for processing_explicit_instantiation being boolean. (end_explicit_instantiation): Likewise. (maybe_process_partial_specialization): Tighten specialization test. (retrieve_local_specialization): Adjust ue of hash table. (eq_local_specializations): New function. (register_local_specialization): Likewise. (push_template_decl_real): Remove unnecessary test. (maybe_get_template_decl_from_type_decl): Don't make it static. (for_each_template_parm_r): Handle TYPEOF_TYPE. (tsubst_copy): Use retrieive_local_specialization to handle PARM_DECL. Adjust handling of CONST_DECLs. Handle BASELINKs. Handle COMPONENT_REFs with pseudo-destructor-expressions. Simplify handling of CALL_EXPR and METHOD_CALL_EXPR. (tsubst_expr): Pass decls, not names, to do_local_using_decl. (unify): Tweak handling of CONST_DECLs. (regenerate_decl_from_template): Use push_nested_class. (template_for_substitution): New funciton. (instantiate_decl): Use it. Register parameters as local specializations. * rtti.c (init_rtti_processing): Set type_info_ref_type. (build_typeid): Use it. (get_typeid): Likeise. * search.c (accessible_p): Use check_access, not flag_access_control. (adjust_result_of_qualified_name_lookup): Pay attention to the context_class. * semantics.c (finish_asm_stmt): Adjust error handling. (finish_label_stmt): Return the statement. (finish_non_static_data_member): New function. (finish_class_expr): Handle BASELINKs. (finish_call_expr): Handle PSEUDO_DTOR_EXPR. (finish_object_call_expr): Simplify handling during templates. (finish_pseudo_destructor_call_expr): Rename to ... (finish_pseudo_dtor_expr): ... this. (finish_compound_literal): New function. (begin_inline_definitions): Remove. (finish_sizeof): Remove special template handling. * spew.c: Do not include parse.h. * tree.c (get_overloaded_fn): Remove. * typeck.c (build_class_member_access_expr): Handle PSEUDO_DTOR_EXPR. Adjust handling of static member functions. (lookup_destructor): New function. (finish_class_member_access_expr): Use it. (convert_arguments): Simplify. (build_unary_op): Handle BASELINKs. From-SVN: r60560
2002-12-28 09:03:42 +01:00
/* By marking this operand as erroneous, we will not try
to process this operand again in expand_asm_operands. */
TREE_VALUE (t) = error_mark_node;
continue;
}
/* If the operand is a DECL that is going to end up in
memory, assume it is addressable. This is a bit more
conservative than it would ideally be; the exact test is
buried deep in expand_asm_operands and depends on the
DECL_RTL for the OPERAND -- which we don't have at this
point. */
if (!allows_reg && DECL_P (operand))
c-decl.c (grokdeclarator): Update. * c-decl.c (grokdeclarator): Update. * c-lang.c (LANG_HOOKS_MARK_ADDRESSABLE): Redefine. * c-tree.h (c_mark_addressable): New. * c-typeck.c (default_function_array_conversion, build_unary_op, build_array_ref, convert_for_assignment): Update. (mark_addressable): Rename. * calls.c (try_to_integrate, expand_call): Use langhook. * expr.c (expand_expr): Use langhook. * langhooks-def.h (LANG_HOOKS_INITIALIZER): Update. * langhooks.h (struct lang_hooks): New hook. * stmt.c (expand_asm_operands): Use langhook. * tree.h (mark_addressable): Remove. ada: * decl.c (gnat_to_gnu_entity): Update. * gigi.h (mark_addressable): Rename. * misc.c (LANG_HOOKS_MARK_ADDRESSABLE): Redefine. * trans.c (tree_transform): Update. * utils.c (create_var_decl): Update. * util2.c (build_binary_op, build_unary_op, fill_vms_descriptor): Update. (mark_addressable): Rename, update. cp: * call.c (build_addr_func): Update. * class.c (resolve_address_of_overloaded_function): Update. * cp-lang.c (LANG_HOOKS_MARK_ADDRESSABLE): Redefine. * cp-tree.h (cxx_mark_addressable): New. * decl.c (register_dtor_fn, cxx_maybe_build_cleanup): Update. * decl2.c (build_cleanup): Update. * except.c (build_throw): Update. * init.c (resolve_offset_ref): Update. * pt.c (convert_nontype_argument): Update. * semantics.c (finish_asm_stmt, simplify_affr_init_exprs_r): Update. * typeck.c (decay_conversion, build_array_ref, build_unary_op, unary_complex_lvalue): Update. (mark_addressable): Rename. f: * com.c (LANG_HOOKS_MARK_ADDRESSABLE): Redefine. (mark_addressable): Rename. (ffecom_arrayref_, ffecom_1): Update. java: * java-tree.h (java_mark_addressable): New. * lang.c (LANG_HOOKS_MARK_ADDRESSABLE): Redefine. * typeck.c (mark_addressable): Rename, update. objc: * objc-lang.c (LANG_HOOKS_MARK_ADDRESSABLE): Redefine. From-SVN: r51705
2002-04-01 22:26:18 +02:00
cxx_mark_addressable (operand);
}
}
c-common.h (build_stmt): Declare. 2000-07-10 Benjamin Chelf <chelf@codesourcery.com> * c-common.h (build_stmt): Declare. (build_continue_stmt): Likewise. (build_break_stmt): Likewise. (build_return_stmt): Likewise. * c-decl.c (do_case): Rewrite to do what previously done in c-parse.in. * c-semantics.c (build_stmt): Define. (build_return_stmt): Likewise. (build_break_stmt): Likewise. (build_continue_stmt): Likewise. (build_case_label): Likewise. * c-parse.in (BREAK): Change to build tree, then generate RTL. (CONTINUE): Likewise. (RETURN): Likewise. (CASE): Likewise. (DEFAULT): Likewise. * c-parse.y: Regenerate. * c-pasre.c: Likewise. * cp/semantics.c (finish_for_stmt): Remove call to emit_line_note. (finish_continue_stmt): Likewise. (begin_for_stmt): Remove call to note_level_for_for. (finish_goto_stmt): Change call from build_min_nt to build_stmt. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_stmt): Likewise. (finish_break_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_case_label): Likewise. (genrtl_try_block): Likewise. (begin_try_block): Likewise. (begin_handler): Likewise. (begin_compound_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. * cp/decl.c (finish_constructor_body): Likewise. (finish_destructor_body): Likewise. * cp/optimize.c (copy_body_r): Likewise. (initialize_inlined_parameters): Likewise. (declare_return_variable): Likewise. (expand_call_inline): Likewise. From-SVN: r34943
2000-07-10 12:56:23 +02:00
r = build_stmt (ASM_STMT, cv_qualifier, string,
output_operands, input_operands,
clobbers);
return add_stmt (r);
}
/* Finish a label with the indicated NAME. */
Make-lang.in (po-generated): Remove parse.c. * Make-lang.in (po-generated): Remove parse.c. (CXX_OBJS): Remove parse.o and spew.o. Add parser.o. ($(srcdir)/cp/parse.h): Remove target. ($(srcdir)/cp/parse.c): Likewise. (gt-cp-parse.h): Likewise. (gt-cp-parser.h): New target. (c++.distclean): Do not remove parse.output. (c++.maintainer-clean): Do not remove parse.c or parse.h. (cp/spew.o): Remove target. (cp/lex.o): Adjust dependencies. (cp/pt.o): Likewise. (cp/parse.o): Likewise. (cp/TAGS): Do not mention parse.c. (cp/parser.o): New target. * NEWS: Mention the new parser. * call.c (build_scoped_method_call): Simplify. (build_method_call): Likewise. (build_new_function_call): Adjust calls to add_function_candidate and add_template_candidate. (build_new_op): Improve handling of erroroneous operands. (convert_default_arg): Remove circular argument processing. (name_as_c_string): New function. (build_new_method_call): Use it. (perform_implicit_conversion): Use error_operand_p. * class.c (finish_struct_anon): Use constructor_name_p. (check_field_decls): Likewise. (pop_nested_class): Use OVL_NEXT, not OVL_CHAIN. (resolve_address_of_overloaded_function): Likewise. (instantiate_type): Tweak pointer-to-member handling. (get_primary_binfo): Remove incorrect assertion. * config-lang.in (gtfiles): Add parser.c, remove parse.c. * cp-tree.h (DEFARG_TOKENS): New macro. (default_arg): New structure. (cp_tree_node_structure_enum): Add TS_CP_DEFAULT_ARG. (lang_tree_node): Add default_arg. (cp_tree_index): Add CPTI_TYPE_INFO_REF_TYPE. (type_info_ref_type): New macro. (saved_scope): Make processing_explicit_instantiation a boolean. (check_access): New field. (unparsed_text): Remove. (language_function): Remove unparsed_inlines. (error_operand_p): New macro. (lang_decl): Adjust pending_inline_info. (DEFARG_POINTER): Remove. (tag_types): Add typenames. (lookup_ualified_name): Declare. (lookup_name_real): Likewise. (shadow_tag): Adjust prototype. (get_scope_of_declarator): Declare it. (process_next_inline): Remove it. (check_for_missing_semicolon): Likewise. (maybe_get_template_decl_from_type_decl): Declare it. (finish_label_stmt): Adjust prototype. (finish_non_static_data_meber): Declare it. (finish_pseudo_destructor_call_expr): Rename to ... (finish_pseudo_destructor_expr): ... this. (finish_compound_literal): Declare it. (begin_inline_definitions): Remove it. (init_spew): Remove. (peekyylex): Likewise. (arbitrate_lookup): Likewise. (frob_opname): Likewise. (maybe_snarf_defarg): Likewise. (add_defarg_fn): Likewise. (do_pending_defargs): Likewise. (done_pending_defargs): Likewise. (unprocessed_defarg_fn): Likewise. (replace_defarg): Likewise. (end_input): Likewise. (get_overloaded_fn): Likewise. * cvt.c (convert_to_reference): Improve error handling. * decl.c (lookup_name_real): Do not declare it static. (maybe_push_to_top_level): Set check_access. (identifier_type_value): Adjust call to lookup_name_real. (lookup_qualified_name): New method. (lookup_name_real): Remove special-case parsing code. (lookup_name-nonclass): Adjust call to lookup_name_real. (lookup_name_namespace_only): Likewise. (lookup_name): Likewise. (check_tag_decl): Return the type declared. (shadow_tag): Likewise. (register_dtor_fn): Tweak check_access. (grokfndecl): Use constructor_name_p. (get_scope_of_declarator): New function. (grokdeclarator): Obscure tweaks for slightly different declarator representations. (start_method): Return error_mark_node to indicate failure. (cp_tree_node_structure_enum): Use TS_CP_DEFAULT_ARG for DEFAULT_ARGs. * decl2.c (constructor_name_full): Simplify. (constructor_name): Use it. (build_expr_from_tree): Adjust for changes to do new parser. (push_scope): Improve robustness. (validate_nonmember_using_decl): Process declarations, not names. (do_class_using_decl): Likewise. (handle_class_head): Do not mess with CLASSTYPE_DECLARED_CLASS here. * error.c (dump_expr): Handle IDENTIFIER_NODEs and BASELINKs. * expr.c (cxx_expand_expr): Handle BASELINKs. * init.c (member_init_ok_or_else): Issue more errors. (build_offset_ref): Tweak handling of FUNCTION_DECLs. * lex.c: Do not include parse.h. (yypring): Do not declare. (yylval): Likewise. (make_reference_declarator): Remove error-generating code. (rid_to_yy): Remove. (cxx_init): Do not call init_spew. (yypring): Remove. (check_for_missing_semicolon): Remove. * lex.h (got_scope): Remove. (got_object): Remove. * method.c (hack_identifier): Use finish_non_static_data_member. (implicitly_declare_fn): Adjust use of constructor_name. * parser.c: New file. * pt.c (parse.h): Do not include it. (maybe_get_template_decl_from_template): Do not declare it. (finish_member_template_decl): Tweak. (begin_explicit_instantiation): Adjust for processing_explicit_instantiation being boolean. (end_explicit_instantiation): Likewise. (maybe_process_partial_specialization): Tighten specialization test. (retrieve_local_specialization): Adjust ue of hash table. (eq_local_specializations): New function. (register_local_specialization): Likewise. (push_template_decl_real): Remove unnecessary test. (maybe_get_template_decl_from_type_decl): Don't make it static. (for_each_template_parm_r): Handle TYPEOF_TYPE. (tsubst_copy): Use retrieive_local_specialization to handle PARM_DECL. Adjust handling of CONST_DECLs. Handle BASELINKs. Handle COMPONENT_REFs with pseudo-destructor-expressions. Simplify handling of CALL_EXPR and METHOD_CALL_EXPR. (tsubst_expr): Pass decls, not names, to do_local_using_decl. (unify): Tweak handling of CONST_DECLs. (regenerate_decl_from_template): Use push_nested_class. (template_for_substitution): New funciton. (instantiate_decl): Use it. Register parameters as local specializations. * rtti.c (init_rtti_processing): Set type_info_ref_type. (build_typeid): Use it. (get_typeid): Likeise. * search.c (accessible_p): Use check_access, not flag_access_control. (adjust_result_of_qualified_name_lookup): Pay attention to the context_class. * semantics.c (finish_asm_stmt): Adjust error handling. (finish_label_stmt): Return the statement. (finish_non_static_data_member): New function. (finish_class_expr): Handle BASELINKs. (finish_call_expr): Handle PSEUDO_DTOR_EXPR. (finish_object_call_expr): Simplify handling during templates. (finish_pseudo_destructor_call_expr): Rename to ... (finish_pseudo_dtor_expr): ... this. (finish_compound_literal): New function. (begin_inline_definitions): Remove. (finish_sizeof): Remove special template handling. * spew.c: Do not include parse.h. * tree.c (get_overloaded_fn): Remove. * typeck.c (build_class_member_access_expr): Handle PSEUDO_DTOR_EXPR. Adjust handling of static member functions. (lookup_destructor): New function. (finish_class_member_access_expr): Use it. (convert_arguments): Simplify. (build_unary_op): Handle BASELINKs. From-SVN: r60560
2002-12-28 09:03:42 +01:00
tree
finish_label_stmt (tree name)
{
tree decl = define_label (input_location, name);
Make-lang.in (po-generated): Remove parse.c. * Make-lang.in (po-generated): Remove parse.c. (CXX_OBJS): Remove parse.o and spew.o. Add parser.o. ($(srcdir)/cp/parse.h): Remove target. ($(srcdir)/cp/parse.c): Likewise. (gt-cp-parse.h): Likewise. (gt-cp-parser.h): New target. (c++.distclean): Do not remove parse.output. (c++.maintainer-clean): Do not remove parse.c or parse.h. (cp/spew.o): Remove target. (cp/lex.o): Adjust dependencies. (cp/pt.o): Likewise. (cp/parse.o): Likewise. (cp/TAGS): Do not mention parse.c. (cp/parser.o): New target. * NEWS: Mention the new parser. * call.c (build_scoped_method_call): Simplify. (build_method_call): Likewise. (build_new_function_call): Adjust calls to add_function_candidate and add_template_candidate. (build_new_op): Improve handling of erroroneous operands. (convert_default_arg): Remove circular argument processing. (name_as_c_string): New function. (build_new_method_call): Use it. (perform_implicit_conversion): Use error_operand_p. * class.c (finish_struct_anon): Use constructor_name_p. (check_field_decls): Likewise. (pop_nested_class): Use OVL_NEXT, not OVL_CHAIN. (resolve_address_of_overloaded_function): Likewise. (instantiate_type): Tweak pointer-to-member handling. (get_primary_binfo): Remove incorrect assertion. * config-lang.in (gtfiles): Add parser.c, remove parse.c. * cp-tree.h (DEFARG_TOKENS): New macro. (default_arg): New structure. (cp_tree_node_structure_enum): Add TS_CP_DEFAULT_ARG. (lang_tree_node): Add default_arg. (cp_tree_index): Add CPTI_TYPE_INFO_REF_TYPE. (type_info_ref_type): New macro. (saved_scope): Make processing_explicit_instantiation a boolean. (check_access): New field. (unparsed_text): Remove. (language_function): Remove unparsed_inlines. (error_operand_p): New macro. (lang_decl): Adjust pending_inline_info. (DEFARG_POINTER): Remove. (tag_types): Add typenames. (lookup_ualified_name): Declare. (lookup_name_real): Likewise. (shadow_tag): Adjust prototype. (get_scope_of_declarator): Declare it. (process_next_inline): Remove it. (check_for_missing_semicolon): Likewise. (maybe_get_template_decl_from_type_decl): Declare it. (finish_label_stmt): Adjust prototype. (finish_non_static_data_meber): Declare it. (finish_pseudo_destructor_call_expr): Rename to ... (finish_pseudo_destructor_expr): ... this. (finish_compound_literal): Declare it. (begin_inline_definitions): Remove it. (init_spew): Remove. (peekyylex): Likewise. (arbitrate_lookup): Likewise. (frob_opname): Likewise. (maybe_snarf_defarg): Likewise. (add_defarg_fn): Likewise. (do_pending_defargs): Likewise. (done_pending_defargs): Likewise. (unprocessed_defarg_fn): Likewise. (replace_defarg): Likewise. (end_input): Likewise. (get_overloaded_fn): Likewise. * cvt.c (convert_to_reference): Improve error handling. * decl.c (lookup_name_real): Do not declare it static. (maybe_push_to_top_level): Set check_access. (identifier_type_value): Adjust call to lookup_name_real. (lookup_qualified_name): New method. (lookup_name_real): Remove special-case parsing code. (lookup_name-nonclass): Adjust call to lookup_name_real. (lookup_name_namespace_only): Likewise. (lookup_name): Likewise. (check_tag_decl): Return the type declared. (shadow_tag): Likewise. (register_dtor_fn): Tweak check_access. (grokfndecl): Use constructor_name_p. (get_scope_of_declarator): New function. (grokdeclarator): Obscure tweaks for slightly different declarator representations. (start_method): Return error_mark_node to indicate failure. (cp_tree_node_structure_enum): Use TS_CP_DEFAULT_ARG for DEFAULT_ARGs. * decl2.c (constructor_name_full): Simplify. (constructor_name): Use it. (build_expr_from_tree): Adjust for changes to do new parser. (push_scope): Improve robustness. (validate_nonmember_using_decl): Process declarations, not names. (do_class_using_decl): Likewise. (handle_class_head): Do not mess with CLASSTYPE_DECLARED_CLASS here. * error.c (dump_expr): Handle IDENTIFIER_NODEs and BASELINKs. * expr.c (cxx_expand_expr): Handle BASELINKs. * init.c (member_init_ok_or_else): Issue more errors. (build_offset_ref): Tweak handling of FUNCTION_DECLs. * lex.c: Do not include parse.h. (yypring): Do not declare. (yylval): Likewise. (make_reference_declarator): Remove error-generating code. (rid_to_yy): Remove. (cxx_init): Do not call init_spew. (yypring): Remove. (check_for_missing_semicolon): Remove. * lex.h (got_scope): Remove. (got_object): Remove. * method.c (hack_identifier): Use finish_non_static_data_member. (implicitly_declare_fn): Adjust use of constructor_name. * parser.c: New file. * pt.c (parse.h): Do not include it. (maybe_get_template_decl_from_template): Do not declare it. (finish_member_template_decl): Tweak. (begin_explicit_instantiation): Adjust for processing_explicit_instantiation being boolean. (end_explicit_instantiation): Likewise. (maybe_process_partial_specialization): Tighten specialization test. (retrieve_local_specialization): Adjust ue of hash table. (eq_local_specializations): New function. (register_local_specialization): Likewise. (push_template_decl_real): Remove unnecessary test. (maybe_get_template_decl_from_type_decl): Don't make it static. (for_each_template_parm_r): Handle TYPEOF_TYPE. (tsubst_copy): Use retrieive_local_specialization to handle PARM_DECL. Adjust handling of CONST_DECLs. Handle BASELINKs. Handle COMPONENT_REFs with pseudo-destructor-expressions. Simplify handling of CALL_EXPR and METHOD_CALL_EXPR. (tsubst_expr): Pass decls, not names, to do_local_using_decl. (unify): Tweak handling of CONST_DECLs. (regenerate_decl_from_template): Use push_nested_class. (template_for_substitution): New funciton. (instantiate_decl): Use it. Register parameters as local specializations. * rtti.c (init_rtti_processing): Set type_info_ref_type. (build_typeid): Use it. (get_typeid): Likeise. * search.c (accessible_p): Use check_access, not flag_access_control. (adjust_result_of_qualified_name_lookup): Pay attention to the context_class. * semantics.c (finish_asm_stmt): Adjust error handling. (finish_label_stmt): Return the statement. (finish_non_static_data_member): New function. (finish_class_expr): Handle BASELINKs. (finish_call_expr): Handle PSEUDO_DTOR_EXPR. (finish_object_call_expr): Simplify handling during templates. (finish_pseudo_destructor_call_expr): Rename to ... (finish_pseudo_dtor_expr): ... this. (finish_compound_literal): New function. (begin_inline_definitions): Remove. (finish_sizeof): Remove special template handling. * spew.c: Do not include parse.h. * tree.c (get_overloaded_fn): Remove. * typeck.c (build_class_member_access_expr): Handle PSEUDO_DTOR_EXPR. Adjust handling of static member functions. (lookup_destructor): New function. (finish_class_member_access_expr): Use it. (convert_arguments): Simplify. (build_unary_op): Handle BASELINKs. From-SVN: r60560
2002-12-28 09:03:42 +01:00
return add_stmt (build_stmt (LABEL_STMT, decl));
}
/* Finish a series of declarations for local labels. G++ allows users
to declare "local" labels, i.e., labels with scope. This extension
is useful when writing code involving statement-expressions. */
void
finish_label_decl (tree name)
{
tree decl = declare_local_label (name);
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
add_decl_stmt (decl);
}
/* When DECL goes out of scope, make sure that CLEANUP is executed. */
cp-tree.def (SUBOBJECT): New tree node. * cp-tree.def (SUBOBJECT): New tree node. * cp-tree.h (CLEANUP_P): New macro. (SUBOBJECT_CLEANUP): Likewise. (keep_next_level): Add parameter. (get_temp_regvar): Don't declare. (emit_base_init): Remove parameter. (expand_aggr_init): Rename to build_aggr_init. (expand_vec_init): Rename to build_vec_init. (do_pushlevel): Remove. (do_poplevel): Likewise. (finish_cleanup): New function. (finish_subobject): Likewise. (stmts_are_full_exprs_p): New variable. * decl.c (keep_next_level): Add parameter. (cp_finish_decl): Use build_aggr_init, not expand_aggr_init. Use finish_expr_stmt to expand the code. (expand_static_init): Use tree-generating, not RTL-generating, functions to handle the initialization. (start_function): Remove dead code. Always have a momentary obstack inside the function, even before hitting the first curly brace. (cplus_expand_expr_stmt): Move calls to expand_{start,end}_target_temps into semantics.c. (cp_function): Add stmts_are_full_exprs_p. (push_cp_function_context): Save it. (pop_cp_function_context): Restore it. * decl2.c (get_temp_regvar): Move to init.c. (do_static_initialization): Use build_{aggr,vec}_init. (do_static_destruction): Fix typo in comment. * dump.c (dequeue_and_dump): Handle INIT_EXPR. * except.c (expand_throw): Use create_temporary_var. * expr.c (cplus_expand_expr): Use build_{aggr,vec}_init. * init.c (expand_vec_init_try_block): Remove. (expand_vec_init_catch_clause): Likewise. (get_temp_regvar): New function. (begin_init_stmts): Likewise. (finish_init_stmts): Likewise. (perform_member_init): Use build_{aggr,vec}_init. Build up tree structure here. (emit_base_init): Likewise. Remove unused parameter. (expand_virtual_init): Likewise. (expand_cleanup_for_base): Use finish_subobject. (expand_aggr_vbase_init_1): Simplify. (construct_virtual_bases): Use tree-generating functions to build up initialization. (expand_aggr_init): Likewise. Rename to build_aggr_init. (expand_default_init): Likewise. (expand_aggr_init_1): Likewise. (expand_vec_init): Rename to build_vec_init. * method.c (do_build_copy_constructor): Use tree-generating functions. Don't call clear_last_expr. (do_build_assign_ref): Likewise. (synthesize_method): Call clear_last_expr here. * parse.y (base_init): Don't call clear_last_expr here. (nodecls): Likewise. * pt.c (tsubst_expr): Handle a TRY_BLOCK with CLEANUP_P set. * semantics.c (do_pushlevel): Move to here. (do_poplevel): Likewise. (stmts_are_full_exprs_p): New variable. (finish_expr_stmt): Handle logic for temoprary cleanup here. (finish_for_stmt): Use finish_expr_stmt. (finish_cleanup): New function. (finish_function_try_block): Fix indentation. (finish_subobject): New function. (setup_vtbl_ptr): Call keep_next_level here. (finish_stmt_expr): Handle a block with no scope inside the statement-expression. (expand_stmt): Handle a TRY_BLOCK with CLEANUP_P set. Handle SUBOBJECT. * tree.c (search_tree): Handle INIT_EXPR. (mapcar): Likewise. * typeck.c (build_modify_expr): Don't build an RTL_EXPR. * typeck2.c (store_init_value): Change expand_aggr_init to build_aggr_init in comment. From-SVN: r28878
1999-08-26 00:07:18 +02:00
void
finish_decl_cleanup (tree decl, tree cleanup)
cp-tree.def (SUBOBJECT): New tree node. * cp-tree.def (SUBOBJECT): New tree node. * cp-tree.h (CLEANUP_P): New macro. (SUBOBJECT_CLEANUP): Likewise. (keep_next_level): Add parameter. (get_temp_regvar): Don't declare. (emit_base_init): Remove parameter. (expand_aggr_init): Rename to build_aggr_init. (expand_vec_init): Rename to build_vec_init. (do_pushlevel): Remove. (do_poplevel): Likewise. (finish_cleanup): New function. (finish_subobject): Likewise. (stmts_are_full_exprs_p): New variable. * decl.c (keep_next_level): Add parameter. (cp_finish_decl): Use build_aggr_init, not expand_aggr_init. Use finish_expr_stmt to expand the code. (expand_static_init): Use tree-generating, not RTL-generating, functions to handle the initialization. (start_function): Remove dead code. Always have a momentary obstack inside the function, even before hitting the first curly brace. (cplus_expand_expr_stmt): Move calls to expand_{start,end}_target_temps into semantics.c. (cp_function): Add stmts_are_full_exprs_p. (push_cp_function_context): Save it. (pop_cp_function_context): Restore it. * decl2.c (get_temp_regvar): Move to init.c. (do_static_initialization): Use build_{aggr,vec}_init. (do_static_destruction): Fix typo in comment. * dump.c (dequeue_and_dump): Handle INIT_EXPR. * except.c (expand_throw): Use create_temporary_var. * expr.c (cplus_expand_expr): Use build_{aggr,vec}_init. * init.c (expand_vec_init_try_block): Remove. (expand_vec_init_catch_clause): Likewise. (get_temp_regvar): New function. (begin_init_stmts): Likewise. (finish_init_stmts): Likewise. (perform_member_init): Use build_{aggr,vec}_init. Build up tree structure here. (emit_base_init): Likewise. Remove unused parameter. (expand_virtual_init): Likewise. (expand_cleanup_for_base): Use finish_subobject. (expand_aggr_vbase_init_1): Simplify. (construct_virtual_bases): Use tree-generating functions to build up initialization. (expand_aggr_init): Likewise. Rename to build_aggr_init. (expand_default_init): Likewise. (expand_aggr_init_1): Likewise. (expand_vec_init): Rename to build_vec_init. * method.c (do_build_copy_constructor): Use tree-generating functions. Don't call clear_last_expr. (do_build_assign_ref): Likewise. (synthesize_method): Call clear_last_expr here. * parse.y (base_init): Don't call clear_last_expr here. (nodecls): Likewise. * pt.c (tsubst_expr): Handle a TRY_BLOCK with CLEANUP_P set. * semantics.c (do_pushlevel): Move to here. (do_poplevel): Likewise. (stmts_are_full_exprs_p): New variable. (finish_expr_stmt): Handle logic for temoprary cleanup here. (finish_for_stmt): Use finish_expr_stmt. (finish_cleanup): New function. (finish_function_try_block): Fix indentation. (finish_subobject): New function. (setup_vtbl_ptr): Call keep_next_level here. (finish_stmt_expr): Handle a block with no scope inside the statement-expression. (expand_stmt): Handle a TRY_BLOCK with CLEANUP_P set. Handle SUBOBJECT. * tree.c (search_tree): Handle INIT_EXPR. (mapcar): Likewise. * typeck.c (build_modify_expr): Don't build an RTL_EXPR. * typeck2.c (store_init_value): Change expand_aggr_init to build_aggr_init in comment. From-SVN: r28878
1999-08-26 00:07:18 +02:00
{
add_stmt (build_stmt (CLEANUP_STMT, decl, cleanup));
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
}
/* If the current scope exits with an exception, run CLEANUP. */
void
finish_eh_cleanup (tree cleanup)
{
tree r = build_stmt (CLEANUP_STMT, NULL_TREE, cleanup);
CLEANUP_EH_ONLY (r) = 1;
add_stmt (r);
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
}
/* The MEM_INITS is a list of mem-initializers, in reverse of the
order they were written by the user. Each node is as for
emit_mem_initializers. */
void
finish_mem_initializers (tree mem_inits)
{
/* Reorder the MEM_INITS so that they are in the order they appeared
in the source program. */
mem_inits = nreverse (mem_inits);
if (processing_template_decl)
add_stmt (build_min_nt (CTOR_INITIALIZER, mem_inits));
else
emit_mem_initializers (mem_inits);
cp-tree.def (STMT_EXPR): New tree node. * cp-tree.def (STMT_EXPR): New tree node. * cp-tree.h (STMT_EXPR_STMT): New macro. (store_return_init): Change prototype. (finish_named_return_value): New function. (expand_stmt): Likewise. (expand_body): Likewise. (begin_stmt_tree): Likewise. (finish_stmt_tree): Likewise. (expanding_p): New variable. (last_expr_type): Likewise. (building_stmt_tree): New macro. * decl.c (start_function): Use building_stmt_tree, not processing_template_decl, where appropriate. (store_parm_decls): Likewise. (store_return_init): Move most of the body to semantics.c. (finish_function): Use building_stmt_tree. (finish_stmt): Clear last_expr_type here. (cp_function): Add expanding_p, last_tree, last_expr_type. (push_cp_function_context): Save them. (pop_cp_function_context): Restore them. * decl2.c (setup_vtbl_ptr): Move to semantics.c. * error.c (dump_expr): Handle STMT_EXPR. * except.c (expand_start_catch_block): Use building_stmt_tree. Use add_decl_stmt. * expr.c (cplus_expand_expr): Handle STMT_EXPR. (do_case): Move add_tree call to semantics.c. * parse.y (return_init): Use finish_named_return_value. (for.init.statement): Use finish_expr_stmt. * parse.c: Regenerated. * pt.c (do_pushlevel): Move to semantics.c. (do_poplevel): Likewise. (tsubst_copy): Handle STMT_EXPR instead of BIND_EXPR. (tsubst_expr): Don't expand all the way to RTL here. Handle RETURN_INIT and CTOR_INITIALIZER. (instantiate_decl): Call expand_body after tsubst'ing into DECL_SAVED_TREE. * semantics.c (expand_stmts): New function. (expanding_p): New variable. (last_expr_type): Likewise. (finish_expr_stmt): Use building_stmt_tree. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (fnish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_for_stmt): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (finish_switch_cond): Likewise. (finish_switch_stmt): Likewise. (finish_case_label): Call add_tree here if necessary. (finish_goto_statement): Use building_stmt_tree. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_named_return_value): New function. (setup_vtbl_ptr): Moved here from decl2.c. (do_pushlevel): Moved here from pt.c. (do_poplevel): Likewise. (begin_stmt_expr): Use building_stmt_tree. (finish_stmt_expr): Likewise. Build a STMT_EXPR, not a BIND_EXPR, when building_stmt_tree. (begin_stmt_tree): New function. (finish_stmt_tree): Likewise. (expand_stmt): Likewise. (expand_body): Likewise. * tree.c (build_cplus_method_type): Make sure the argument types end up on the same obstack as the METHOD_TYPE. (search_tree): Handle COMPOUND_EXPR, MODIFY_EXPR, THROW_EXPR, STMT_EXPR. (mapcar): Break out common cases. Handle COMPOUND_EXPR, MODIFY_EXPR, THROW_EXPR, STMT_EXPR, RTL_EXPR. Abort, rather than sorry, if an unsupported node is encountered. * typeck.c (require_complete_type_in_void): Handle BIND_EXPR. (c_expand_return): Don't call add_tree here. From-SVN: r28729
1999-08-16 21:01:36 +02:00
}
splay-tree.c (splay_tree_predecessor): Fix typo in comment. * splay-tree.c (splay_tree_predecessor): Fix typo in comment. Convert the C front-end to use function-at-a-time mode. * c-common.h: Include splay-tree.h. (C_DECLARED_LABEL_FLAG): New macro. (struct language_function): Add x_scope_stmt_stack and x_function_name_declared_p. (RECHAIN_STMTS): Move definition. (lang_statment_code_p): Likewise. (lang_expand_stmt): Likewise. (lang_expand_decl_stmt): New variable. (lang_expand_function_end): Likewise. (current_scope_stmt_stack): New function. (add_decl_stmt): Likewise. (add_scope_stmt): Likewise. (mark_stmt_tree): Likewise. (struct c_lang_decl): New structure. (DECL_SAVED_TREE): Define. (c_mark_lang_decl): New function. (c_expand_start_cond): Change prototype. (c_finish_then): New function. (c_finish_else): Likewise. (current_function_name_declared): Remove. (set_current_function_name_declared): Likewise. (mark_c_language_function): Declare. (case_compare): Likewise. (c_add_case_label): Likewise. (c_expand_expr): Likewise. (c_safe_from_p): Likewise. * c-common.c (lang_expand_function_end): New variable. (struct if_elt): Add if_stmt. (c_expand_start_cond): Add the if-statement to the statement-tree, rather than generating RTL. (c_finish_then): New function. (c_expand_start_else): Don't generate RTL. (c_finish_else): New function. (c_expand_expr_stmt): Don't generate RTL. (statement_code_p): Add SCOPE_STMT. (case_compare): New function. (c_add_case_label): Likewise. (mark_stmt_tree): Likewise. (c_mark_lang_decl): Likewise. (mark_c_language_function): Likewise. (c_expand_expr): Likewise. (c_safe_from_p): Likewise. * c-decl.c (c_stmt_tree): New variable (c_scope_stmt_stack): Likewise. (c_function_name_declared_p): Likewise. (lang_expand_expr_stmt): Remove. (poplevel): Don't call output_inline_function for nested functions. (pushdecl): Don't set DECL_CONTEXT for a local declaration of an `extern' function. (redeclaration_error_message): Change means of computing whether or not a function is nested. (lookup_label): Don't call label_rtx. (init_decl_processing): Add more GC roots. (start_decl): Add DECL_STMTs to the statement-tree, rather than calling rest_of_decl_compilation. (finish_decl): Don't call expand_decl. (store_parm_decls): Begin the statement-tree, but don't generate RTL. (finish_function): Tie off the statement-tree. Call c_expand_body if appropriate. (c_expand_body): New function. (push_c_function_context): Save more information. (pop_c_function_contxt): Likewise. (copy_lang_decl): Now that we use DECL_LANG_SPECIFIC, copy it. (lang_mark_tree): Mark it. (current_stmt_tree): Adjust. (current_scope_stmt_stack): New function. (do_case): Remove. (set_current_name_declared): Likewise. (c_begin_compound_stmt): Define. (c_expand_decl_stmt): Likewise. * c-lang.c: Include rtl.h and expr.h. (lang_init): Set more language-specific hooks. * c-lex.c: Include expr.h. * c-parse.in: Changes throughout to add statements to the statement-tree, rather than generating RTL after every statement. * c-semantics.c (lang_expand_decl_stmt): Define. (add_decl_stmt): New function. (add_scope_stmt): Likewise. (finish_stmt_tree): Tweak. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Handle local labels, and call lang_expand_decl_stmt if required. (genrtl_for_stmt): Fix line-number handling. (genrtl_case_label): Handle cleanups. (genrtl_asm_stmt): Don't call combine_strings. (genrtl_compound_stmt): Simplify. (expand_stmt): Handle SCOPE_STMTs. * c-tree.h (struct lang_decl): New structure. (C_DECLARED_LABEL_FLAG): Remove. (c_begin_compound_stmt): Declare. (c_expand_decl_stmt): Likewise. (c_expand_start_case): Rename to c_start_case. (c_finish_case): New function. * c-typeck.c (start_init): Tweak setting of constructor_incremental. (c_expand_asm_operands): Tweak error-handling. Add to the statement-tree. (c_expand_return): Add to the statement-tree. (c_expand_start_case): Rename to ... (c_start_case): ... this. (struct c_switch): New type. (switch_stack): New variable. (do_case): Simplify. (c_finish_case): New function. * dependence.c: Include expr.h. (enum dependence_type): Change spelling of enumerals. (check_node_dependence): Adjust. * expr.h (lang_safe_from_p): Declare. (safe_from_p): Likewise. * expr.c (lang_safe_from_p): New variable. (safe_from_p): Give it external linkage. Use lang_safe_from_p. * stmt.c (expand_expr_stmt): Avoid clobberring of last_expr_type. * toplev.c (rest_of_decl_compilation): Robustify. * tree.c (contains_placeholder_p): Likewise. * Makefile.in: Update dependencies. * objc/objc-act.h: Adjust calculation of value for dummy_tree_code. * objc/objc-act.c: Include rtl.h, expr.h, and c-common.h. (objc_expand_function_end): New function. (finish_method_def): Use it. (init_objc): Initialize more language-specific hooks. * objc/Make-lang.in: Update dependencies. * cp-tree.h (struct cp_language_function): Remove x_scope_stmt_stack and name_declared. (current_scope_stmt_stack): Remove. (function_name_declared_p): New macro. (struct lang_decl_flags): Use c_lang_decl as a base class. (context): Remove. (struct lang_decl): Replace saved_tree with context. (DECL_FRIEND_CONTEXT): Adjust accordingly. (SET_DECL_FRIEND_CONTEXT): Likewise. (DECL_VIRTUAL_CONTEXT): Likewise. (DECL_SAVED_TREE): Remove. (C_DECLARED_LABEL_FLAG): Likewise. (cplus_expand_expr_stmt): Don't declare. (add_decl_stmt): Likewise. (add_scope_stmt): Likewise. * decl.c (mark_stmt_tree): Remove. (case_compare): Likewise. (finish_case_label): Use c_add_case_label. (init_decl_processing): Set more language-specific hooks. (build_enumerator): Fix typo in comment. (cplus_expand_expr_stmt): Remove. (mark_lang_function): Use mark_c_language_function. (lang_mark_tree): Use c_mark_lang_decl. * decl2.c: Change order of inclusion. * except.c: Likewise. * expr.c (cplus_expand_expr): Remove handling of STMT_EXPR. Fall back on c_expand_expr. * friend.c: Include expr.h. * init.c: Change order of inclusion. * Makefile.in: Update dependencies. * lex.h (free_lang_decl_chain): Remove. * optimize.c (maybe_clone_body): Use function_name_declared_p. * pt.c (build_template_decl): Don't copy DECL_VIRTUAL_CONTEXT if it doesn't exist. (instantiate_decl): Use function_name_declared_p. * semantics.c (lang_expand_expr_stmt): Remove. (set_current_function_name_declared): Likewise. (current_function_name_declared): Likewise. (begin_compound_stmt): Use function_name_declared_p. (add_decl_stmt): Remove. (setup_vtbl_ptr): Use function_name_declared_p. (add_scope_stmt): Remove. (current_scope_stmt_stack): New function. (cp_expand_stmt): Don't handle SCOPE_STMTs. (expand_body): Use function_name_declared_p. * tree.c (cp_statement_code_p): Don't include SCOPE_STMT. * typeck.c: Change order of includes. (convert_sequence): Remove. From-SVN: r36464
2000-09-17 09:38:23 +02:00
/* Returns the stack of SCOPE_STMTs for the current function. */
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
splay-tree.c (splay_tree_predecessor): Fix typo in comment. * splay-tree.c (splay_tree_predecessor): Fix typo in comment. Convert the C front-end to use function-at-a-time mode. * c-common.h: Include splay-tree.h. (C_DECLARED_LABEL_FLAG): New macro. (struct language_function): Add x_scope_stmt_stack and x_function_name_declared_p. (RECHAIN_STMTS): Move definition. (lang_statment_code_p): Likewise. (lang_expand_stmt): Likewise. (lang_expand_decl_stmt): New variable. (lang_expand_function_end): Likewise. (current_scope_stmt_stack): New function. (add_decl_stmt): Likewise. (add_scope_stmt): Likewise. (mark_stmt_tree): Likewise. (struct c_lang_decl): New structure. (DECL_SAVED_TREE): Define. (c_mark_lang_decl): New function. (c_expand_start_cond): Change prototype. (c_finish_then): New function. (c_finish_else): Likewise. (current_function_name_declared): Remove. (set_current_function_name_declared): Likewise. (mark_c_language_function): Declare. (case_compare): Likewise. (c_add_case_label): Likewise. (c_expand_expr): Likewise. (c_safe_from_p): Likewise. * c-common.c (lang_expand_function_end): New variable. (struct if_elt): Add if_stmt. (c_expand_start_cond): Add the if-statement to the statement-tree, rather than generating RTL. (c_finish_then): New function. (c_expand_start_else): Don't generate RTL. (c_finish_else): New function. (c_expand_expr_stmt): Don't generate RTL. (statement_code_p): Add SCOPE_STMT. (case_compare): New function. (c_add_case_label): Likewise. (mark_stmt_tree): Likewise. (c_mark_lang_decl): Likewise. (mark_c_language_function): Likewise. (c_expand_expr): Likewise. (c_safe_from_p): Likewise. * c-decl.c (c_stmt_tree): New variable (c_scope_stmt_stack): Likewise. (c_function_name_declared_p): Likewise. (lang_expand_expr_stmt): Remove. (poplevel): Don't call output_inline_function for nested functions. (pushdecl): Don't set DECL_CONTEXT for a local declaration of an `extern' function. (redeclaration_error_message): Change means of computing whether or not a function is nested. (lookup_label): Don't call label_rtx. (init_decl_processing): Add more GC roots. (start_decl): Add DECL_STMTs to the statement-tree, rather than calling rest_of_decl_compilation. (finish_decl): Don't call expand_decl. (store_parm_decls): Begin the statement-tree, but don't generate RTL. (finish_function): Tie off the statement-tree. Call c_expand_body if appropriate. (c_expand_body): New function. (push_c_function_context): Save more information. (pop_c_function_contxt): Likewise. (copy_lang_decl): Now that we use DECL_LANG_SPECIFIC, copy it. (lang_mark_tree): Mark it. (current_stmt_tree): Adjust. (current_scope_stmt_stack): New function. (do_case): Remove. (set_current_name_declared): Likewise. (c_begin_compound_stmt): Define. (c_expand_decl_stmt): Likewise. * c-lang.c: Include rtl.h and expr.h. (lang_init): Set more language-specific hooks. * c-lex.c: Include expr.h. * c-parse.in: Changes throughout to add statements to the statement-tree, rather than generating RTL after every statement. * c-semantics.c (lang_expand_decl_stmt): Define. (add_decl_stmt): New function. (add_scope_stmt): Likewise. (finish_stmt_tree): Tweak. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Handle local labels, and call lang_expand_decl_stmt if required. (genrtl_for_stmt): Fix line-number handling. (genrtl_case_label): Handle cleanups. (genrtl_asm_stmt): Don't call combine_strings. (genrtl_compound_stmt): Simplify. (expand_stmt): Handle SCOPE_STMTs. * c-tree.h (struct lang_decl): New structure. (C_DECLARED_LABEL_FLAG): Remove. (c_begin_compound_stmt): Declare. (c_expand_decl_stmt): Likewise. (c_expand_start_case): Rename to c_start_case. (c_finish_case): New function. * c-typeck.c (start_init): Tweak setting of constructor_incremental. (c_expand_asm_operands): Tweak error-handling. Add to the statement-tree. (c_expand_return): Add to the statement-tree. (c_expand_start_case): Rename to ... (c_start_case): ... this. (struct c_switch): New type. (switch_stack): New variable. (do_case): Simplify. (c_finish_case): New function. * dependence.c: Include expr.h. (enum dependence_type): Change spelling of enumerals. (check_node_dependence): Adjust. * expr.h (lang_safe_from_p): Declare. (safe_from_p): Likewise. * expr.c (lang_safe_from_p): New variable. (safe_from_p): Give it external linkage. Use lang_safe_from_p. * stmt.c (expand_expr_stmt): Avoid clobberring of last_expr_type. * toplev.c (rest_of_decl_compilation): Robustify. * tree.c (contains_placeholder_p): Likewise. * Makefile.in: Update dependencies. * objc/objc-act.h: Adjust calculation of value for dummy_tree_code. * objc/objc-act.c: Include rtl.h, expr.h, and c-common.h. (objc_expand_function_end): New function. (finish_method_def): Use it. (init_objc): Initialize more language-specific hooks. * objc/Make-lang.in: Update dependencies. * cp-tree.h (struct cp_language_function): Remove x_scope_stmt_stack and name_declared. (current_scope_stmt_stack): Remove. (function_name_declared_p): New macro. (struct lang_decl_flags): Use c_lang_decl as a base class. (context): Remove. (struct lang_decl): Replace saved_tree with context. (DECL_FRIEND_CONTEXT): Adjust accordingly. (SET_DECL_FRIEND_CONTEXT): Likewise. (DECL_VIRTUAL_CONTEXT): Likewise. (DECL_SAVED_TREE): Remove. (C_DECLARED_LABEL_FLAG): Likewise. (cplus_expand_expr_stmt): Don't declare. (add_decl_stmt): Likewise. (add_scope_stmt): Likewise. * decl.c (mark_stmt_tree): Remove. (case_compare): Likewise. (finish_case_label): Use c_add_case_label. (init_decl_processing): Set more language-specific hooks. (build_enumerator): Fix typo in comment. (cplus_expand_expr_stmt): Remove. (mark_lang_function): Use mark_c_language_function. (lang_mark_tree): Use c_mark_lang_decl. * decl2.c: Change order of inclusion. * except.c: Likewise. * expr.c (cplus_expand_expr): Remove handling of STMT_EXPR. Fall back on c_expand_expr. * friend.c: Include expr.h. * init.c: Change order of inclusion. * Makefile.in: Update dependencies. * lex.h (free_lang_decl_chain): Remove. * optimize.c (maybe_clone_body): Use function_name_declared_p. * pt.c (build_template_decl): Don't copy DECL_VIRTUAL_CONTEXT if it doesn't exist. (instantiate_decl): Use function_name_declared_p. * semantics.c (lang_expand_expr_stmt): Remove. (set_current_function_name_declared): Likewise. (current_function_name_declared): Likewise. (begin_compound_stmt): Use function_name_declared_p. (add_decl_stmt): Remove. (setup_vtbl_ptr): Use function_name_declared_p. (add_scope_stmt): Remove. (current_scope_stmt_stack): New function. (cp_expand_stmt): Don't handle SCOPE_STMTs. (expand_body): Use function_name_declared_p. * tree.c (cp_statement_code_p): Don't include SCOPE_STMT. * typeck.c: Change order of includes. (convert_sequence): Remove. From-SVN: r36464
2000-09-17 09:38:23 +02:00
tree *
current_scope_stmt_stack (void)
{
return &cfun->language->base.x_scope_stmt_stack;
}
/* Finish a parenthesized expression EXPR. */
tree
finish_parenthesized_expr (tree expr)
{
if (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (TREE_CODE (expr))))
c-common.c (truthvalue_conversion): Rename, update. * c-common.c (truthvalue_conversion): Rename, update. * c-common.h (c_common_truthvalue_conversion): New. * c-convert.c (convert): Update. * c-lang.c (LANG_HOOKS_TRUTHVALUE_CONVERSION): Redefine. * c-parse.in (expr_no_commas, if_prefix, select_or_iter_stmt): Update. * c-typeck.c (build_binary_op, build_unary_op, build_conditional_expr): Update. * fold-const.c (constant_boolean_node, fold): Use langhook. * langhooks-def.h (LANGHOOK_INITIALIZER): Update. * langhooks.h (struct lang_hooks): New hook. * stmt.c (expand_decl_cleanup): Use langhook. * tree.h (truthvalue_conversion): Remove. ada: * gigi.h (truthvalue_conversion): Rename. * misc.c (LANG_HOOKS_TRUTHVALUE_CONVERSION): Redefine. * trans.c (tree_transform): Update. * utils2.c (truthvalue_conversion): Rename, update. (build_binary_op, build_unary_op): Update. cp: * cp-lang.c (LANG_HOOKS_TRUTHVALUE_CONVERSION): Redefine. * cvt.c: Update comment. * init.c (expand_cleanup_for_base): Update. * semantics.c (finish_parenthesized_expr): Update. * typeck.c (cp_truthvalue_conversion): Update. f: * com.c (LANG_HOOKS_TRUTHVALUE_CONVERSION): Redefine. (truthvalue_conversion): Rename. Update. Make static. (ffecom_truth_value): Update. java: * expr.c (truthvalue_conversion): Rename. Update. (expand_compare): Update. * java-tree.h (java_truthvalue_conversion): New. * lang.c (LANG_HOOKS_TRUTHVALUE_CONVERSION): Redefine. objc: * objc-lang.c (LANG_HOOKS_TRUTHVALUE_CONVERSION): Redefine. From-SVN: r51880
2002-04-05 00:19:58 +02:00
/* This inhibits warnings in c_common_truthvalue_conversion. */
C_SET_EXP_ORIGINAL_CODE (expr, ERROR_MARK);
if (TREE_CODE (expr) == OFFSET_REF)
/* [expr.unary.op]/3 The qualified id of a pointer-to-member must not be
enclosed in parentheses. */
PTRMEM_OK_P (expr) = 0;
return expr;
}
Make-lang.in (po-generated): Remove parse.c. * Make-lang.in (po-generated): Remove parse.c. (CXX_OBJS): Remove parse.o and spew.o. Add parser.o. ($(srcdir)/cp/parse.h): Remove target. ($(srcdir)/cp/parse.c): Likewise. (gt-cp-parse.h): Likewise. (gt-cp-parser.h): New target. (c++.distclean): Do not remove parse.output. (c++.maintainer-clean): Do not remove parse.c or parse.h. (cp/spew.o): Remove target. (cp/lex.o): Adjust dependencies. (cp/pt.o): Likewise. (cp/parse.o): Likewise. (cp/TAGS): Do not mention parse.c. (cp/parser.o): New target. * NEWS: Mention the new parser. * call.c (build_scoped_method_call): Simplify. (build_method_call): Likewise. (build_new_function_call): Adjust calls to add_function_candidate and add_template_candidate. (build_new_op): Improve handling of erroroneous operands. (convert_default_arg): Remove circular argument processing. (name_as_c_string): New function. (build_new_method_call): Use it. (perform_implicit_conversion): Use error_operand_p. * class.c (finish_struct_anon): Use constructor_name_p. (check_field_decls): Likewise. (pop_nested_class): Use OVL_NEXT, not OVL_CHAIN. (resolve_address_of_overloaded_function): Likewise. (instantiate_type): Tweak pointer-to-member handling. (get_primary_binfo): Remove incorrect assertion. * config-lang.in (gtfiles): Add parser.c, remove parse.c. * cp-tree.h (DEFARG_TOKENS): New macro. (default_arg): New structure. (cp_tree_node_structure_enum): Add TS_CP_DEFAULT_ARG. (lang_tree_node): Add default_arg. (cp_tree_index): Add CPTI_TYPE_INFO_REF_TYPE. (type_info_ref_type): New macro. (saved_scope): Make processing_explicit_instantiation a boolean. (check_access): New field. (unparsed_text): Remove. (language_function): Remove unparsed_inlines. (error_operand_p): New macro. (lang_decl): Adjust pending_inline_info. (DEFARG_POINTER): Remove. (tag_types): Add typenames. (lookup_ualified_name): Declare. (lookup_name_real): Likewise. (shadow_tag): Adjust prototype. (get_scope_of_declarator): Declare it. (process_next_inline): Remove it. (check_for_missing_semicolon): Likewise. (maybe_get_template_decl_from_type_decl): Declare it. (finish_label_stmt): Adjust prototype. (finish_non_static_data_meber): Declare it. (finish_pseudo_destructor_call_expr): Rename to ... (finish_pseudo_destructor_expr): ... this. (finish_compound_literal): Declare it. (begin_inline_definitions): Remove it. (init_spew): Remove. (peekyylex): Likewise. (arbitrate_lookup): Likewise. (frob_opname): Likewise. (maybe_snarf_defarg): Likewise. (add_defarg_fn): Likewise. (do_pending_defargs): Likewise. (done_pending_defargs): Likewise. (unprocessed_defarg_fn): Likewise. (replace_defarg): Likewise. (end_input): Likewise. (get_overloaded_fn): Likewise. * cvt.c (convert_to_reference): Improve error handling. * decl.c (lookup_name_real): Do not declare it static. (maybe_push_to_top_level): Set check_access. (identifier_type_value): Adjust call to lookup_name_real. (lookup_qualified_name): New method. (lookup_name_real): Remove special-case parsing code. (lookup_name-nonclass): Adjust call to lookup_name_real. (lookup_name_namespace_only): Likewise. (lookup_name): Likewise. (check_tag_decl): Return the type declared. (shadow_tag): Likewise. (register_dtor_fn): Tweak check_access. (grokfndecl): Use constructor_name_p. (get_scope_of_declarator): New function. (grokdeclarator): Obscure tweaks for slightly different declarator representations. (start_method): Return error_mark_node to indicate failure. (cp_tree_node_structure_enum): Use TS_CP_DEFAULT_ARG for DEFAULT_ARGs. * decl2.c (constructor_name_full): Simplify. (constructor_name): Use it. (build_expr_from_tree): Adjust for changes to do new parser. (push_scope): Improve robustness. (validate_nonmember_using_decl): Process declarations, not names. (do_class_using_decl): Likewise. (handle_class_head): Do not mess with CLASSTYPE_DECLARED_CLASS here. * error.c (dump_expr): Handle IDENTIFIER_NODEs and BASELINKs. * expr.c (cxx_expand_expr): Handle BASELINKs. * init.c (member_init_ok_or_else): Issue more errors. (build_offset_ref): Tweak handling of FUNCTION_DECLs. * lex.c: Do not include parse.h. (yypring): Do not declare. (yylval): Likewise. (make_reference_declarator): Remove error-generating code. (rid_to_yy): Remove. (cxx_init): Do not call init_spew. (yypring): Remove. (check_for_missing_semicolon): Remove. * lex.h (got_scope): Remove. (got_object): Remove. * method.c (hack_identifier): Use finish_non_static_data_member. (implicitly_declare_fn): Adjust use of constructor_name. * parser.c: New file. * pt.c (parse.h): Do not include it. (maybe_get_template_decl_from_template): Do not declare it. (finish_member_template_decl): Tweak. (begin_explicit_instantiation): Adjust for processing_explicit_instantiation being boolean. (end_explicit_instantiation): Likewise. (maybe_process_partial_specialization): Tighten specialization test. (retrieve_local_specialization): Adjust ue of hash table. (eq_local_specializations): New function. (register_local_specialization): Likewise. (push_template_decl_real): Remove unnecessary test. (maybe_get_template_decl_from_type_decl): Don't make it static. (for_each_template_parm_r): Handle TYPEOF_TYPE. (tsubst_copy): Use retrieive_local_specialization to handle PARM_DECL. Adjust handling of CONST_DECLs. Handle BASELINKs. Handle COMPONENT_REFs with pseudo-destructor-expressions. Simplify handling of CALL_EXPR and METHOD_CALL_EXPR. (tsubst_expr): Pass decls, not names, to do_local_using_decl. (unify): Tweak handling of CONST_DECLs. (regenerate_decl_from_template): Use push_nested_class. (template_for_substitution): New funciton. (instantiate_decl): Use it. Register parameters as local specializations. * rtti.c (init_rtti_processing): Set type_info_ref_type. (build_typeid): Use it. (get_typeid): Likeise. * search.c (accessible_p): Use check_access, not flag_access_control. (adjust_result_of_qualified_name_lookup): Pay attention to the context_class. * semantics.c (finish_asm_stmt): Adjust error handling. (finish_label_stmt): Return the statement. (finish_non_static_data_member): New function. (finish_class_expr): Handle BASELINKs. (finish_call_expr): Handle PSEUDO_DTOR_EXPR. (finish_object_call_expr): Simplify handling during templates. (finish_pseudo_destructor_call_expr): Rename to ... (finish_pseudo_dtor_expr): ... this. (finish_compound_literal): New function. (begin_inline_definitions): Remove. (finish_sizeof): Remove special template handling. * spew.c: Do not include parse.h. * tree.c (get_overloaded_fn): Remove. * typeck.c (build_class_member_access_expr): Handle PSEUDO_DTOR_EXPR. Adjust handling of static member functions. (lookup_destructor): New function. (finish_class_member_access_expr): Use it. (convert_arguments): Simplify. (build_unary_op): Handle BASELINKs. From-SVN: r60560
2002-12-28 09:03:42 +01:00
/* Finish a reference to a non-static data member (DECL) that is not
preceded by `.' or `->'. */
tree
finish_non_static_data_member (tree decl, tree object, tree qualifying_scope)
Make-lang.in (po-generated): Remove parse.c. * Make-lang.in (po-generated): Remove parse.c. (CXX_OBJS): Remove parse.o and spew.o. Add parser.o. ($(srcdir)/cp/parse.h): Remove target. ($(srcdir)/cp/parse.c): Likewise. (gt-cp-parse.h): Likewise. (gt-cp-parser.h): New target. (c++.distclean): Do not remove parse.output. (c++.maintainer-clean): Do not remove parse.c or parse.h. (cp/spew.o): Remove target. (cp/lex.o): Adjust dependencies. (cp/pt.o): Likewise. (cp/parse.o): Likewise. (cp/TAGS): Do not mention parse.c. (cp/parser.o): New target. * NEWS: Mention the new parser. * call.c (build_scoped_method_call): Simplify. (build_method_call): Likewise. (build_new_function_call): Adjust calls to add_function_candidate and add_template_candidate. (build_new_op): Improve handling of erroroneous operands. (convert_default_arg): Remove circular argument processing. (name_as_c_string): New function. (build_new_method_call): Use it. (perform_implicit_conversion): Use error_operand_p. * class.c (finish_struct_anon): Use constructor_name_p. (check_field_decls): Likewise. (pop_nested_class): Use OVL_NEXT, not OVL_CHAIN. (resolve_address_of_overloaded_function): Likewise. (instantiate_type): Tweak pointer-to-member handling. (get_primary_binfo): Remove incorrect assertion. * config-lang.in (gtfiles): Add parser.c, remove parse.c. * cp-tree.h (DEFARG_TOKENS): New macro. (default_arg): New structure. (cp_tree_node_structure_enum): Add TS_CP_DEFAULT_ARG. (lang_tree_node): Add default_arg. (cp_tree_index): Add CPTI_TYPE_INFO_REF_TYPE. (type_info_ref_type): New macro. (saved_scope): Make processing_explicit_instantiation a boolean. (check_access): New field. (unparsed_text): Remove. (language_function): Remove unparsed_inlines. (error_operand_p): New macro. (lang_decl): Adjust pending_inline_info. (DEFARG_POINTER): Remove. (tag_types): Add typenames. (lookup_ualified_name): Declare. (lookup_name_real): Likewise. (shadow_tag): Adjust prototype. (get_scope_of_declarator): Declare it. (process_next_inline): Remove it. (check_for_missing_semicolon): Likewise. (maybe_get_template_decl_from_type_decl): Declare it. (finish_label_stmt): Adjust prototype. (finish_non_static_data_meber): Declare it. (finish_pseudo_destructor_call_expr): Rename to ... (finish_pseudo_destructor_expr): ... this. (finish_compound_literal): Declare it. (begin_inline_definitions): Remove it. (init_spew): Remove. (peekyylex): Likewise. (arbitrate_lookup): Likewise. (frob_opname): Likewise. (maybe_snarf_defarg): Likewise. (add_defarg_fn): Likewise. (do_pending_defargs): Likewise. (done_pending_defargs): Likewise. (unprocessed_defarg_fn): Likewise. (replace_defarg): Likewise. (end_input): Likewise. (get_overloaded_fn): Likewise. * cvt.c (convert_to_reference): Improve error handling. * decl.c (lookup_name_real): Do not declare it static. (maybe_push_to_top_level): Set check_access. (identifier_type_value): Adjust call to lookup_name_real. (lookup_qualified_name): New method. (lookup_name_real): Remove special-case parsing code. (lookup_name-nonclass): Adjust call to lookup_name_real. (lookup_name_namespace_only): Likewise. (lookup_name): Likewise. (check_tag_decl): Return the type declared. (shadow_tag): Likewise. (register_dtor_fn): Tweak check_access. (grokfndecl): Use constructor_name_p. (get_scope_of_declarator): New function. (grokdeclarator): Obscure tweaks for slightly different declarator representations. (start_method): Return error_mark_node to indicate failure. (cp_tree_node_structure_enum): Use TS_CP_DEFAULT_ARG for DEFAULT_ARGs. * decl2.c (constructor_name_full): Simplify. (constructor_name): Use it. (build_expr_from_tree): Adjust for changes to do new parser. (push_scope): Improve robustness. (validate_nonmember_using_decl): Process declarations, not names. (do_class_using_decl): Likewise. (handle_class_head): Do not mess with CLASSTYPE_DECLARED_CLASS here. * error.c (dump_expr): Handle IDENTIFIER_NODEs and BASELINKs. * expr.c (cxx_expand_expr): Handle BASELINKs. * init.c (member_init_ok_or_else): Issue more errors. (build_offset_ref): Tweak handling of FUNCTION_DECLs. * lex.c: Do not include parse.h. (yypring): Do not declare. (yylval): Likewise. (make_reference_declarator): Remove error-generating code. (rid_to_yy): Remove. (cxx_init): Do not call init_spew. (yypring): Remove. (check_for_missing_semicolon): Remove. * lex.h (got_scope): Remove. (got_object): Remove. * method.c (hack_identifier): Use finish_non_static_data_member. (implicitly_declare_fn): Adjust use of constructor_name. * parser.c: New file. * pt.c (parse.h): Do not include it. (maybe_get_template_decl_from_template): Do not declare it. (finish_member_template_decl): Tweak. (begin_explicit_instantiation): Adjust for processing_explicit_instantiation being boolean. (end_explicit_instantiation): Likewise. (maybe_process_partial_specialization): Tighten specialization test. (retrieve_local_specialization): Adjust ue of hash table. (eq_local_specializations): New function. (register_local_specialization): Likewise. (push_template_decl_real): Remove unnecessary test. (maybe_get_template_decl_from_type_decl): Don't make it static. (for_each_template_parm_r): Handle TYPEOF_TYPE. (tsubst_copy): Use retrieive_local_specialization to handle PARM_DECL. Adjust handling of CONST_DECLs. Handle BASELINKs. Handle COMPONENT_REFs with pseudo-destructor-expressions. Simplify handling of CALL_EXPR and METHOD_CALL_EXPR. (tsubst_expr): Pass decls, not names, to do_local_using_decl. (unify): Tweak handling of CONST_DECLs. (regenerate_decl_from_template): Use push_nested_class. (template_for_substitution): New funciton. (instantiate_decl): Use it. Register parameters as local specializations. * rtti.c (init_rtti_processing): Set type_info_ref_type. (build_typeid): Use it. (get_typeid): Likeise. * search.c (accessible_p): Use check_access, not flag_access_control. (adjust_result_of_qualified_name_lookup): Pay attention to the context_class. * semantics.c (finish_asm_stmt): Adjust error handling. (finish_label_stmt): Return the statement. (finish_non_static_data_member): New function. (finish_class_expr): Handle BASELINKs. (finish_call_expr): Handle PSEUDO_DTOR_EXPR. (finish_object_call_expr): Simplify handling during templates. (finish_pseudo_destructor_call_expr): Rename to ... (finish_pseudo_dtor_expr): ... this. (finish_compound_literal): New function. (begin_inline_definitions): Remove. (finish_sizeof): Remove special template handling. * spew.c: Do not include parse.h. * tree.c (get_overloaded_fn): Remove. * typeck.c (build_class_member_access_expr): Handle PSEUDO_DTOR_EXPR. Adjust handling of static member functions. (lookup_destructor): New function. (finish_class_member_access_expr): Use it. (convert_arguments): Simplify. (build_unary_op): Handle BASELINKs. From-SVN: r60560
2002-12-28 09:03:42 +01:00
{
my_friendly_assert (TREE_CODE (decl) == FIELD_DECL, 20020909);
if (!object)
Make-lang.in (po-generated): Remove parse.c. * Make-lang.in (po-generated): Remove parse.c. (CXX_OBJS): Remove parse.o and spew.o. Add parser.o. ($(srcdir)/cp/parse.h): Remove target. ($(srcdir)/cp/parse.c): Likewise. (gt-cp-parse.h): Likewise. (gt-cp-parser.h): New target. (c++.distclean): Do not remove parse.output. (c++.maintainer-clean): Do not remove parse.c or parse.h. (cp/spew.o): Remove target. (cp/lex.o): Adjust dependencies. (cp/pt.o): Likewise. (cp/parse.o): Likewise. (cp/TAGS): Do not mention parse.c. (cp/parser.o): New target. * NEWS: Mention the new parser. * call.c (build_scoped_method_call): Simplify. (build_method_call): Likewise. (build_new_function_call): Adjust calls to add_function_candidate and add_template_candidate. (build_new_op): Improve handling of erroroneous operands. (convert_default_arg): Remove circular argument processing. (name_as_c_string): New function. (build_new_method_call): Use it. (perform_implicit_conversion): Use error_operand_p. * class.c (finish_struct_anon): Use constructor_name_p. (check_field_decls): Likewise. (pop_nested_class): Use OVL_NEXT, not OVL_CHAIN. (resolve_address_of_overloaded_function): Likewise. (instantiate_type): Tweak pointer-to-member handling. (get_primary_binfo): Remove incorrect assertion. * config-lang.in (gtfiles): Add parser.c, remove parse.c. * cp-tree.h (DEFARG_TOKENS): New macro. (default_arg): New structure. (cp_tree_node_structure_enum): Add TS_CP_DEFAULT_ARG. (lang_tree_node): Add default_arg. (cp_tree_index): Add CPTI_TYPE_INFO_REF_TYPE. (type_info_ref_type): New macro. (saved_scope): Make processing_explicit_instantiation a boolean. (check_access): New field. (unparsed_text): Remove. (language_function): Remove unparsed_inlines. (error_operand_p): New macro. (lang_decl): Adjust pending_inline_info. (DEFARG_POINTER): Remove. (tag_types): Add typenames. (lookup_ualified_name): Declare. (lookup_name_real): Likewise. (shadow_tag): Adjust prototype. (get_scope_of_declarator): Declare it. (process_next_inline): Remove it. (check_for_missing_semicolon): Likewise. (maybe_get_template_decl_from_type_decl): Declare it. (finish_label_stmt): Adjust prototype. (finish_non_static_data_meber): Declare it. (finish_pseudo_destructor_call_expr): Rename to ... (finish_pseudo_destructor_expr): ... this. (finish_compound_literal): Declare it. (begin_inline_definitions): Remove it. (init_spew): Remove. (peekyylex): Likewise. (arbitrate_lookup): Likewise. (frob_opname): Likewise. (maybe_snarf_defarg): Likewise. (add_defarg_fn): Likewise. (do_pending_defargs): Likewise. (done_pending_defargs): Likewise. (unprocessed_defarg_fn): Likewise. (replace_defarg): Likewise. (end_input): Likewise. (get_overloaded_fn): Likewise. * cvt.c (convert_to_reference): Improve error handling. * decl.c (lookup_name_real): Do not declare it static. (maybe_push_to_top_level): Set check_access. (identifier_type_value): Adjust call to lookup_name_real. (lookup_qualified_name): New method. (lookup_name_real): Remove special-case parsing code. (lookup_name-nonclass): Adjust call to lookup_name_real. (lookup_name_namespace_only): Likewise. (lookup_name): Likewise. (check_tag_decl): Return the type declared. (shadow_tag): Likewise. (register_dtor_fn): Tweak check_access. (grokfndecl): Use constructor_name_p. (get_scope_of_declarator): New function. (grokdeclarator): Obscure tweaks for slightly different declarator representations. (start_method): Return error_mark_node to indicate failure. (cp_tree_node_structure_enum): Use TS_CP_DEFAULT_ARG for DEFAULT_ARGs. * decl2.c (constructor_name_full): Simplify. (constructor_name): Use it. (build_expr_from_tree): Adjust for changes to do new parser. (push_scope): Improve robustness. (validate_nonmember_using_decl): Process declarations, not names. (do_class_using_decl): Likewise. (handle_class_head): Do not mess with CLASSTYPE_DECLARED_CLASS here. * error.c (dump_expr): Handle IDENTIFIER_NODEs and BASELINKs. * expr.c (cxx_expand_expr): Handle BASELINKs. * init.c (member_init_ok_or_else): Issue more errors. (build_offset_ref): Tweak handling of FUNCTION_DECLs. * lex.c: Do not include parse.h. (yypring): Do not declare. (yylval): Likewise. (make_reference_declarator): Remove error-generating code. (rid_to_yy): Remove. (cxx_init): Do not call init_spew. (yypring): Remove. (check_for_missing_semicolon): Remove. * lex.h (got_scope): Remove. (got_object): Remove. * method.c (hack_identifier): Use finish_non_static_data_member. (implicitly_declare_fn): Adjust use of constructor_name. * parser.c: New file. * pt.c (parse.h): Do not include it. (maybe_get_template_decl_from_template): Do not declare it. (finish_member_template_decl): Tweak. (begin_explicit_instantiation): Adjust for processing_explicit_instantiation being boolean. (end_explicit_instantiation): Likewise. (maybe_process_partial_specialization): Tighten specialization test. (retrieve_local_specialization): Adjust ue of hash table. (eq_local_specializations): New function. (register_local_specialization): Likewise. (push_template_decl_real): Remove unnecessary test. (maybe_get_template_decl_from_type_decl): Don't make it static. (for_each_template_parm_r): Handle TYPEOF_TYPE. (tsubst_copy): Use retrieive_local_specialization to handle PARM_DECL. Adjust handling of CONST_DECLs. Handle BASELINKs. Handle COMPONENT_REFs with pseudo-destructor-expressions. Simplify handling of CALL_EXPR and METHOD_CALL_EXPR. (tsubst_expr): Pass decls, not names, to do_local_using_decl. (unify): Tweak handling of CONST_DECLs. (regenerate_decl_from_template): Use push_nested_class. (template_for_substitution): New funciton. (instantiate_decl): Use it. Register parameters as local specializations. * rtti.c (init_rtti_processing): Set type_info_ref_type. (build_typeid): Use it. (get_typeid): Likeise. * search.c (accessible_p): Use check_access, not flag_access_control. (adjust_result_of_qualified_name_lookup): Pay attention to the context_class. * semantics.c (finish_asm_stmt): Adjust error handling. (finish_label_stmt): Return the statement. (finish_non_static_data_member): New function. (finish_class_expr): Handle BASELINKs. (finish_call_expr): Handle PSEUDO_DTOR_EXPR. (finish_object_call_expr): Simplify handling during templates. (finish_pseudo_destructor_call_expr): Rename to ... (finish_pseudo_dtor_expr): ... this. (finish_compound_literal): New function. (begin_inline_definitions): Remove. (finish_sizeof): Remove special template handling. * spew.c: Do not include parse.h. * tree.c (get_overloaded_fn): Remove. * typeck.c (build_class_member_access_expr): Handle PSEUDO_DTOR_EXPR. Adjust handling of static member functions. (lookup_destructor): New function. (finish_class_member_access_expr): Use it. (convert_arguments): Simplify. (build_unary_op): Handle BASELINKs. From-SVN: r60560
2002-12-28 09:03:42 +01:00
{
if (current_function_decl
&& DECL_STATIC_FUNCTION_P (current_function_decl))
cp_error_at ("invalid use of member `%D' in static member function",
decl);
else
cp_error_at ("invalid use of non-static data member `%D'", decl);
error ("from this location");
return error_mark_node;
}
TREE_USED (current_class_ptr) = 1;
if (processing_template_decl)
{
tree type = TREE_TYPE (decl);
Make-lang.in (po-generated): Remove parse.c. * Make-lang.in (po-generated): Remove parse.c. (CXX_OBJS): Remove parse.o and spew.o. Add parser.o. ($(srcdir)/cp/parse.h): Remove target. ($(srcdir)/cp/parse.c): Likewise. (gt-cp-parse.h): Likewise. (gt-cp-parser.h): New target. (c++.distclean): Do not remove parse.output. (c++.maintainer-clean): Do not remove parse.c or parse.h. (cp/spew.o): Remove target. (cp/lex.o): Adjust dependencies. (cp/pt.o): Likewise. (cp/parse.o): Likewise. (cp/TAGS): Do not mention parse.c. (cp/parser.o): New target. * NEWS: Mention the new parser. * call.c (build_scoped_method_call): Simplify. (build_method_call): Likewise. (build_new_function_call): Adjust calls to add_function_candidate and add_template_candidate. (build_new_op): Improve handling of erroroneous operands. (convert_default_arg): Remove circular argument processing. (name_as_c_string): New function. (build_new_method_call): Use it. (perform_implicit_conversion): Use error_operand_p. * class.c (finish_struct_anon): Use constructor_name_p. (check_field_decls): Likewise. (pop_nested_class): Use OVL_NEXT, not OVL_CHAIN. (resolve_address_of_overloaded_function): Likewise. (instantiate_type): Tweak pointer-to-member handling. (get_primary_binfo): Remove incorrect assertion. * config-lang.in (gtfiles): Add parser.c, remove parse.c. * cp-tree.h (DEFARG_TOKENS): New macro. (default_arg): New structure. (cp_tree_node_structure_enum): Add TS_CP_DEFAULT_ARG. (lang_tree_node): Add default_arg. (cp_tree_index): Add CPTI_TYPE_INFO_REF_TYPE. (type_info_ref_type): New macro. (saved_scope): Make processing_explicit_instantiation a boolean. (check_access): New field. (unparsed_text): Remove. (language_function): Remove unparsed_inlines. (error_operand_p): New macro. (lang_decl): Adjust pending_inline_info. (DEFARG_POINTER): Remove. (tag_types): Add typenames. (lookup_ualified_name): Declare. (lookup_name_real): Likewise. (shadow_tag): Adjust prototype. (get_scope_of_declarator): Declare it. (process_next_inline): Remove it. (check_for_missing_semicolon): Likewise. (maybe_get_template_decl_from_type_decl): Declare it. (finish_label_stmt): Adjust prototype. (finish_non_static_data_meber): Declare it. (finish_pseudo_destructor_call_expr): Rename to ... (finish_pseudo_destructor_expr): ... this. (finish_compound_literal): Declare it. (begin_inline_definitions): Remove it. (init_spew): Remove. (peekyylex): Likewise. (arbitrate_lookup): Likewise. (frob_opname): Likewise. (maybe_snarf_defarg): Likewise. (add_defarg_fn): Likewise. (do_pending_defargs): Likewise. (done_pending_defargs): Likewise. (unprocessed_defarg_fn): Likewise. (replace_defarg): Likewise. (end_input): Likewise. (get_overloaded_fn): Likewise. * cvt.c (convert_to_reference): Improve error handling. * decl.c (lookup_name_real): Do not declare it static. (maybe_push_to_top_level): Set check_access. (identifier_type_value): Adjust call to lookup_name_real. (lookup_qualified_name): New method. (lookup_name_real): Remove special-case parsing code. (lookup_name-nonclass): Adjust call to lookup_name_real. (lookup_name_namespace_only): Likewise. (lookup_name): Likewise. (check_tag_decl): Return the type declared. (shadow_tag): Likewise. (register_dtor_fn): Tweak check_access. (grokfndecl): Use constructor_name_p. (get_scope_of_declarator): New function. (grokdeclarator): Obscure tweaks for slightly different declarator representations. (start_method): Return error_mark_node to indicate failure. (cp_tree_node_structure_enum): Use TS_CP_DEFAULT_ARG for DEFAULT_ARGs. * decl2.c (constructor_name_full): Simplify. (constructor_name): Use it. (build_expr_from_tree): Adjust for changes to do new parser. (push_scope): Improve robustness. (validate_nonmember_using_decl): Process declarations, not names. (do_class_using_decl): Likewise. (handle_class_head): Do not mess with CLASSTYPE_DECLARED_CLASS here. * error.c (dump_expr): Handle IDENTIFIER_NODEs and BASELINKs. * expr.c (cxx_expand_expr): Handle BASELINKs. * init.c (member_init_ok_or_else): Issue more errors. (build_offset_ref): Tweak handling of FUNCTION_DECLs. * lex.c: Do not include parse.h. (yypring): Do not declare. (yylval): Likewise. (make_reference_declarator): Remove error-generating code. (rid_to_yy): Remove. (cxx_init): Do not call init_spew. (yypring): Remove. (check_for_missing_semicolon): Remove. * lex.h (got_scope): Remove. (got_object): Remove. * method.c (hack_identifier): Use finish_non_static_data_member. (implicitly_declare_fn): Adjust use of constructor_name. * parser.c: New file. * pt.c (parse.h): Do not include it. (maybe_get_template_decl_from_template): Do not declare it. (finish_member_template_decl): Tweak. (begin_explicit_instantiation): Adjust for processing_explicit_instantiation being boolean. (end_explicit_instantiation): Likewise. (maybe_process_partial_specialization): Tighten specialization test. (retrieve_local_specialization): Adjust ue of hash table. (eq_local_specializations): New function. (register_local_specialization): Likewise. (push_template_decl_real): Remove unnecessary test. (maybe_get_template_decl_from_type_decl): Don't make it static. (for_each_template_parm_r): Handle TYPEOF_TYPE. (tsubst_copy): Use retrieive_local_specialization to handle PARM_DECL. Adjust handling of CONST_DECLs. Handle BASELINKs. Handle COMPONENT_REFs with pseudo-destructor-expressions. Simplify handling of CALL_EXPR and METHOD_CALL_EXPR. (tsubst_expr): Pass decls, not names, to do_local_using_decl. (unify): Tweak handling of CONST_DECLs. (regenerate_decl_from_template): Use push_nested_class. (template_for_substitution): New funciton. (instantiate_decl): Use it. Register parameters as local specializations. * rtti.c (init_rtti_processing): Set type_info_ref_type. (build_typeid): Use it. (get_typeid): Likeise. * search.c (accessible_p): Use check_access, not flag_access_control. (adjust_result_of_qualified_name_lookup): Pay attention to the context_class. * semantics.c (finish_asm_stmt): Adjust error handling. (finish_label_stmt): Return the statement. (finish_non_static_data_member): New function. (finish_class_expr): Handle BASELINKs. (finish_call_expr): Handle PSEUDO_DTOR_EXPR. (finish_object_call_expr): Simplify handling during templates. (finish_pseudo_destructor_call_expr): Rename to ... (finish_pseudo_dtor_expr): ... this. (finish_compound_literal): New function. (begin_inline_definitions): Remove. (finish_sizeof): Remove special template handling. * spew.c: Do not include parse.h. * tree.c (get_overloaded_fn): Remove. * typeck.c (build_class_member_access_expr): Handle PSEUDO_DTOR_EXPR. Adjust handling of static member functions. (lookup_destructor): New function. (finish_class_member_access_expr): Use it. (convert_arguments): Simplify. (build_unary_op): Handle BASELINKs. From-SVN: r60560
2002-12-28 09:03:42 +01:00
if (TREE_CODE (type) == REFERENCE_TYPE)
type = TREE_TYPE (type);
else
{
/* Set the cv qualifiers */
int quals = cp_type_quals (TREE_TYPE (current_class_ref));
if (DECL_MUTABLE_P (decl))
quals &= ~TYPE_QUAL_CONST;
quals |= cp_type_quals (TREE_TYPE (decl));
type = cp_build_qualified_type (type, quals);
}
return build_min (COMPONENT_REF, type, object, decl);
}
else
{
tree access_type = TREE_TYPE (object);
tree lookup_context = context_for_name_lookup (decl);
while (!DERIVED_FROM_P (lookup_context, access_type))
Make-lang.in (po-generated): Remove parse.c. * Make-lang.in (po-generated): Remove parse.c. (CXX_OBJS): Remove parse.o and spew.o. Add parser.o. ($(srcdir)/cp/parse.h): Remove target. ($(srcdir)/cp/parse.c): Likewise. (gt-cp-parse.h): Likewise. (gt-cp-parser.h): New target. (c++.distclean): Do not remove parse.output. (c++.maintainer-clean): Do not remove parse.c or parse.h. (cp/spew.o): Remove target. (cp/lex.o): Adjust dependencies. (cp/pt.o): Likewise. (cp/parse.o): Likewise. (cp/TAGS): Do not mention parse.c. (cp/parser.o): New target. * NEWS: Mention the new parser. * call.c (build_scoped_method_call): Simplify. (build_method_call): Likewise. (build_new_function_call): Adjust calls to add_function_candidate and add_template_candidate. (build_new_op): Improve handling of erroroneous operands. (convert_default_arg): Remove circular argument processing. (name_as_c_string): New function. (build_new_method_call): Use it. (perform_implicit_conversion): Use error_operand_p. * class.c (finish_struct_anon): Use constructor_name_p. (check_field_decls): Likewise. (pop_nested_class): Use OVL_NEXT, not OVL_CHAIN. (resolve_address_of_overloaded_function): Likewise. (instantiate_type): Tweak pointer-to-member handling. (get_primary_binfo): Remove incorrect assertion. * config-lang.in (gtfiles): Add parser.c, remove parse.c. * cp-tree.h (DEFARG_TOKENS): New macro. (default_arg): New structure. (cp_tree_node_structure_enum): Add TS_CP_DEFAULT_ARG. (lang_tree_node): Add default_arg. (cp_tree_index): Add CPTI_TYPE_INFO_REF_TYPE. (type_info_ref_type): New macro. (saved_scope): Make processing_explicit_instantiation a boolean. (check_access): New field. (unparsed_text): Remove. (language_function): Remove unparsed_inlines. (error_operand_p): New macro. (lang_decl): Adjust pending_inline_info. (DEFARG_POINTER): Remove. (tag_types): Add typenames. (lookup_ualified_name): Declare. (lookup_name_real): Likewise. (shadow_tag): Adjust prototype. (get_scope_of_declarator): Declare it. (process_next_inline): Remove it. (check_for_missing_semicolon): Likewise. (maybe_get_template_decl_from_type_decl): Declare it. (finish_label_stmt): Adjust prototype. (finish_non_static_data_meber): Declare it. (finish_pseudo_destructor_call_expr): Rename to ... (finish_pseudo_destructor_expr): ... this. (finish_compound_literal): Declare it. (begin_inline_definitions): Remove it. (init_spew): Remove. (peekyylex): Likewise. (arbitrate_lookup): Likewise. (frob_opname): Likewise. (maybe_snarf_defarg): Likewise. (add_defarg_fn): Likewise. (do_pending_defargs): Likewise. (done_pending_defargs): Likewise. (unprocessed_defarg_fn): Likewise. (replace_defarg): Likewise. (end_input): Likewise. (get_overloaded_fn): Likewise. * cvt.c (convert_to_reference): Improve error handling. * decl.c (lookup_name_real): Do not declare it static. (maybe_push_to_top_level): Set check_access. (identifier_type_value): Adjust call to lookup_name_real. (lookup_qualified_name): New method. (lookup_name_real): Remove special-case parsing code. (lookup_name-nonclass): Adjust call to lookup_name_real. (lookup_name_namespace_only): Likewise. (lookup_name): Likewise. (check_tag_decl): Return the type declared. (shadow_tag): Likewise. (register_dtor_fn): Tweak check_access. (grokfndecl): Use constructor_name_p. (get_scope_of_declarator): New function. (grokdeclarator): Obscure tweaks for slightly different declarator representations. (start_method): Return error_mark_node to indicate failure. (cp_tree_node_structure_enum): Use TS_CP_DEFAULT_ARG for DEFAULT_ARGs. * decl2.c (constructor_name_full): Simplify. (constructor_name): Use it. (build_expr_from_tree): Adjust for changes to do new parser. (push_scope): Improve robustness. (validate_nonmember_using_decl): Process declarations, not names. (do_class_using_decl): Likewise. (handle_class_head): Do not mess with CLASSTYPE_DECLARED_CLASS here. * error.c (dump_expr): Handle IDENTIFIER_NODEs and BASELINKs. * expr.c (cxx_expand_expr): Handle BASELINKs. * init.c (member_init_ok_or_else): Issue more errors. (build_offset_ref): Tweak handling of FUNCTION_DECLs. * lex.c: Do not include parse.h. (yypring): Do not declare. (yylval): Likewise. (make_reference_declarator): Remove error-generating code. (rid_to_yy): Remove. (cxx_init): Do not call init_spew. (yypring): Remove. (check_for_missing_semicolon): Remove. * lex.h (got_scope): Remove. (got_object): Remove. * method.c (hack_identifier): Use finish_non_static_data_member. (implicitly_declare_fn): Adjust use of constructor_name. * parser.c: New file. * pt.c (parse.h): Do not include it. (maybe_get_template_decl_from_template): Do not declare it. (finish_member_template_decl): Tweak. (begin_explicit_instantiation): Adjust for processing_explicit_instantiation being boolean. (end_explicit_instantiation): Likewise. (maybe_process_partial_specialization): Tighten specialization test. (retrieve_local_specialization): Adjust ue of hash table. (eq_local_specializations): New function. (register_local_specialization): Likewise. (push_template_decl_real): Remove unnecessary test. (maybe_get_template_decl_from_type_decl): Don't make it static. (for_each_template_parm_r): Handle TYPEOF_TYPE. (tsubst_copy): Use retrieive_local_specialization to handle PARM_DECL. Adjust handling of CONST_DECLs. Handle BASELINKs. Handle COMPONENT_REFs with pseudo-destructor-expressions. Simplify handling of CALL_EXPR and METHOD_CALL_EXPR. (tsubst_expr): Pass decls, not names, to do_local_using_decl. (unify): Tweak handling of CONST_DECLs. (regenerate_decl_from_template): Use push_nested_class. (template_for_substitution): New funciton. (instantiate_decl): Use it. Register parameters as local specializations. * rtti.c (init_rtti_processing): Set type_info_ref_type. (build_typeid): Use it. (get_typeid): Likeise. * search.c (accessible_p): Use check_access, not flag_access_control. (adjust_result_of_qualified_name_lookup): Pay attention to the context_class. * semantics.c (finish_asm_stmt): Adjust error handling. (finish_label_stmt): Return the statement. (finish_non_static_data_member): New function. (finish_class_expr): Handle BASELINKs. (finish_call_expr): Handle PSEUDO_DTOR_EXPR. (finish_object_call_expr): Simplify handling during templates. (finish_pseudo_destructor_call_expr): Rename to ... (finish_pseudo_dtor_expr): ... this. (finish_compound_literal): New function. (begin_inline_definitions): Remove. (finish_sizeof): Remove special template handling. * spew.c: Do not include parse.h. * tree.c (get_overloaded_fn): Remove. * typeck.c (build_class_member_access_expr): Handle PSEUDO_DTOR_EXPR. Adjust handling of static member functions. (lookup_destructor): New function. (finish_class_member_access_expr): Use it. (convert_arguments): Simplify. (build_unary_op): Handle BASELINKs. From-SVN: r60560
2002-12-28 09:03:42 +01:00
{
access_type = TYPE_CONTEXT (access_type);
while (access_type && DECL_P (access_type))
Make-lang.in (po-generated): Remove parse.c. * Make-lang.in (po-generated): Remove parse.c. (CXX_OBJS): Remove parse.o and spew.o. Add parser.o. ($(srcdir)/cp/parse.h): Remove target. ($(srcdir)/cp/parse.c): Likewise. (gt-cp-parse.h): Likewise. (gt-cp-parser.h): New target. (c++.distclean): Do not remove parse.output. (c++.maintainer-clean): Do not remove parse.c or parse.h. (cp/spew.o): Remove target. (cp/lex.o): Adjust dependencies. (cp/pt.o): Likewise. (cp/parse.o): Likewise. (cp/TAGS): Do not mention parse.c. (cp/parser.o): New target. * NEWS: Mention the new parser. * call.c (build_scoped_method_call): Simplify. (build_method_call): Likewise. (build_new_function_call): Adjust calls to add_function_candidate and add_template_candidate. (build_new_op): Improve handling of erroroneous operands. (convert_default_arg): Remove circular argument processing. (name_as_c_string): New function. (build_new_method_call): Use it. (perform_implicit_conversion): Use error_operand_p. * class.c (finish_struct_anon): Use constructor_name_p. (check_field_decls): Likewise. (pop_nested_class): Use OVL_NEXT, not OVL_CHAIN. (resolve_address_of_overloaded_function): Likewise. (instantiate_type): Tweak pointer-to-member handling. (get_primary_binfo): Remove incorrect assertion. * config-lang.in (gtfiles): Add parser.c, remove parse.c. * cp-tree.h (DEFARG_TOKENS): New macro. (default_arg): New structure. (cp_tree_node_structure_enum): Add TS_CP_DEFAULT_ARG. (lang_tree_node): Add default_arg. (cp_tree_index): Add CPTI_TYPE_INFO_REF_TYPE. (type_info_ref_type): New macro. (saved_scope): Make processing_explicit_instantiation a boolean. (check_access): New field. (unparsed_text): Remove. (language_function): Remove unparsed_inlines. (error_operand_p): New macro. (lang_decl): Adjust pending_inline_info. (DEFARG_POINTER): Remove. (tag_types): Add typenames. (lookup_ualified_name): Declare. (lookup_name_real): Likewise. (shadow_tag): Adjust prototype. (get_scope_of_declarator): Declare it. (process_next_inline): Remove it. (check_for_missing_semicolon): Likewise. (maybe_get_template_decl_from_type_decl): Declare it. (finish_label_stmt): Adjust prototype. (finish_non_static_data_meber): Declare it. (finish_pseudo_destructor_call_expr): Rename to ... (finish_pseudo_destructor_expr): ... this. (finish_compound_literal): Declare it. (begin_inline_definitions): Remove it. (init_spew): Remove. (peekyylex): Likewise. (arbitrate_lookup): Likewise. (frob_opname): Likewise. (maybe_snarf_defarg): Likewise. (add_defarg_fn): Likewise. (do_pending_defargs): Likewise. (done_pending_defargs): Likewise. (unprocessed_defarg_fn): Likewise. (replace_defarg): Likewise. (end_input): Likewise. (get_overloaded_fn): Likewise. * cvt.c (convert_to_reference): Improve error handling. * decl.c (lookup_name_real): Do not declare it static. (maybe_push_to_top_level): Set check_access. (identifier_type_value): Adjust call to lookup_name_real. (lookup_qualified_name): New method. (lookup_name_real): Remove special-case parsing code. (lookup_name-nonclass): Adjust call to lookup_name_real. (lookup_name_namespace_only): Likewise. (lookup_name): Likewise. (check_tag_decl): Return the type declared. (shadow_tag): Likewise. (register_dtor_fn): Tweak check_access. (grokfndecl): Use constructor_name_p. (get_scope_of_declarator): New function. (grokdeclarator): Obscure tweaks for slightly different declarator representations. (start_method): Return error_mark_node to indicate failure. (cp_tree_node_structure_enum): Use TS_CP_DEFAULT_ARG for DEFAULT_ARGs. * decl2.c (constructor_name_full): Simplify. (constructor_name): Use it. (build_expr_from_tree): Adjust for changes to do new parser. (push_scope): Improve robustness. (validate_nonmember_using_decl): Process declarations, not names. (do_class_using_decl): Likewise. (handle_class_head): Do not mess with CLASSTYPE_DECLARED_CLASS here. * error.c (dump_expr): Handle IDENTIFIER_NODEs and BASELINKs. * expr.c (cxx_expand_expr): Handle BASELINKs. * init.c (member_init_ok_or_else): Issue more errors. (build_offset_ref): Tweak handling of FUNCTION_DECLs. * lex.c: Do not include parse.h. (yypring): Do not declare. (yylval): Likewise. (make_reference_declarator): Remove error-generating code. (rid_to_yy): Remove. (cxx_init): Do not call init_spew. (yypring): Remove. (check_for_missing_semicolon): Remove. * lex.h (got_scope): Remove. (got_object): Remove. * method.c (hack_identifier): Use finish_non_static_data_member. (implicitly_declare_fn): Adjust use of constructor_name. * parser.c: New file. * pt.c (parse.h): Do not include it. (maybe_get_template_decl_from_template): Do not declare it. (finish_member_template_decl): Tweak. (begin_explicit_instantiation): Adjust for processing_explicit_instantiation being boolean. (end_explicit_instantiation): Likewise. (maybe_process_partial_specialization): Tighten specialization test. (retrieve_local_specialization): Adjust ue of hash table. (eq_local_specializations): New function. (register_local_specialization): Likewise. (push_template_decl_real): Remove unnecessary test. (maybe_get_template_decl_from_type_decl): Don't make it static. (for_each_template_parm_r): Handle TYPEOF_TYPE. (tsubst_copy): Use retrieive_local_specialization to handle PARM_DECL. Adjust handling of CONST_DECLs. Handle BASELINKs. Handle COMPONENT_REFs with pseudo-destructor-expressions. Simplify handling of CALL_EXPR and METHOD_CALL_EXPR. (tsubst_expr): Pass decls, not names, to do_local_using_decl. (unify): Tweak handling of CONST_DECLs. (regenerate_decl_from_template): Use push_nested_class. (template_for_substitution): New funciton. (instantiate_decl): Use it. Register parameters as local specializations. * rtti.c (init_rtti_processing): Set type_info_ref_type. (build_typeid): Use it. (get_typeid): Likeise. * search.c (accessible_p): Use check_access, not flag_access_control. (adjust_result_of_qualified_name_lookup): Pay attention to the context_class. * semantics.c (finish_asm_stmt): Adjust error handling. (finish_label_stmt): Return the statement. (finish_non_static_data_member): New function. (finish_class_expr): Handle BASELINKs. (finish_call_expr): Handle PSEUDO_DTOR_EXPR. (finish_object_call_expr): Simplify handling during templates. (finish_pseudo_destructor_call_expr): Rename to ... (finish_pseudo_dtor_expr): ... this. (finish_compound_literal): New function. (begin_inline_definitions): Remove. (finish_sizeof): Remove special template handling. * spew.c: Do not include parse.h. * tree.c (get_overloaded_fn): Remove. * typeck.c (build_class_member_access_expr): Handle PSEUDO_DTOR_EXPR. Adjust handling of static member functions. (lookup_destructor): New function. (finish_class_member_access_expr): Use it. (convert_arguments): Simplify. (build_unary_op): Handle BASELINKs. From-SVN: r60560
2002-12-28 09:03:42 +01:00
access_type = DECL_CONTEXT (access_type);
if (!access_type)
{
cp_error_at ("object missing in reference to `%D'", decl);
error ("from this location");
return error_mark_node;
}
}
perform_or_defer_access_check (TYPE_BINFO (access_type), decl);
Make-lang.in (po-generated): Remove parse.c. * Make-lang.in (po-generated): Remove parse.c. (CXX_OBJS): Remove parse.o and spew.o. Add parser.o. ($(srcdir)/cp/parse.h): Remove target. ($(srcdir)/cp/parse.c): Likewise. (gt-cp-parse.h): Likewise. (gt-cp-parser.h): New target. (c++.distclean): Do not remove parse.output. (c++.maintainer-clean): Do not remove parse.c or parse.h. (cp/spew.o): Remove target. (cp/lex.o): Adjust dependencies. (cp/pt.o): Likewise. (cp/parse.o): Likewise. (cp/TAGS): Do not mention parse.c. (cp/parser.o): New target. * NEWS: Mention the new parser. * call.c (build_scoped_method_call): Simplify. (build_method_call): Likewise. (build_new_function_call): Adjust calls to add_function_candidate and add_template_candidate. (build_new_op): Improve handling of erroroneous operands. (convert_default_arg): Remove circular argument processing. (name_as_c_string): New function. (build_new_method_call): Use it. (perform_implicit_conversion): Use error_operand_p. * class.c (finish_struct_anon): Use constructor_name_p. (check_field_decls): Likewise. (pop_nested_class): Use OVL_NEXT, not OVL_CHAIN. (resolve_address_of_overloaded_function): Likewise. (instantiate_type): Tweak pointer-to-member handling. (get_primary_binfo): Remove incorrect assertion. * config-lang.in (gtfiles): Add parser.c, remove parse.c. * cp-tree.h (DEFARG_TOKENS): New macro. (default_arg): New structure. (cp_tree_node_structure_enum): Add TS_CP_DEFAULT_ARG. (lang_tree_node): Add default_arg. (cp_tree_index): Add CPTI_TYPE_INFO_REF_TYPE. (type_info_ref_type): New macro. (saved_scope): Make processing_explicit_instantiation a boolean. (check_access): New field. (unparsed_text): Remove. (language_function): Remove unparsed_inlines. (error_operand_p): New macro. (lang_decl): Adjust pending_inline_info. (DEFARG_POINTER): Remove. (tag_types): Add typenames. (lookup_ualified_name): Declare. (lookup_name_real): Likewise. (shadow_tag): Adjust prototype. (get_scope_of_declarator): Declare it. (process_next_inline): Remove it. (check_for_missing_semicolon): Likewise. (maybe_get_template_decl_from_type_decl): Declare it. (finish_label_stmt): Adjust prototype. (finish_non_static_data_meber): Declare it. (finish_pseudo_destructor_call_expr): Rename to ... (finish_pseudo_destructor_expr): ... this. (finish_compound_literal): Declare it. (begin_inline_definitions): Remove it. (init_spew): Remove. (peekyylex): Likewise. (arbitrate_lookup): Likewise. (frob_opname): Likewise. (maybe_snarf_defarg): Likewise. (add_defarg_fn): Likewise. (do_pending_defargs): Likewise. (done_pending_defargs): Likewise. (unprocessed_defarg_fn): Likewise. (replace_defarg): Likewise. (end_input): Likewise. (get_overloaded_fn): Likewise. * cvt.c (convert_to_reference): Improve error handling. * decl.c (lookup_name_real): Do not declare it static. (maybe_push_to_top_level): Set check_access. (identifier_type_value): Adjust call to lookup_name_real. (lookup_qualified_name): New method. (lookup_name_real): Remove special-case parsing code. (lookup_name-nonclass): Adjust call to lookup_name_real. (lookup_name_namespace_only): Likewise. (lookup_name): Likewise. (check_tag_decl): Return the type declared. (shadow_tag): Likewise. (register_dtor_fn): Tweak check_access. (grokfndecl): Use constructor_name_p. (get_scope_of_declarator): New function. (grokdeclarator): Obscure tweaks for slightly different declarator representations. (start_method): Return error_mark_node to indicate failure. (cp_tree_node_structure_enum): Use TS_CP_DEFAULT_ARG for DEFAULT_ARGs. * decl2.c (constructor_name_full): Simplify. (constructor_name): Use it. (build_expr_from_tree): Adjust for changes to do new parser. (push_scope): Improve robustness. (validate_nonmember_using_decl): Process declarations, not names. (do_class_using_decl): Likewise. (handle_class_head): Do not mess with CLASSTYPE_DECLARED_CLASS here. * error.c (dump_expr): Handle IDENTIFIER_NODEs and BASELINKs. * expr.c (cxx_expand_expr): Handle BASELINKs. * init.c (member_init_ok_or_else): Issue more errors. (build_offset_ref): Tweak handling of FUNCTION_DECLs. * lex.c: Do not include parse.h. (yypring): Do not declare. (yylval): Likewise. (make_reference_declarator): Remove error-generating code. (rid_to_yy): Remove. (cxx_init): Do not call init_spew. (yypring): Remove. (check_for_missing_semicolon): Remove. * lex.h (got_scope): Remove. (got_object): Remove. * method.c (hack_identifier): Use finish_non_static_data_member. (implicitly_declare_fn): Adjust use of constructor_name. * parser.c: New file. * pt.c (parse.h): Do not include it. (maybe_get_template_decl_from_template): Do not declare it. (finish_member_template_decl): Tweak. (begin_explicit_instantiation): Adjust for processing_explicit_instantiation being boolean. (end_explicit_instantiation): Likewise. (maybe_process_partial_specialization): Tighten specialization test. (retrieve_local_specialization): Adjust ue of hash table. (eq_local_specializations): New function. (register_local_specialization): Likewise. (push_template_decl_real): Remove unnecessary test. (maybe_get_template_decl_from_type_decl): Don't make it static. (for_each_template_parm_r): Handle TYPEOF_TYPE. (tsubst_copy): Use retrieive_local_specialization to handle PARM_DECL. Adjust handling of CONST_DECLs. Handle BASELINKs. Handle COMPONENT_REFs with pseudo-destructor-expressions. Simplify handling of CALL_EXPR and METHOD_CALL_EXPR. (tsubst_expr): Pass decls, not names, to do_local_using_decl. (unify): Tweak handling of CONST_DECLs. (regenerate_decl_from_template): Use push_nested_class. (template_for_substitution): New funciton. (instantiate_decl): Use it. Register parameters as local specializations. * rtti.c (init_rtti_processing): Set type_info_ref_type. (build_typeid): Use it. (get_typeid): Likeise. * search.c (accessible_p): Use check_access, not flag_access_control. (adjust_result_of_qualified_name_lookup): Pay attention to the context_class. * semantics.c (finish_asm_stmt): Adjust error handling. (finish_label_stmt): Return the statement. (finish_non_static_data_member): New function. (finish_class_expr): Handle BASELINKs. (finish_call_expr): Handle PSEUDO_DTOR_EXPR. (finish_object_call_expr): Simplify handling during templates. (finish_pseudo_destructor_call_expr): Rename to ... (finish_pseudo_dtor_expr): ... this. (finish_compound_literal): New function. (begin_inline_definitions): Remove. (finish_sizeof): Remove special template handling. * spew.c: Do not include parse.h. * tree.c (get_overloaded_fn): Remove. * typeck.c (build_class_member_access_expr): Handle PSEUDO_DTOR_EXPR. Adjust handling of static member functions. (lookup_destructor): New function. (finish_class_member_access_expr): Use it. (convert_arguments): Simplify. (build_unary_op): Handle BASELINKs. From-SVN: r60560
2002-12-28 09:03:42 +01:00
/* If the data member was named `C::M', convert `*this' to `C'
first. */
if (qualifying_scope)
{
tree binfo = NULL_TREE;
object = build_scoped_ref (object, qualifying_scope,
&binfo);
}
return build_class_member_access_expr (object, decl,
/*access_path=*/NULL_TREE,
/*preserve_reference=*/false);
}
}
cp-tree.h (build_scoped_method_call): Remove. * cp-tree.h (build_scoped_method_call): Remove. (lookup_qualified_name): Remove parameter. (tsubst_copy_and_build): Declare. (finish_qualified_object_call_expr): Remove. (check_accessibility_of_qualified_id): New function. (finish_qualified_id_expr): Likewise. (non_reference): Likewise. (build_expr_from-tree): Remove. * call.c (non_reference): Remove. (build_scoped_method_call): Likewise. (build_method_call): Use error_operand_p. Assert that we are not processing a template. (standard_conversion): Use non_reference. * class.c (build_vtbl_entry_ref): Likewise. (build_vtbl_ref_1): Likewise. * cvt.c (build_expr_type_conversion): Use non_reference. * decl.c (lookup_qualified_name): Remove flags parameter. (grok_op_properties): Use non_reference. * decl2.c (grok_array_decl): Likewise. (build_expr_from_tree): Remove. (build_offset_ref_call_from_tree): Update comment. * error.c (parm_to_string): Call reinit_global_formatting_buffer. * except.c (prepare_eh_types): Use non_reference. (can_convert_eh): Likewise. * init.c (build_dtor_call): Avoid using build_method_call. * mangle.c (write_template_param): Remove misleading comment. * method.c (locate_copy): Use non_reference. * parser.c (cp_parser_scope_through_which_access_occurs): Remove. (cp_parser_primary_expression): Do not create SCOPE_REFs is non-dependent contexts. (cp_parser_postfix_expression): Use finish_qualified_id_expr. (cp_parser_direct_declarator): Use tsubst_copy_and_build, not build_expr_from_tree. (cp_parser_lookup_name): Adjust call to lookup_qualified_name. Use check_accessibility_of_qualified_id. * pt.c (maybe_fold_nontype_arg): Use tsubst_copy_and_build, not build_expr_from_tree. (tsubst_baselink): New function. (tsubst_qualified_id): Likewise. (tsubst_copy): Use them. Remove support for METHOD_CALL_EXPR. (tsubst_expr): Adjust call to lookup_qualified_name. (tsubst_copy_and_build): Handle SCOPE_REFs specially. Adjust handling of CALL_EXPRs. (value_dependent_expression_p): Use INTEGRAL_OR_ENUMERATION_TYPE_P. * rtti.c (get_tinfo_decl_dynamic): Use non_reference. * search.c (check_final_overrider): Likewise. * semantics.c (check_accessibility_of_qualified_id): New function. (finish_qualified_object_call_expr): Remove. * typeck.c (target_type): Use non_reference. (cxx_sizeof_or_alignof_type): Likewise. (dubious_conversion_warnings): Likewise. (convert_for_initialization): Likewise. (non_reference): New function. From-SVN: r69063
2003-07-08 03:38:44 +02:00
/* DECL was the declaration to which a qualified-id resolved. Issue
an error message if it is not accessible. If OBJECT_TYPE is
non-NULL, we have just seen `x->' or `x.' and OBJECT_TYPE is the
type of `*x', or `x', respectively. If the DECL was named as
`A::B' then NESTED_NAME_SPECIFIER is `A'. */
void
check_accessibility_of_qualified_id (tree decl,
tree object_type,
tree nested_name_specifier)
{
tree scope;
tree qualifying_type = NULL_TREE;
/* Determine the SCOPE of DECL. */
scope = context_for_name_lookup (decl);
/* If the SCOPE is not a type, then DECL is not a member. */
if (!TYPE_P (scope))
return;
/* Compute the scope through which DECL is being accessed. */
if (object_type
/* OBJECT_TYPE might not be a class type; consider:
class A { typedef int I; };
I *p;
p->A::I::~I();
In this case, we will have "A::I" as the DECL, but "I" as the
OBJECT_TYPE. */
&& CLASS_TYPE_P (object_type)
&& DERIVED_FROM_P (scope, object_type))
/* If we are processing a `->' or `.' expression, use the type of the
left-hand side. */
qualifying_type = object_type;
else if (nested_name_specifier)
{
/* If the reference is to a non-static member of the
current class, treat it as if it were referenced through
`this'. */
if (DECL_NONSTATIC_MEMBER_P (decl)
&& current_class_ptr
&& DERIVED_FROM_P (scope, current_class_type))
qualifying_type = current_class_type;
/* Otherwise, use the type indicated by the
nested-name-specifier. */
else
qualifying_type = nested_name_specifier;
}
else
/* Otherwise, the name must be from the current class or one of
its bases. */
qualifying_type = currently_open_derived_class (scope);
if (qualifying_type)
perform_or_defer_access_check (TYPE_BINFO (qualifying_type), decl);
}
/* EXPR is the result of a qualified-id. The QUALIFYING_CLASS was the
class named to the left of the "::" operator. DONE is true if this
expression is a complete postfix-expression; it is false if this
expression is followed by '->', '[', '(', etc. ADDRESS_P is true
iff this expression is the operand of '&'. */
tree
finish_qualified_id_expr (tree qualifying_class, tree expr, bool done,
bool address_p)
{
if (error_operand_p (expr))
return error_mark_node;
cp-tree.h (build_scoped_method_call): Remove. * cp-tree.h (build_scoped_method_call): Remove. (lookup_qualified_name): Remove parameter. (tsubst_copy_and_build): Declare. (finish_qualified_object_call_expr): Remove. (check_accessibility_of_qualified_id): New function. (finish_qualified_id_expr): Likewise. (non_reference): Likewise. (build_expr_from-tree): Remove. * call.c (non_reference): Remove. (build_scoped_method_call): Likewise. (build_method_call): Use error_operand_p. Assert that we are not processing a template. (standard_conversion): Use non_reference. * class.c (build_vtbl_entry_ref): Likewise. (build_vtbl_ref_1): Likewise. * cvt.c (build_expr_type_conversion): Use non_reference. * decl.c (lookup_qualified_name): Remove flags parameter. (grok_op_properties): Use non_reference. * decl2.c (grok_array_decl): Likewise. (build_expr_from_tree): Remove. (build_offset_ref_call_from_tree): Update comment. * error.c (parm_to_string): Call reinit_global_formatting_buffer. * except.c (prepare_eh_types): Use non_reference. (can_convert_eh): Likewise. * init.c (build_dtor_call): Avoid using build_method_call. * mangle.c (write_template_param): Remove misleading comment. * method.c (locate_copy): Use non_reference. * parser.c (cp_parser_scope_through_which_access_occurs): Remove. (cp_parser_primary_expression): Do not create SCOPE_REFs is non-dependent contexts. (cp_parser_postfix_expression): Use finish_qualified_id_expr. (cp_parser_direct_declarator): Use tsubst_copy_and_build, not build_expr_from_tree. (cp_parser_lookup_name): Adjust call to lookup_qualified_name. Use check_accessibility_of_qualified_id. * pt.c (maybe_fold_nontype_arg): Use tsubst_copy_and_build, not build_expr_from_tree. (tsubst_baselink): New function. (tsubst_qualified_id): Likewise. (tsubst_copy): Use them. Remove support for METHOD_CALL_EXPR. (tsubst_expr): Adjust call to lookup_qualified_name. (tsubst_copy_and_build): Handle SCOPE_REFs specially. Adjust handling of CALL_EXPRs. (value_dependent_expression_p): Use INTEGRAL_OR_ENUMERATION_TYPE_P. * rtti.c (get_tinfo_decl_dynamic): Use non_reference. * search.c (check_final_overrider): Likewise. * semantics.c (check_accessibility_of_qualified_id): New function. (finish_qualified_object_call_expr): Remove. * typeck.c (target_type): Use non_reference. (cxx_sizeof_or_alignof_type): Likewise. (dubious_conversion_warnings): Likewise. (convert_for_initialization): Likewise. (non_reference): New function. From-SVN: r69063
2003-07-08 03:38:44 +02:00
/* If EXPR occurs as the operand of '&', use special handling that
permits a pointer-to-member. */
if (address_p && done)
{
if (TREE_CODE (expr) == SCOPE_REF)
expr = TREE_OPERAND (expr, 1);
fold-const.c (force_fit_type): Handle OFFSET_TYPE. * fold-const.c (force_fit_type): Handle OFFSET_TYPE. * varasam.c (output_constant): Likewise. 2003-07-22 Mark Mitchell <mark@codesourcery.com> Eliminate use of POINTER_TYPE for pointers-to-members. * call.c (standard_conversion): Rework pointer-to-member handling. Add comments. (add_builtin_candidate): Likewise. (resolve_scoped_fn_name): Remove. (build_conditional_expr): Rework pointer-to-member handling. (compare_ics): Likewise. * class.c (check_field_decls): Use TYPE_PTR_P. * cp-lang.c (cp_var_mod_type_p): Rework pointer-to-member handling. * cp-tree.h (SCALAR_TYPE_P): Use TYPE_PTR_TO_MEMBER_P. (TYPE_PTRMEM_P): Add comment. (TYPE_PTR_P): Simplify. (TYPE_PTROB_P): Correct definition. (TYPE_PTR_TO_MEMBER_P): New macro. (TYPE_PTRMEM_CLASS_TYPE): Adjust. (TYPE_PTRMEM_POINTED_TO_TYPE): Likewise. (resolved_scoped_fn_name): Remove declaration. (build_offset_ref): Change prototype. (resolve_offset_ref): Remove. (comp_target_types): Remove. * cvt.c (cp_convert_to_pointer): Rework pointer-to-member handling. (convert_to_reference): Use can_convert. (ocp_convert): Improve error handling. Rework pointer-to-member handling. (perform_qualification_conversions): Rework pointer-to-member handling. * decl.c (build_ptrmem_type): Handle functions too. (create_array_type_for_decl): Remove OFFSET_TYPE error message. (grokdeclarator): Use OFFSET_TYPE for pointers to data members. (grokparms): Remove OFFSET_TYPE error message. * dump.c (cp_dump_tree): Rework pointer-to-member handling. * error.c (dump_type_prefix): Likewise. * expr.c (cplus_expand_constant): Use build_nop. * init.c (build_offset_ref): Add address_p parameter. Fold in necessary bits from resolve_offset_ref. (resolve_offset_ref): Remove. * parser.c (cp_parser_postfix_expression): Remove special case code for OFFSET_TYPE. * pt.c (convert_nontype_argument): Rework pointer-to-member handling. (convert_template_argument): Likewise. (unify): Likewise. (invalid_nontype_parm_type_p): Likewise. (dependent_type_p_r): Likewise. * rtti.c (get_tinfo_decl): Remove OFFSET_TYPE special case. (target_incomplete_p_): Rework pointer-to-member handling. (get_pseudo_ti_init): Likewise. (get_pseudo_ti_desc): Likewise. * semantics.c (finish_qualified_id_expr): Adjust call to build_offset_ref. Remove use of resolve_offset_ref. * tree.c (pod_type_p): Use TYPE_PTR_TO_MEMBER_P. * typeck.c (target_type): Use TYPE_PTRMEM_P. (type_unknown_p): Remove obsolete code about the time before non-dependent expressions were handled correctly. (qualify_type_recursive): Remove. (composite_pointer_type_r): New function. (composite_pointer_type): Use it. (merge_types): Remove dead comments. (comp_cv_target_types): Remove. (comp_target_types): Likewise. (comp_target_parms): Likewise. (cxx_sizeof_or_alignof_type): Remove OFFSET_TYPE error. (build_indirect_ref): Use TYPE_PTR_TO_MEMBER_P. (build_binary_op): Do not use of comp_target_types. (pointer_diff): Remove OFFSET_TYPE case. (build_unary_op): Adjust pointer-to-member handling. (unary_complex_lvalue): Likewise. (check_for_casting_away_constness): Add description parameter. (build_static_cast): Pass it. (build_reinterpret_cast): Use check_for_casting_away_constness. (build_const_cast): Adjust pointer-to-member handling. (build_c_cast): Likewise. (convert_for_assignment): Remove OFFSET_TYPE error message. (comp_ptr_ttypes_real): Adjust pointer-to-member handling. (comp_ptr_ttypes_reinterpret): Remove. (casts_away_constness_r): Adjust pointer-to-member handling. (casts_away_constness): Liekwise. (strip_all_pointer_quals): Remove. * typeck2.c (digest_init): Adjust pointer-to-member handling. (build_m_component_ref): Likewise. From-SVN: r69691
2003-07-23 01:30:22 +02:00
expr = build_offset_ref (qualifying_class, expr,
/*address_p=*/true);
cp-tree.h (build_scoped_method_call): Remove. * cp-tree.h (build_scoped_method_call): Remove. (lookup_qualified_name): Remove parameter. (tsubst_copy_and_build): Declare. (finish_qualified_object_call_expr): Remove. (check_accessibility_of_qualified_id): New function. (finish_qualified_id_expr): Likewise. (non_reference): Likewise. (build_expr_from-tree): Remove. * call.c (non_reference): Remove. (build_scoped_method_call): Likewise. (build_method_call): Use error_operand_p. Assert that we are not processing a template. (standard_conversion): Use non_reference. * class.c (build_vtbl_entry_ref): Likewise. (build_vtbl_ref_1): Likewise. * cvt.c (build_expr_type_conversion): Use non_reference. * decl.c (lookup_qualified_name): Remove flags parameter. (grok_op_properties): Use non_reference. * decl2.c (grok_array_decl): Likewise. (build_expr_from_tree): Remove. (build_offset_ref_call_from_tree): Update comment. * error.c (parm_to_string): Call reinit_global_formatting_buffer. * except.c (prepare_eh_types): Use non_reference. (can_convert_eh): Likewise. * init.c (build_dtor_call): Avoid using build_method_call. * mangle.c (write_template_param): Remove misleading comment. * method.c (locate_copy): Use non_reference. * parser.c (cp_parser_scope_through_which_access_occurs): Remove. (cp_parser_primary_expression): Do not create SCOPE_REFs is non-dependent contexts. (cp_parser_postfix_expression): Use finish_qualified_id_expr. (cp_parser_direct_declarator): Use tsubst_copy_and_build, not build_expr_from_tree. (cp_parser_lookup_name): Adjust call to lookup_qualified_name. Use check_accessibility_of_qualified_id. * pt.c (maybe_fold_nontype_arg): Use tsubst_copy_and_build, not build_expr_from_tree. (tsubst_baselink): New function. (tsubst_qualified_id): Likewise. (tsubst_copy): Use them. Remove support for METHOD_CALL_EXPR. (tsubst_expr): Adjust call to lookup_qualified_name. (tsubst_copy_and_build): Handle SCOPE_REFs specially. Adjust handling of CALL_EXPRs. (value_dependent_expression_p): Use INTEGRAL_OR_ENUMERATION_TYPE_P. * rtti.c (get_tinfo_decl_dynamic): Use non_reference. * search.c (check_final_overrider): Likewise. * semantics.c (check_accessibility_of_qualified_id): New function. (finish_qualified_object_call_expr): Remove. * typeck.c (target_type): Use non_reference. (cxx_sizeof_or_alignof_type): Likewise. (dubious_conversion_warnings): Likewise. (convert_for_initialization): Likewise. (non_reference): New function. From-SVN: r69063
2003-07-08 03:38:44 +02:00
return expr;
}
if (TREE_CODE (expr) == FIELD_DECL)
expr = finish_non_static_data_member (expr, current_class_ref,
qualifying_class);
cp-tree.h (build_scoped_method_call): Remove. * cp-tree.h (build_scoped_method_call): Remove. (lookup_qualified_name): Remove parameter. (tsubst_copy_and_build): Declare. (finish_qualified_object_call_expr): Remove. (check_accessibility_of_qualified_id): New function. (finish_qualified_id_expr): Likewise. (non_reference): Likewise. (build_expr_from-tree): Remove. * call.c (non_reference): Remove. (build_scoped_method_call): Likewise. (build_method_call): Use error_operand_p. Assert that we are not processing a template. (standard_conversion): Use non_reference. * class.c (build_vtbl_entry_ref): Likewise. (build_vtbl_ref_1): Likewise. * cvt.c (build_expr_type_conversion): Use non_reference. * decl.c (lookup_qualified_name): Remove flags parameter. (grok_op_properties): Use non_reference. * decl2.c (grok_array_decl): Likewise. (build_expr_from_tree): Remove. (build_offset_ref_call_from_tree): Update comment. * error.c (parm_to_string): Call reinit_global_formatting_buffer. * except.c (prepare_eh_types): Use non_reference. (can_convert_eh): Likewise. * init.c (build_dtor_call): Avoid using build_method_call. * mangle.c (write_template_param): Remove misleading comment. * method.c (locate_copy): Use non_reference. * parser.c (cp_parser_scope_through_which_access_occurs): Remove. (cp_parser_primary_expression): Do not create SCOPE_REFs is non-dependent contexts. (cp_parser_postfix_expression): Use finish_qualified_id_expr. (cp_parser_direct_declarator): Use tsubst_copy_and_build, not build_expr_from_tree. (cp_parser_lookup_name): Adjust call to lookup_qualified_name. Use check_accessibility_of_qualified_id. * pt.c (maybe_fold_nontype_arg): Use tsubst_copy_and_build, not build_expr_from_tree. (tsubst_baselink): New function. (tsubst_qualified_id): Likewise. (tsubst_copy): Use them. Remove support for METHOD_CALL_EXPR. (tsubst_expr): Adjust call to lookup_qualified_name. (tsubst_copy_and_build): Handle SCOPE_REFs specially. Adjust handling of CALL_EXPRs. (value_dependent_expression_p): Use INTEGRAL_OR_ENUMERATION_TYPE_P. * rtti.c (get_tinfo_decl_dynamic): Use non_reference. * search.c (check_final_overrider): Likewise. * semantics.c (check_accessibility_of_qualified_id): New function. (finish_qualified_object_call_expr): Remove. * typeck.c (target_type): Use non_reference. (cxx_sizeof_or_alignof_type): Likewise. (dubious_conversion_warnings): Likewise. (convert_for_initialization): Likewise. (non_reference): New function. From-SVN: r69063
2003-07-08 03:38:44 +02:00
else if (BASELINK_P (expr) && !processing_template_decl)
{
tree fn;
tree fns;
/* See if any of the functions are non-static members. */
fns = BASELINK_FUNCTIONS (expr);
if (TREE_CODE (fns) == TEMPLATE_ID_EXPR)
fns = TREE_OPERAND (fns, 0);
for (fn = fns; fn; fn = OVL_NEXT (fn))
if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fn))
break;
/* If so, the expression may be relative to the current
class. */
if (fn && current_class_type
&& DERIVED_FROM_P (qualifying_class, current_class_type))
expr = (build_class_member_access_expr
(maybe_dummy_object (qualifying_class, NULL),
expr,
BASELINK_ACCESS_BINFO (expr),
/*preserve_reference=*/false));
else if (done)
fold-const.c (force_fit_type): Handle OFFSET_TYPE. * fold-const.c (force_fit_type): Handle OFFSET_TYPE. * varasam.c (output_constant): Likewise. 2003-07-22 Mark Mitchell <mark@codesourcery.com> Eliminate use of POINTER_TYPE for pointers-to-members. * call.c (standard_conversion): Rework pointer-to-member handling. Add comments. (add_builtin_candidate): Likewise. (resolve_scoped_fn_name): Remove. (build_conditional_expr): Rework pointer-to-member handling. (compare_ics): Likewise. * class.c (check_field_decls): Use TYPE_PTR_P. * cp-lang.c (cp_var_mod_type_p): Rework pointer-to-member handling. * cp-tree.h (SCALAR_TYPE_P): Use TYPE_PTR_TO_MEMBER_P. (TYPE_PTRMEM_P): Add comment. (TYPE_PTR_P): Simplify. (TYPE_PTROB_P): Correct definition. (TYPE_PTR_TO_MEMBER_P): New macro. (TYPE_PTRMEM_CLASS_TYPE): Adjust. (TYPE_PTRMEM_POINTED_TO_TYPE): Likewise. (resolved_scoped_fn_name): Remove declaration. (build_offset_ref): Change prototype. (resolve_offset_ref): Remove. (comp_target_types): Remove. * cvt.c (cp_convert_to_pointer): Rework pointer-to-member handling. (convert_to_reference): Use can_convert. (ocp_convert): Improve error handling. Rework pointer-to-member handling. (perform_qualification_conversions): Rework pointer-to-member handling. * decl.c (build_ptrmem_type): Handle functions too. (create_array_type_for_decl): Remove OFFSET_TYPE error message. (grokdeclarator): Use OFFSET_TYPE for pointers to data members. (grokparms): Remove OFFSET_TYPE error message. * dump.c (cp_dump_tree): Rework pointer-to-member handling. * error.c (dump_type_prefix): Likewise. * expr.c (cplus_expand_constant): Use build_nop. * init.c (build_offset_ref): Add address_p parameter. Fold in necessary bits from resolve_offset_ref. (resolve_offset_ref): Remove. * parser.c (cp_parser_postfix_expression): Remove special case code for OFFSET_TYPE. * pt.c (convert_nontype_argument): Rework pointer-to-member handling. (convert_template_argument): Likewise. (unify): Likewise. (invalid_nontype_parm_type_p): Likewise. (dependent_type_p_r): Likewise. * rtti.c (get_tinfo_decl): Remove OFFSET_TYPE special case. (target_incomplete_p_): Rework pointer-to-member handling. (get_pseudo_ti_init): Likewise. (get_pseudo_ti_desc): Likewise. * semantics.c (finish_qualified_id_expr): Adjust call to build_offset_ref. Remove use of resolve_offset_ref. * tree.c (pod_type_p): Use TYPE_PTR_TO_MEMBER_P. * typeck.c (target_type): Use TYPE_PTRMEM_P. (type_unknown_p): Remove obsolete code about the time before non-dependent expressions were handled correctly. (qualify_type_recursive): Remove. (composite_pointer_type_r): New function. (composite_pointer_type): Use it. (merge_types): Remove dead comments. (comp_cv_target_types): Remove. (comp_target_types): Likewise. (comp_target_parms): Likewise. (cxx_sizeof_or_alignof_type): Remove OFFSET_TYPE error. (build_indirect_ref): Use TYPE_PTR_TO_MEMBER_P. (build_binary_op): Do not use of comp_target_types. (pointer_diff): Remove OFFSET_TYPE case. (build_unary_op): Adjust pointer-to-member handling. (unary_complex_lvalue): Likewise. (check_for_casting_away_constness): Add description parameter. (build_static_cast): Pass it. (build_reinterpret_cast): Use check_for_casting_away_constness. (build_const_cast): Adjust pointer-to-member handling. (build_c_cast): Likewise. (convert_for_assignment): Remove OFFSET_TYPE error message. (comp_ptr_ttypes_real): Adjust pointer-to-member handling. (comp_ptr_ttypes_reinterpret): Remove. (casts_away_constness_r): Adjust pointer-to-member handling. (casts_away_constness): Liekwise. (strip_all_pointer_quals): Remove. * typeck2.c (digest_init): Adjust pointer-to-member handling. (build_m_component_ref): Likewise. From-SVN: r69691
2003-07-23 01:30:22 +02:00
/* The expression is a qualified name whose address is not
being taken. */
expr = build_offset_ref (qualifying_class, expr, /*address_p=*/false);
cp-tree.h (build_scoped_method_call): Remove. * cp-tree.h (build_scoped_method_call): Remove. (lookup_qualified_name): Remove parameter. (tsubst_copy_and_build): Declare. (finish_qualified_object_call_expr): Remove. (check_accessibility_of_qualified_id): New function. (finish_qualified_id_expr): Likewise. (non_reference): Likewise. (build_expr_from-tree): Remove. * call.c (non_reference): Remove. (build_scoped_method_call): Likewise. (build_method_call): Use error_operand_p. Assert that we are not processing a template. (standard_conversion): Use non_reference. * class.c (build_vtbl_entry_ref): Likewise. (build_vtbl_ref_1): Likewise. * cvt.c (build_expr_type_conversion): Use non_reference. * decl.c (lookup_qualified_name): Remove flags parameter. (grok_op_properties): Use non_reference. * decl2.c (grok_array_decl): Likewise. (build_expr_from_tree): Remove. (build_offset_ref_call_from_tree): Update comment. * error.c (parm_to_string): Call reinit_global_formatting_buffer. * except.c (prepare_eh_types): Use non_reference. (can_convert_eh): Likewise. * init.c (build_dtor_call): Avoid using build_method_call. * mangle.c (write_template_param): Remove misleading comment. * method.c (locate_copy): Use non_reference. * parser.c (cp_parser_scope_through_which_access_occurs): Remove. (cp_parser_primary_expression): Do not create SCOPE_REFs is non-dependent contexts. (cp_parser_postfix_expression): Use finish_qualified_id_expr. (cp_parser_direct_declarator): Use tsubst_copy_and_build, not build_expr_from_tree. (cp_parser_lookup_name): Adjust call to lookup_qualified_name. Use check_accessibility_of_qualified_id. * pt.c (maybe_fold_nontype_arg): Use tsubst_copy_and_build, not build_expr_from_tree. (tsubst_baselink): New function. (tsubst_qualified_id): Likewise. (tsubst_copy): Use them. Remove support for METHOD_CALL_EXPR. (tsubst_expr): Adjust call to lookup_qualified_name. (tsubst_copy_and_build): Handle SCOPE_REFs specially. Adjust handling of CALL_EXPRs. (value_dependent_expression_p): Use INTEGRAL_OR_ENUMERATION_TYPE_P. * rtti.c (get_tinfo_decl_dynamic): Use non_reference. * search.c (check_final_overrider): Likewise. * semantics.c (check_accessibility_of_qualified_id): New function. (finish_qualified_object_call_expr): Remove. * typeck.c (target_type): Use non_reference. (cxx_sizeof_or_alignof_type): Likewise. (dubious_conversion_warnings): Likewise. (convert_for_initialization): Likewise. (non_reference): New function. From-SVN: r69063
2003-07-08 03:38:44 +02:00
}
return expr;
}
/* Begin a statement-expression. The value returned must be passed to
finish_stmt_expr. */
tree
begin_stmt_expr (void)
{
cp-tree.def (VEC_INIT_EXPR): Remove. * cp-tree.def (VEC_INIT_EXPR): Remove. * cp-tree.h (struct stmt_tree): New type. (struct saved_scope): Remove firstobj. Add x_saved_tree, x_stmt_tree. (class_cache_firstobj): Remove. (struct language_function): Remove stmts_are_full_exprs_p, x_last_tree, and x_last_expr_type. Add x_stmt_tree. (current_stmt_tree): New macro. (last_tree): Adjust. (last_expr_type): Likewise. (doing_semantic_analysis_p): Simplify. (stmts_are_full_exprs_p): Adjust. (begin_tree): Remove prototype. (end_tree): Likewise. (begin_stmt_tree): Change prototype. (finish_stmt_tree): Likewise. (building_stmt_tree): Simplify. * decl.c (mark_stmt_tree): New function. (mark_saved_scope): Use it. (start_function): Rearrange slightly to call begin_stmt_tree earlier. (save_function_data): Tweak. (finish_function): Adjust call to finish_stmt_tree. (mark_lang_function): Use mark_stmt_tree. * expr.c (cplus_expand_expr): Don't handle VEC_INIT_EXPR. * init.c (build_new_1): Remove creation of VEC_INIT_EXPR. (build_vec_init): Remove creation of stand-in intializer. * pt.c (begin_tree): Remove. (end_tree): Likewise. * semantics.c (SET_LAST_STMT): New macro. Use it throughout. (begin_compound_stmt): Handle a compound-statement outside of a function. (begin_stmt_expr): Handle a statement-expression outsidef of a function. (finish_stmt_expr): Likewise. (begin_class_definition): Don't call begin_tree. (finish_inline_definitions): Don't call end_tree. (begin_stmt_tree): Take a pointer to tree, not a function as input. (finish_stmt_tree): Likewise. * tree.c (search_tree): Don't handle VEC_INIT_EXPR. (mapcar): Likewise. * parse.y (simple_stmt): Don't call finish_stmt unnecessarily. * parse.c: Regenerated. * dump.c (dqueue_and_dump): Dump bitfieldness. From-SVN: r29786
1999-10-03 20:57:37 +02:00
/* If we're outside a function, we won't have a statement-tree to
work with. But, if we see a statement-expression we need to
create one. */
if (! cfun && !last_tree)
cp-tree.def (VEC_INIT_EXPR): Remove. * cp-tree.def (VEC_INIT_EXPR): Remove. * cp-tree.h (struct stmt_tree): New type. (struct saved_scope): Remove firstobj. Add x_saved_tree, x_stmt_tree. (class_cache_firstobj): Remove. (struct language_function): Remove stmts_are_full_exprs_p, x_last_tree, and x_last_expr_type. Add x_stmt_tree. (current_stmt_tree): New macro. (last_tree): Adjust. (last_expr_type): Likewise. (doing_semantic_analysis_p): Simplify. (stmts_are_full_exprs_p): Adjust. (begin_tree): Remove prototype. (end_tree): Likewise. (begin_stmt_tree): Change prototype. (finish_stmt_tree): Likewise. (building_stmt_tree): Simplify. * decl.c (mark_stmt_tree): New function. (mark_saved_scope): Use it. (start_function): Rearrange slightly to call begin_stmt_tree earlier. (save_function_data): Tweak. (finish_function): Adjust call to finish_stmt_tree. (mark_lang_function): Use mark_stmt_tree. * expr.c (cplus_expand_expr): Don't handle VEC_INIT_EXPR. * init.c (build_new_1): Remove creation of VEC_INIT_EXPR. (build_vec_init): Remove creation of stand-in intializer. * pt.c (begin_tree): Remove. (end_tree): Likewise. * semantics.c (SET_LAST_STMT): New macro. Use it throughout. (begin_compound_stmt): Handle a compound-statement outside of a function. (begin_stmt_expr): Handle a statement-expression outsidef of a function. (finish_stmt_expr): Likewise. (begin_class_definition): Don't call begin_tree. (finish_inline_definitions): Don't call end_tree. (begin_stmt_tree): Take a pointer to tree, not a function as input. (finish_stmt_tree): Likewise. * tree.c (search_tree): Don't handle VEC_INIT_EXPR. (mapcar): Likewise. * parse.y (simple_stmt): Don't call finish_stmt unnecessarily. * parse.c: Regenerated. * dump.c (dqueue_and_dump): Dump bitfieldness. From-SVN: r29786
1999-10-03 20:57:37 +02:00
begin_stmt_tree (&scope_chain->x_saved_tree);
last_expr_type = NULL_TREE;
keep_next_level (true);
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
return last_tree;
}
/* Process the final expression of a statement expression. EXPR can be
NULL, if the final expression is empty. Build up a TARGET_EXPR so
that the result value can be safely returned to the enclosing
expression. */
tree
finish_stmt_expr_expr (tree expr)
{
tree result = NULL_TREE;
tree type = void_type_node;
if (expr)
{
type = TREE_TYPE (expr);
if (!processing_template_decl && !VOID_TYPE_P (TREE_TYPE (expr)))
{
if (TREE_CODE (type) == ARRAY_TYPE
|| TREE_CODE (type) == FUNCTION_TYPE)
expr = decay_conversion (expr);
expr = convert_from_reference (expr);
expr = require_complete_type (expr);
/* Build a TARGET_EXPR for this aggregate. finish_stmt_expr
will then pull it apart so the lifetime of the target is
within the scope of the expression containing this statement
expression. */
if (TREE_CODE (expr) == TARGET_EXPR)
;
else if (!IS_AGGR_TYPE (type) || TYPE_HAS_TRIVIAL_INIT_REF (type))
expr = build_target_expr_with_type (expr, type);
else
{
/* Copy construct. */
expr = build_special_member_call
(NULL_TREE, complete_ctor_identifier,
build_tree_list (NULL_TREE, expr),
TYPE_BINFO (type), LOOKUP_NORMAL);
expr = build_cplus_new (type, expr);
my_friendly_assert (TREE_CODE (expr) == TARGET_EXPR, 20030729);
}
}
if (expr != error_mark_node)
{
result = build_stmt (EXPR_STMT, expr);
add_stmt (result);
}
}
finish_stmt ();
/* Remember the last expression so that finish_stmt_expr can pull it
apart. */
last_expr_type = result ? result : void_type_node;
return result;
}
/* Finish a statement-expression. EXPR should be the value returned
by the previous begin_stmt_expr. Returns an expression
representing the statement-expression. */
tree
finish_stmt_expr (tree rtl_expr, bool has_no_scope)
{
tree result;
tree result_stmt = last_expr_type;
tree type;
if (!last_expr_type)
type = void_type_node;
else
{
if (result_stmt == void_type_node)
{
type = void_type_node;
result_stmt = NULL_TREE;
}
else
type = TREE_TYPE (EXPR_STMT_EXPR (result_stmt));
}
result = build_min (STMT_EXPR, type, last_tree);
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
TREE_SIDE_EFFECTS (result) = 1;
STMT_EXPR_NO_SCOPE (result) = has_no_scope;
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
last_expr_type = NULL_TREE;
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
/* Remove the compound statement from the tree structure; it is
now saved in the STMT_EXPR. */
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
2000-09-07 03:36:11 +02:00
last_tree = rtl_expr;
c-common.h (IF_COND): Added documentation. * c-common.h (IF_COND): Added documentation. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (WHILE_COND): Likewise. (WHILE_BODY): Likewise. (DO_COND): Likewise. (DO_BODY): Likewise. (RETURN_EXPR): Likewise. (EXPR_STMT_EXPR): Likewise. (FOR_INIT_STMT): Likewise. (FOR_COND): Likewise. (FOR_EXPR): Likewise. (FOR_BODY): Likewise. (SWITCH_COND): Likewise. (SWITCH_BODY): Likewise. (CASE_LOW): Likewise. (CASE_HIGH): Likewise. (GOTO_DESTINATION): Likewise. (COMPOUND_BODY): Likewise. (ASM_CV_QUAL): Likewise. (ASM_STRING): Likewise. (ASM_OUTPUTS): Likewise. (ASM_INPUTS): Likewise. (ASM_CLOBBERS): Likewise. (DECL_STMT_DECL): Likewise. (STMT_EXPR_STMT): Likewise. (LABEL_STMT_LABEL): Likewise. * c-common.def: Added documenetion for SRCLOC, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT, SCOPE_STMT, CASE_LABEL, STMT_EXPR. * cp/cp-tree.h (genrtl_try_block): Declare function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument. (finish_switch_stmt): Likewise. * cp/semantics.c (genrtl_try_block): Define function. (genrtl_handler): Likewise. (genrtl_catch_block): Likewise. (genrtl_ctor_stmt): Likewise. (genrtl_subobject): Likewise. (genrtl_decl_cleanup): Likewise. (genrtl_do_poplevel): Likewise. (genrtl_do_pushlevel): Likewise. (genrtl_clear_out_block): Likewise. (genrtl_goto_stmt): Likewise. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Likewise. (genrtl_if_stmt): Likewise. (genrtl_while_stmt): Likewise. (genrtl_do_stmt): Likewise. (genrtl_return_stmt): Likewise. (genrtl_for_stmt): Likewise. (genrtl_break_stmt): Likewise. (genrtl_continue_stmt): Likewise. (genrtl_scope_stmt): Likewise. (genrtl_switch_stmt): Likewise. (genrtl_case_label): Likewise. (genrtl_begin_compound_stmt): Likewise. (genrtl_finish_compound_stmt): Likewise. (genrtl_compound_stmt): Likewise. (genrtl_asm_stmt): Likewise. (genrtl_named_return_value): Likewise. (genrtl_begin_stmt_expr): Likewise. (genrtl_finish_stmt_expr): Likewise. (finish_for_stmt): Removed first argument and generate rtl specific code. (finish_switch_stmt): Likewise. (do_poplevel): Removed generate rtl specific code. (do_pushlevel): Likewise. (add_tree): Likewise. (finish_goto_stmt): Likewise. (finish_expr_stmt): Likewise. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (finish_if_stmt): Likewise. (clear_out_block): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (begin_do_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (finish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (begin_switch_stmt): Likewise. (finish_switch_cond): Likewise. (finish_case_label): Likewise. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_cleanup_try_block): Likewise. (finish_cleanup): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (begin_catch_block): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_label_decl): Likewise. (finish_subobject): Likewise. (finish_decl_cleanup): Likewise. (finish_named_return_value): Likewise. (begin_stmt_expr): Likewise. (finish_stmt_expr): Likewise. * cp/decl.c (initialize_local_var): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. * cp/init.c (begin_init_stmts): Changed calls to begin_stmt_expr and begin_compound_expr to call genrtl_begin_stmt_expr and genrtl_begin_compound_expr when appropriate. (finish_init_stmts): Changed calls to finish_compound_expr and finish_stmt_expr to call genrtl_finish_compound_expr and genrtl_finish_stmt_expr when appropriate. (expand_default_init): Changed call to finish_expr_stmt to call genrtl_expr_stmt when appropriate. (build_vec_init): Likewise. * cp/parse.y (simple_stmt): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. * cp/parse.c: Regenerated. * cp/pt.c (tsubst_expr): Removed first argument from call to finish_for_stmt. Removed first argument from call to finish_switch_stmt. From-SVN: r34597
2000-06-19 20:40:24 +02:00
TREE_CHAIN (last_tree) = NULL_TREE;
cp-tree.def (SUBOBJECT): New tree node. * cp-tree.def (SUBOBJECT): New tree node. * cp-tree.h (CLEANUP_P): New macro. (SUBOBJECT_CLEANUP): Likewise. (keep_next_level): Add parameter. (get_temp_regvar): Don't declare. (emit_base_init): Remove parameter. (expand_aggr_init): Rename to build_aggr_init. (expand_vec_init): Rename to build_vec_init. (do_pushlevel): Remove. (do_poplevel): Likewise. (finish_cleanup): New function. (finish_subobject): Likewise. (stmts_are_full_exprs_p): New variable. * decl.c (keep_next_level): Add parameter. (cp_finish_decl): Use build_aggr_init, not expand_aggr_init. Use finish_expr_stmt to expand the code. (expand_static_init): Use tree-generating, not RTL-generating, functions to handle the initialization. (start_function): Remove dead code. Always have a momentary obstack inside the function, even before hitting the first curly brace. (cplus_expand_expr_stmt): Move calls to expand_{start,end}_target_temps into semantics.c. (cp_function): Add stmts_are_full_exprs_p. (push_cp_function_context): Save it. (pop_cp_function_context): Restore it. * decl2.c (get_temp_regvar): Move to init.c. (do_static_initialization): Use build_{aggr,vec}_init. (do_static_destruction): Fix typo in comment. * dump.c (dequeue_and_dump): Handle INIT_EXPR. * except.c (expand_throw): Use create_temporary_var. * expr.c (cplus_expand_expr): Use build_{aggr,vec}_init. * init.c (expand_vec_init_try_block): Remove. (expand_vec_init_catch_clause): Likewise. (get_temp_regvar): New function. (begin_init_stmts): Likewise. (finish_init_stmts): Likewise. (perform_member_init): Use build_{aggr,vec}_init. Build up tree structure here. (emit_base_init): Likewise. Remove unused parameter. (expand_virtual_init): Likewise. (expand_cleanup_for_base): Use finish_subobject. (expand_aggr_vbase_init_1): Simplify. (construct_virtual_bases): Use tree-generating functions to build up initialization. (expand_aggr_init): Likewise. Rename to build_aggr_init. (expand_default_init): Likewise. (expand_aggr_init_1): Likewise. (expand_vec_init): Rename to build_vec_init. * method.c (do_build_copy_constructor): Use tree-generating functions. Don't call clear_last_expr. (do_build_assign_ref): Likewise. (synthesize_method): Call clear_last_expr here. * parse.y (base_init): Don't call clear_last_expr here. (nodecls): Likewise. * pt.c (tsubst_expr): Handle a TRY_BLOCK with CLEANUP_P set. * semantics.c (do_pushlevel): Move to here. (do_poplevel): Likewise. (stmts_are_full_exprs_p): New variable. (finish_expr_stmt): Handle logic for temoprary cleanup here. (finish_for_stmt): Use finish_expr_stmt. (finish_cleanup): New function. (finish_function_try_block): Fix indentation. (finish_subobject): New function. (setup_vtbl_ptr): Call keep_next_level here. (finish_stmt_expr): Handle a block with no scope inside the statement-expression. (expand_stmt): Handle a TRY_BLOCK with CLEANUP_P set. Handle SUBOBJECT. * tree.c (search_tree): Handle INIT_EXPR. (mapcar): Likewise. * typeck.c (build_modify_expr): Don't build an RTL_EXPR. * typeck2.c (store_init_value): Change expand_aggr_init to build_aggr_init in comment. From-SVN: r28878
1999-08-26 00:07:18 +02:00
cp-tree.def (VEC_INIT_EXPR): Remove. * cp-tree.def (VEC_INIT_EXPR): Remove. * cp-tree.h (struct stmt_tree): New type. (struct saved_scope): Remove firstobj. Add x_saved_tree, x_stmt_tree. (class_cache_firstobj): Remove. (struct language_function): Remove stmts_are_full_exprs_p, x_last_tree, and x_last_expr_type. Add x_stmt_tree. (current_stmt_tree): New macro. (last_tree): Adjust. (last_expr_type): Likewise. (doing_semantic_analysis_p): Simplify. (stmts_are_full_exprs_p): Adjust. (begin_tree): Remove prototype. (end_tree): Likewise. (begin_stmt_tree): Change prototype. (finish_stmt_tree): Likewise. (building_stmt_tree): Simplify. * decl.c (mark_stmt_tree): New function. (mark_saved_scope): Use it. (start_function): Rearrange slightly to call begin_stmt_tree earlier. (save_function_data): Tweak. (finish_function): Adjust call to finish_stmt_tree. (mark_lang_function): Use mark_stmt_tree. * expr.c (cplus_expand_expr): Don't handle VEC_INIT_EXPR. * init.c (build_new_1): Remove creation of VEC_INIT_EXPR. (build_vec_init): Remove creation of stand-in intializer. * pt.c (begin_tree): Remove. (end_tree): Likewise. * semantics.c (SET_LAST_STMT): New macro. Use it throughout. (begin_compound_stmt): Handle a compound-statement outside of a function. (begin_stmt_expr): Handle a statement-expression outsidef of a function. (finish_stmt_expr): Likewise. (begin_class_definition): Don't call begin_tree. (finish_inline_definitions): Don't call end_tree. (begin_stmt_tree): Take a pointer to tree, not a function as input. (finish_stmt_tree): Likewise. * tree.c (search_tree): Don't handle VEC_INIT_EXPR. (mapcar): Likewise. * parse.y (simple_stmt): Don't call finish_stmt unnecessarily. * parse.c: Regenerated. * dump.c (dqueue_and_dump): Dump bitfieldness. From-SVN: r29786
1999-10-03 20:57:37 +02:00
/* If we created a statement-tree for this statement-expression,
remove it now. */
if (! cfun
cp-tree.def (VEC_INIT_EXPR): Remove. * cp-tree.def (VEC_INIT_EXPR): Remove. * cp-tree.h (struct stmt_tree): New type. (struct saved_scope): Remove firstobj. Add x_saved_tree, x_stmt_tree. (class_cache_firstobj): Remove. (struct language_function): Remove stmts_are_full_exprs_p, x_last_tree, and x_last_expr_type. Add x_stmt_tree. (current_stmt_tree): New macro. (last_tree): Adjust. (last_expr_type): Likewise. (doing_semantic_analysis_p): Simplify. (stmts_are_full_exprs_p): Adjust. (begin_tree): Remove prototype. (end_tree): Likewise. (begin_stmt_tree): Change prototype. (finish_stmt_tree): Likewise. (building_stmt_tree): Simplify. * decl.c (mark_stmt_tree): New function. (mark_saved_scope): Use it. (start_function): Rearrange slightly to call begin_stmt_tree earlier. (save_function_data): Tweak. (finish_function): Adjust call to finish_stmt_tree. (mark_lang_function): Use mark_stmt_tree. * expr.c (cplus_expand_expr): Don't handle VEC_INIT_EXPR. * init.c (build_new_1): Remove creation of VEC_INIT_EXPR. (build_vec_init): Remove creation of stand-in intializer. * pt.c (begin_tree): Remove. (end_tree): Likewise. * semantics.c (SET_LAST_STMT): New macro. Use it throughout. (begin_compound_stmt): Handle a compound-statement outside of a function. (begin_stmt_expr): Handle a statement-expression outsidef of a function. (finish_stmt_expr): Likewise. (begin_class_definition): Don't call begin_tree. (finish_inline_definitions): Don't call end_tree. (begin_stmt_tree): Take a pointer to tree, not a function as input. (finish_stmt_tree): Likewise. * tree.c (search_tree): Don't handle VEC_INIT_EXPR. (mapcar): Likewise. * parse.y (simple_stmt): Don't call finish_stmt unnecessarily. * parse.c: Regenerated. * dump.c (dqueue_and_dump): Dump bitfieldness. From-SVN: r29786
1999-10-03 20:57:37 +02:00
&& TREE_CHAIN (scope_chain->x_saved_tree) == NULL_TREE)
finish_stmt_tree (&scope_chain->x_saved_tree);
if (processing_template_decl)
return result;
if (!VOID_TYPE_P (type))
{
/* Pull out the TARGET_EXPR that is the final expression. Put
the target's init_expr as the final expression and then put
the statement expression itself as the target's init
expr. Finally, return the target expression. */
tree last_expr = EXPR_STMT_EXPR (result_stmt);
my_friendly_assert (TREE_CODE (last_expr) == TARGET_EXPR, 20030729);
EXPR_STMT_EXPR (result_stmt) = TREE_OPERAND (last_expr, 1);
TREE_OPERAND (last_expr, 1) = result;
result = last_expr;
}
return result;
}
re PR c++/11493 (tree check ICE in error.c) * cp-tree.h (cp_id_kind): New type. (unqualified_name_lookup_error): Change prototype. (unqualified_fn_lookup_error): New function. (do_identifier): Remove. (do_scoped_id): Likewise. (tsubst_copy_and_build): Change prototype. (reregister_specialization): New function. (perform_koenig_lookup): Likewise. (finish_id_expression): Likewise. * call.c (build_method_call): Adjust call to unqualified_name_lookup_error. * decl.c (duplicate_decls): Use reregister_specialization. * lex.c (is_global): Remove. (unqualified_name_lookup_error): Return a value. (do_identifier): Remove. (do_scoped_id): Likewise. (identifier_typedecl_value): Remove. (unqualified_fn_lookup_error): New function. * parser.c (cp_parser_id_kind): Remove. (cp_parser_non_constant_id_expression): Remove. (cp_parser_primary_expression): Use finish_id_expression. (cp_parser_class_or_namespace_name): Use cp_id_kind, not cp_parser_id_kind. (cp_parser_postfix_expression): Use perform_koenig_lookup. (cp_parser_template_argument): Use cp_id_kind. (cp_parser_fold_non_dependent_expr): Adjust call to tsubst_copy_and_build. * pt.c (unregister_specialization): Rename to ... (reregister_specialization): This. (tsubst_friend_function): Use it. (maybe_fold_nontype_arg): Adjust call to tsubst_copy_and_build. (tsubst_qualified_id): Likewise. (tsubst_expr): Likewise. (tsubst_copy_and_build): Add function_p parameter. Use finish_id_expression. Introduce RECUR macro. (tsubst_non_call_postfix_expression): New function. (regenerate_decl_from_template): Use reregister_specialization. * semantics.c (perform_koenig_lookup): New function. (finish_id_expression): Likewise. PR c++/11493 PR c++/11495 * g++.dg/parse/template9.C: Likewise. * g++.dg/template/crash4.C: New test. * g++.dg/template/koenig1.C: Likewise. * g++.old-deja/g++.benjamin/tem03.C: Adjust error markers. * g++.old-deja/g++.benjamin/tem06.C: Declare "x". * g++.old-deja/g++.jason/overload33.C: Use this-> when calling functions. * g++.old-deja/g++.jason/template36.C: Likewise. * g++.old-deja/g++.mike/p1989.C: Likewise. * g++.old-deja/g++.pt/lookup2.C: Use -fpermissive when compiling. * g++.old-deja/g++.pt/ttp20.C: Use this->. * g++.old-deja/g++.pt/ttp21.C: Use this->. * g++.old-deja/g++.pt/typename13.C: Use -fpermissive when compiling. * g++.old-deja/g++.pt/union2.C: Use this->. From-SVN: r69316
2003-07-14 05:04:29 +02:00
/* Perform Koenig lookup. FN is the postfix-expression representing
the function (or functions) to call; ARGS are the arguments to the
call. Returns the functions to be considered by overload
resolution. */
re PR c++/11493 (tree check ICE in error.c) * cp-tree.h (cp_id_kind): New type. (unqualified_name_lookup_error): Change prototype. (unqualified_fn_lookup_error): New function. (do_identifier): Remove. (do_scoped_id): Likewise. (tsubst_copy_and_build): Change prototype. (reregister_specialization): New function. (perform_koenig_lookup): Likewise. (finish_id_expression): Likewise. * call.c (build_method_call): Adjust call to unqualified_name_lookup_error. * decl.c (duplicate_decls): Use reregister_specialization. * lex.c (is_global): Remove. (unqualified_name_lookup_error): Return a value. (do_identifier): Remove. (do_scoped_id): Likewise. (identifier_typedecl_value): Remove. (unqualified_fn_lookup_error): New function. * parser.c (cp_parser_id_kind): Remove. (cp_parser_non_constant_id_expression): Remove. (cp_parser_primary_expression): Use finish_id_expression. (cp_parser_class_or_namespace_name): Use cp_id_kind, not cp_parser_id_kind. (cp_parser_postfix_expression): Use perform_koenig_lookup. (cp_parser_template_argument): Use cp_id_kind. (cp_parser_fold_non_dependent_expr): Adjust call to tsubst_copy_and_build. * pt.c (unregister_specialization): Rename to ... (reregister_specialization): This. (tsubst_friend_function): Use it. (maybe_fold_nontype_arg): Adjust call to tsubst_copy_and_build. (tsubst_qualified_id): Likewise. (tsubst_expr): Likewise. (tsubst_copy_and_build): Add function_p parameter. Use finish_id_expression. Introduce RECUR macro. (tsubst_non_call_postfix_expression): New function. (regenerate_decl_from_template): Use reregister_specialization. * semantics.c (perform_koenig_lookup): New function. (finish_id_expression): Likewise. PR c++/11493 PR c++/11495 * g++.dg/parse/template9.C: Likewise. * g++.dg/template/crash4.C: New test. * g++.dg/template/koenig1.C: Likewise. * g++.old-deja/g++.benjamin/tem03.C: Adjust error markers. * g++.old-deja/g++.benjamin/tem06.C: Declare "x". * g++.old-deja/g++.jason/overload33.C: Use this-> when calling functions. * g++.old-deja/g++.jason/template36.C: Likewise. * g++.old-deja/g++.mike/p1989.C: Likewise. * g++.old-deja/g++.pt/lookup2.C: Use -fpermissive when compiling. * g++.old-deja/g++.pt/ttp20.C: Use this->. * g++.old-deja/g++.pt/ttp21.C: Use this->. * g++.old-deja/g++.pt/typename13.C: Use -fpermissive when compiling. * g++.old-deja/g++.pt/union2.C: Use this->. From-SVN: r69316
2003-07-14 05:04:29 +02:00
tree
perform_koenig_lookup (tree fn, tree args)
{
tree identifier = NULL_TREE;
tree functions = NULL_TREE;
/* Find the name of the overloaded function. */
if (TREE_CODE (fn) == IDENTIFIER_NODE)
identifier = fn;
else if (is_overloaded_fn (fn))
{
functions = fn;
identifier = DECL_NAME (get_first_fn (functions));
}
else if (DECL_P (fn))
{
functions = fn;
identifier = DECL_NAME (fn);
}
/* A call to a namespace-scope function using an unqualified name.
Do Koenig lookup -- unless any of the arguments are
type-dependent. */
if (!any_type_dependent_arguments_p (args))
{
fn = lookup_arg_dependent (identifier, functions, args);
if (!fn)
/* The unqualified name could not be resolved. */
fn = unqualified_fn_lookup_error (identifier);
}
else
fn = identifier;
re PR c++/11493 (tree check ICE in error.c) * cp-tree.h (cp_id_kind): New type. (unqualified_name_lookup_error): Change prototype. (unqualified_fn_lookup_error): New function. (do_identifier): Remove. (do_scoped_id): Likewise. (tsubst_copy_and_build): Change prototype. (reregister_specialization): New function. (perform_koenig_lookup): Likewise. (finish_id_expression): Likewise. * call.c (build_method_call): Adjust call to unqualified_name_lookup_error. * decl.c (duplicate_decls): Use reregister_specialization. * lex.c (is_global): Remove. (unqualified_name_lookup_error): Return a value. (do_identifier): Remove. (do_scoped_id): Likewise. (identifier_typedecl_value): Remove. (unqualified_fn_lookup_error): New function. * parser.c (cp_parser_id_kind): Remove. (cp_parser_non_constant_id_expression): Remove. (cp_parser_primary_expression): Use finish_id_expression. (cp_parser_class_or_namespace_name): Use cp_id_kind, not cp_parser_id_kind. (cp_parser_postfix_expression): Use perform_koenig_lookup. (cp_parser_template_argument): Use cp_id_kind. (cp_parser_fold_non_dependent_expr): Adjust call to tsubst_copy_and_build. * pt.c (unregister_specialization): Rename to ... (reregister_specialization): This. (tsubst_friend_function): Use it. (maybe_fold_nontype_arg): Adjust call to tsubst_copy_and_build. (tsubst_qualified_id): Likewise. (tsubst_expr): Likewise. (tsubst_copy_and_build): Add function_p parameter. Use finish_id_expression. Introduce RECUR macro. (tsubst_non_call_postfix_expression): New function. (regenerate_decl_from_template): Use reregister_specialization. * semantics.c (perform_koenig_lookup): New function. (finish_id_expression): Likewise. PR c++/11493 PR c++/11495 * g++.dg/parse/template9.C: Likewise. * g++.dg/template/crash4.C: New test. * g++.dg/template/koenig1.C: Likewise. * g++.old-deja/g++.benjamin/tem03.C: Adjust error markers. * g++.old-deja/g++.benjamin/tem06.C: Declare "x". * g++.old-deja/g++.jason/overload33.C: Use this-> when calling functions. * g++.old-deja/g++.jason/template36.C: Likewise. * g++.old-deja/g++.mike/p1989.C: Likewise. * g++.old-deja/g++.pt/lookup2.C: Use -fpermissive when compiling. * g++.old-deja/g++.pt/ttp20.C: Use this->. * g++.old-deja/g++.pt/ttp21.C: Use this->. * g++.old-deja/g++.pt/typename13.C: Use -fpermissive when compiling. * g++.old-deja/g++.pt/union2.C: Use this->. From-SVN: r69316
2003-07-14 05:04:29 +02:00
return fn;
}
call.c (build_field_call): Do not look up the field by name. * call.c (build_field_call): Do not look up the field by name. (build_method_call): Simplify. (struct z_candidate): Add access_path and conversion_path. Remove basetype_path. (convert_class_to_reference): Adjust use of add_function_candidate. (add_candidate): Add conversion_path argument. (add_function_candidate): Use it. (add_conv_dndidate): Likewise. (build_builtin_candidate): Likewise. (add_template_candidate_real): Add conversion_path argument. (add_template_conv_candidate): Likewise. (add_template_candidate): Likewise. (build_user_type_conversion_1): Use it. (build_new_function_call): Remove name lookup code. Adjust use of add_template_candidate and add_function_candidate. (build_new_op): Likewise. (convert_like_real): Use build_special_member_call. (build_over_call): Use cand->conversion_path. (build_special_member_call): New method. (build_new_method_call): Remove name lookup code. * cp-tree.def (OFFSET_REF): Update documentation. (TEMPLATE_ID_EXPR): Likewise. * cp-tree.h (BASELINK_ACCESS_BINFO): New macro. (BASELINK_OPTYPE): Likewise. (build_new_method_call): Adjust prototype. (build_special_member_call): New method. (build_baselink): New method. (build_offset_ref_call_from_tree): Likewise. (build_call_from_tree): Likewise. (finish_qualified_call_expr): Remove. (finish_call_expr): Adjust prototype. (build_x_function_call): Remove. * cvt.c (ocp_convert): Use build_special_member_call. * decl2.c (reparse_absdcl_as_expr): Use finish_call_expr. (build_expr_from_tree): Adjust handling for TEMPLATE_ID_EXPR and CALL_EXPR. (build_offset_ref_call_from_tree): New function. (build_call_from_tree): Likewise. * init.c (expand_cleanup): Use build_special_member_call. (expand_default_init): Likewise. (build_member_call): Use finish_call_expr. (build_new_1): Use build_special_member_call. (push_base_cleanups): Likewise. * method.c (do_build_assign_ref): Likewise. * parse.y (template_id): Do not pass a COMPONENT_REF to lookup_template_function. (primary): Use parse_finish_call_epxr, not finish_call_expr. (parse_finish_call_expr): New function. * pt.c (lookup_template_function): Add assertions. * search.c (lookup_base): Allow T to be a binfo. (build_baselink): New function. (lookup_member): Use it. * semantics.c (finish_call_expr): Do not do name lookup. (finish_object_call_expr): Remove #if 0'd code. (finish_qualified_call_expr): Remove. * typeck.c (build_x_function_call): Remove. (build_static_case): Use build_special_member_call. * typeck2.c (build_functional_cast): Likewise. * g++.dg/inherit/operator1.C: New test. * g++.dg/lookup/disamb1.C: Fix typo in comment. * g++.dg/other/error1.C: Change expected error message. * g++.dg/template/conv4.C: Likewise. From-SVN: r55920
2002-08-01 06:46:23 +02:00
/* Generate an expression for `FN (ARGS)'.
If DISALLOW_VIRTUAL is true, the call to FN will be not generated
as a virtual call, even if FN is virtual. (This flag is set when
encountering an expression where the function name is explicitly
qualified. For example a call to `X::f' never generates a virtual
call.)
Returns code for the call. */
tree
finish_call_expr (tree fn, tree args, bool disallow_virtual, bool koenig_p)
{
fold-const.c (make_range): Do not access operand 1 for a zero-operand operator. * fold-const.c (make_range): Do not access operand 1 for a zero-operand operator. 2003-07-08 Mark Mitchell <mark@codesourcery.com> * cp-tree.def (NON_DEPENDENT_EXPR): New node. * cp-tree.h (build_call_from_tree): Remove. (build_member_call): Likewise. (dependent_template_arg_p): Remove. (any_dependent_template_arguments_p): New function. (dependent_template_id_p): Likewise. (any_type_dependent_arguments_p): Likewise. (build_non_dependent_expr): Likewise. (build_non_dependent_args): Likewise. (build_x_compound_expr): Adjust prototype. * call.c (build_new_method_call): Handle non-dependent expressions correctly. * decl2.c (grok_array_decl): Likewise. (build_offset_ref_call_from_tree): Likewise. (build_call_from_tree): Remove. * error.c (dump_decl): Handle NON_DEPENDENT_EXPR. (dump_expr): Likewise. * init.c (build_member_call): Remove. * mangle.c (write_expression): Update handling for template-ids. * parser.c (cp_parser_primary_expression): Use any_dependent_template_arguments_p. Update constant-expression handling. (cp_parser_postfix_expression): Use any_type_dependent_arguments_p. Simplify call processing. (cp_parser_unary_expression): Simplify. (cp_parser_expression): Adjust for changes to build_x_compound_expr. (cp_parser_template_argument): Implement standard-conforming parsing of non-type template arguments. (cp_parser_direct_declarator): Use cp_parser_fold_non_dependent_expr. (cp_parser_fold_non_dependent_expr): New function. (cp_parser_next_token_ends_template_argument_p): Likewise. * pt.c (convert_template_argument): Do not call maybe_fold_nontype_arg. (tsubst_baselink): Likewise. (tsubst_copy_and_build): Share common code. Make sizeof/alignof processing work correctly for non-dependent expressions. Adjust handling of COMPOUND_EXPR. Simplify call processing. (value_dependent_expression_p): Deal with functional casts and sizeof/alignof correctly. (type_dependent_expression_p): Handle overloaded functions. (any_type_dependent_arguments_p): New function. (any_dependent_template_arguments_p): Likewise. (dependent_template_p): Treat SCOPE_REFs as dependent. (dependent_template_id_p): Simplify. (build_non_dependent_expr): New function. (build_non_dependent_args): Likewise. * semantics.c (finish_stmt_expr): Don't make dependent statement-expresions have void type. (finish_call_expr): Handle non-dependent expressions correctly. * tree.c (lvalue_p_1): Treat NON_DEPENDENT_EXPRs as lvalues. * typeck.c (cxx_sizeof_or_alignof_type): Give the expression type size_t, even in templates. (expr_sizeof): Likewise. (finish_class_member_access_expr): Handle non-dependent expressions correctly. (build_x_indirect_ref): Likewise. (build_x_binary_op): Likewise. (build_x_unary_op): Likewise. (build_x_conditional_expr): Likewise. (build_x_compound_expr): Likewise. * typeck2.c (build_x_arrow): Likewise. 2003-07-08 Mark Mitchell <mark@codesourcery.com> * g++.dg/abi/mangle17.C: Make sure template expressions are dependent. * g++.dg/abi/mangle4.C: Mark erroneous casts. * g++.dg/debug/debug7.C: Mark erronous new-declarator. * g++.dg/opt/stack1.C: Remove erroneous code. * g++.dg/parse/template7.C: New test. * g++.dg/template/dependent-expr1.C: Mark erroneous code. * g++.old-deja/g++.pt/crash4.C: Likewise. 2003-07-09 Mark Mitchell <mark@codesourcery.com> * gcj/array.h (JvPrimClass): Don't parenthesize the output. From-SVN: r69130
2003-07-09 10:48:08 +02:00
tree result;
tree orig_fn;
tree orig_args;
call.c (build_field_call): Do not look up the field by name. * call.c (build_field_call): Do not look up the field by name. (build_method_call): Simplify. (struct z_candidate): Add access_path and conversion_path. Remove basetype_path. (convert_class_to_reference): Adjust use of add_function_candidate. (add_candidate): Add conversion_path argument. (add_function_candidate): Use it. (add_conv_dndidate): Likewise. (build_builtin_candidate): Likewise. (add_template_candidate_real): Add conversion_path argument. (add_template_conv_candidate): Likewise. (add_template_candidate): Likewise. (build_user_type_conversion_1): Use it. (build_new_function_call): Remove name lookup code. Adjust use of add_template_candidate and add_function_candidate. (build_new_op): Likewise. (convert_like_real): Use build_special_member_call. (build_over_call): Use cand->conversion_path. (build_special_member_call): New method. (build_new_method_call): Remove name lookup code. * cp-tree.def (OFFSET_REF): Update documentation. (TEMPLATE_ID_EXPR): Likewise. * cp-tree.h (BASELINK_ACCESS_BINFO): New macro. (BASELINK_OPTYPE): Likewise. (build_new_method_call): Adjust prototype. (build_special_member_call): New method. (build_baselink): New method. (build_offset_ref_call_from_tree): Likewise. (build_call_from_tree): Likewise. (finish_qualified_call_expr): Remove. (finish_call_expr): Adjust prototype. (build_x_function_call): Remove. * cvt.c (ocp_convert): Use build_special_member_call. * decl2.c (reparse_absdcl_as_expr): Use finish_call_expr. (build_expr_from_tree): Adjust handling for TEMPLATE_ID_EXPR and CALL_EXPR. (build_offset_ref_call_from_tree): New function. (build_call_from_tree): Likewise. * init.c (expand_cleanup): Use build_special_member_call. (expand_default_init): Likewise. (build_member_call): Use finish_call_expr. (build_new_1): Use build_special_member_call. (push_base_cleanups): Likewise. * method.c (do_build_assign_ref): Likewise. * parse.y (template_id): Do not pass a COMPONENT_REF to lookup_template_function. (primary): Use parse_finish_call_epxr, not finish_call_expr. (parse_finish_call_expr): New function. * pt.c (lookup_template_function): Add assertions. * search.c (lookup_base): Allow T to be a binfo. (build_baselink): New function. (lookup_member): Use it. * semantics.c (finish_call_expr): Do not do name lookup. (finish_object_call_expr): Remove #if 0'd code. (finish_qualified_call_expr): Remove. * typeck.c (build_x_function_call): Remove. (build_static_case): Use build_special_member_call. * typeck2.c (build_functional_cast): Likewise. * g++.dg/inherit/operator1.C: New test. * g++.dg/lookup/disamb1.C: Fix typo in comment. * g++.dg/other/error1.C: Change expected error message. * g++.dg/template/conv4.C: Likewise. From-SVN: r55920
2002-08-01 06:46:23 +02:00
if (fn == error_mark_node || args == error_mark_node)
return error_mark_node;
/* ARGS should be a list of arguments. */
my_friendly_assert (!args || TREE_CODE (args) == TREE_LIST,
20020712);
fold-const.c (make_range): Do not access operand 1 for a zero-operand operator. * fold-const.c (make_range): Do not access operand 1 for a zero-operand operator. 2003-07-08 Mark Mitchell <mark@codesourcery.com> * cp-tree.def (NON_DEPENDENT_EXPR): New node. * cp-tree.h (build_call_from_tree): Remove. (build_member_call): Likewise. (dependent_template_arg_p): Remove. (any_dependent_template_arguments_p): New function. (dependent_template_id_p): Likewise. (any_type_dependent_arguments_p): Likewise. (build_non_dependent_expr): Likewise. (build_non_dependent_args): Likewise. (build_x_compound_expr): Adjust prototype. * call.c (build_new_method_call): Handle non-dependent expressions correctly. * decl2.c (grok_array_decl): Likewise. (build_offset_ref_call_from_tree): Likewise. (build_call_from_tree): Remove. * error.c (dump_decl): Handle NON_DEPENDENT_EXPR. (dump_expr): Likewise. * init.c (build_member_call): Remove. * mangle.c (write_expression): Update handling for template-ids. * parser.c (cp_parser_primary_expression): Use any_dependent_template_arguments_p. Update constant-expression handling. (cp_parser_postfix_expression): Use any_type_dependent_arguments_p. Simplify call processing. (cp_parser_unary_expression): Simplify. (cp_parser_expression): Adjust for changes to build_x_compound_expr. (cp_parser_template_argument): Implement standard-conforming parsing of non-type template arguments. (cp_parser_direct_declarator): Use cp_parser_fold_non_dependent_expr. (cp_parser_fold_non_dependent_expr): New function. (cp_parser_next_token_ends_template_argument_p): Likewise. * pt.c (convert_template_argument): Do not call maybe_fold_nontype_arg. (tsubst_baselink): Likewise. (tsubst_copy_and_build): Share common code. Make sizeof/alignof processing work correctly for non-dependent expressions. Adjust handling of COMPOUND_EXPR. Simplify call processing. (value_dependent_expression_p): Deal with functional casts and sizeof/alignof correctly. (type_dependent_expression_p): Handle overloaded functions. (any_type_dependent_arguments_p): New function. (any_dependent_template_arguments_p): Likewise. (dependent_template_p): Treat SCOPE_REFs as dependent. (dependent_template_id_p): Simplify. (build_non_dependent_expr): New function. (build_non_dependent_args): Likewise. * semantics.c (finish_stmt_expr): Don't make dependent statement-expresions have void type. (finish_call_expr): Handle non-dependent expressions correctly. * tree.c (lvalue_p_1): Treat NON_DEPENDENT_EXPRs as lvalues. * typeck.c (cxx_sizeof_or_alignof_type): Give the expression type size_t, even in templates. (expr_sizeof): Likewise. (finish_class_member_access_expr): Handle non-dependent expressions correctly. (build_x_indirect_ref): Likewise. (build_x_binary_op): Likewise. (build_x_unary_op): Likewise. (build_x_conditional_expr): Likewise. (build_x_compound_expr): Likewise. * typeck2.c (build_x_arrow): Likewise. 2003-07-08 Mark Mitchell <mark@codesourcery.com> * g++.dg/abi/mangle17.C: Make sure template expressions are dependent. * g++.dg/abi/mangle4.C: Mark erroneous casts. * g++.dg/debug/debug7.C: Mark erronous new-declarator. * g++.dg/opt/stack1.C: Remove erroneous code. * g++.dg/parse/template7.C: New test. * g++.dg/template/dependent-expr1.C: Mark erroneous code. * g++.old-deja/g++.pt/crash4.C: Likewise. 2003-07-09 Mark Mitchell <mark@codesourcery.com> * gcj/array.h (JvPrimClass): Don't parenthesize the output. From-SVN: r69130
2003-07-09 10:48:08 +02:00
orig_fn = fn;
orig_args = args;
if (processing_template_decl)
{
if (type_dependent_expression_p (fn)
|| any_type_dependent_arguments_p (args))
{
result = build_nt (CALL_EXPR, fn, args);
KOENIG_LOOKUP_P (result) = koenig_p;
return result;
}
fold-const.c (make_range): Do not access operand 1 for a zero-operand operator. * fold-const.c (make_range): Do not access operand 1 for a zero-operand operator. 2003-07-08 Mark Mitchell <mark@codesourcery.com> * cp-tree.def (NON_DEPENDENT_EXPR): New node. * cp-tree.h (build_call_from_tree): Remove. (build_member_call): Likewise. (dependent_template_arg_p): Remove. (any_dependent_template_arguments_p): New function. (dependent_template_id_p): Likewise. (any_type_dependent_arguments_p): Likewise. (build_non_dependent_expr): Likewise. (build_non_dependent_args): Likewise. (build_x_compound_expr): Adjust prototype. * call.c (build_new_method_call): Handle non-dependent expressions correctly. * decl2.c (grok_array_decl): Likewise. (build_offset_ref_call_from_tree): Likewise. (build_call_from_tree): Remove. * error.c (dump_decl): Handle NON_DEPENDENT_EXPR. (dump_expr): Likewise. * init.c (build_member_call): Remove. * mangle.c (write_expression): Update handling for template-ids. * parser.c (cp_parser_primary_expression): Use any_dependent_template_arguments_p. Update constant-expression handling. (cp_parser_postfix_expression): Use any_type_dependent_arguments_p. Simplify call processing. (cp_parser_unary_expression): Simplify. (cp_parser_expression): Adjust for changes to build_x_compound_expr. (cp_parser_template_argument): Implement standard-conforming parsing of non-type template arguments. (cp_parser_direct_declarator): Use cp_parser_fold_non_dependent_expr. (cp_parser_fold_non_dependent_expr): New function. (cp_parser_next_token_ends_template_argument_p): Likewise. * pt.c (convert_template_argument): Do not call maybe_fold_nontype_arg. (tsubst_baselink): Likewise. (tsubst_copy_and_build): Share common code. Make sizeof/alignof processing work correctly for non-dependent expressions. Adjust handling of COMPOUND_EXPR. Simplify call processing. (value_dependent_expression_p): Deal with functional casts and sizeof/alignof correctly. (type_dependent_expression_p): Handle overloaded functions. (any_type_dependent_arguments_p): New function. (any_dependent_template_arguments_p): Likewise. (dependent_template_p): Treat SCOPE_REFs as dependent. (dependent_template_id_p): Simplify. (build_non_dependent_expr): New function. (build_non_dependent_args): Likewise. * semantics.c (finish_stmt_expr): Don't make dependent statement-expresions have void type. (finish_call_expr): Handle non-dependent expressions correctly. * tree.c (lvalue_p_1): Treat NON_DEPENDENT_EXPRs as lvalues. * typeck.c (cxx_sizeof_or_alignof_type): Give the expression type size_t, even in templates. (expr_sizeof): Likewise. (finish_class_member_access_expr): Handle non-dependent expressions correctly. (build_x_indirect_ref): Likewise. (build_x_binary_op): Likewise. (build_x_unary_op): Likewise. (build_x_conditional_expr): Likewise. (build_x_compound_expr): Likewise. * typeck2.c (build_x_arrow): Likewise. 2003-07-08 Mark Mitchell <mark@codesourcery.com> * g++.dg/abi/mangle17.C: Make sure template expressions are dependent. * g++.dg/abi/mangle4.C: Mark erroneous casts. * g++.dg/debug/debug7.C: Mark erronous new-declarator. * g++.dg/opt/stack1.C: Remove erroneous code. * g++.dg/parse/template7.C: New test. * g++.dg/template/dependent-expr1.C: Mark erroneous code. * g++.old-deja/g++.pt/crash4.C: Likewise. 2003-07-09 Mark Mitchell <mark@codesourcery.com> * gcj/array.h (JvPrimClass): Don't parenthesize the output. From-SVN: r69130
2003-07-09 10:48:08 +02:00
if (!BASELINK_P (fn)
&& TREE_CODE (fn) != PSEUDO_DTOR_EXPR
&& TREE_TYPE (fn) != unknown_type_node)
fn = build_non_dependent_expr (fn);
args = build_non_dependent_args (orig_args);
}
Make-lang.in (po-generated): Remove parse.c. * Make-lang.in (po-generated): Remove parse.c. (CXX_OBJS): Remove parse.o and spew.o. Add parser.o. ($(srcdir)/cp/parse.h): Remove target. ($(srcdir)/cp/parse.c): Likewise. (gt-cp-parse.h): Likewise. (gt-cp-parser.h): New target. (c++.distclean): Do not remove parse.output. (c++.maintainer-clean): Do not remove parse.c or parse.h. (cp/spew.o): Remove target. (cp/lex.o): Adjust dependencies. (cp/pt.o): Likewise. (cp/parse.o): Likewise. (cp/TAGS): Do not mention parse.c. (cp/parser.o): New target. * NEWS: Mention the new parser. * call.c (build_scoped_method_call): Simplify. (build_method_call): Likewise. (build_new_function_call): Adjust calls to add_function_candidate and add_template_candidate. (build_new_op): Improve handling of erroroneous operands. (convert_default_arg): Remove circular argument processing. (name_as_c_string): New function. (build_new_method_call): Use it. (perform_implicit_conversion): Use error_operand_p. * class.c (finish_struct_anon): Use constructor_name_p. (check_field_decls): Likewise. (pop_nested_class): Use OVL_NEXT, not OVL_CHAIN. (resolve_address_of_overloaded_function): Likewise. (instantiate_type): Tweak pointer-to-member handling. (get_primary_binfo): Remove incorrect assertion. * config-lang.in (gtfiles): Add parser.c, remove parse.c. * cp-tree.h (DEFARG_TOKENS): New macro. (default_arg): New structure. (cp_tree_node_structure_enum): Add TS_CP_DEFAULT_ARG. (lang_tree_node): Add default_arg. (cp_tree_index): Add CPTI_TYPE_INFO_REF_TYPE. (type_info_ref_type): New macro. (saved_scope): Make processing_explicit_instantiation a boolean. (check_access): New field. (unparsed_text): Remove. (language_function): Remove unparsed_inlines. (error_operand_p): New macro. (lang_decl): Adjust pending_inline_info. (DEFARG_POINTER): Remove. (tag_types): Add typenames. (lookup_ualified_name): Declare. (lookup_name_real): Likewise. (shadow_tag): Adjust prototype. (get_scope_of_declarator): Declare it. (process_next_inline): Remove it. (check_for_missing_semicolon): Likewise. (maybe_get_template_decl_from_type_decl): Declare it. (finish_label_stmt): Adjust prototype. (finish_non_static_data_meber): Declare it. (finish_pseudo_destructor_call_expr): Rename to ... (finish_pseudo_destructor_expr): ... this. (finish_compound_literal): Declare it. (begin_inline_definitions): Remove it. (init_spew): Remove. (peekyylex): Likewise. (arbitrate_lookup): Likewise. (frob_opname): Likewise. (maybe_snarf_defarg): Likewise. (add_defarg_fn): Likewise. (do_pending_defargs): Likewise. (done_pending_defargs): Likewise. (unprocessed_defarg_fn): Likewise. (replace_defarg): Likewise. (end_input): Likewise. (get_overloaded_fn): Likewise. * cvt.c (convert_to_reference): Improve error handling. * decl.c (lookup_name_real): Do not declare it static. (maybe_push_to_top_level): Set check_access. (identifier_type_value): Adjust call to lookup_name_real. (lookup_qualified_name): New method. (lookup_name_real): Remove special-case parsing code. (lookup_name-nonclass): Adjust call to lookup_name_real. (lookup_name_namespace_only): Likewise. (lookup_name): Likewise. (check_tag_decl): Return the type declared. (shadow_tag): Likewise. (register_dtor_fn): Tweak check_access. (grokfndecl): Use constructor_name_p. (get_scope_of_declarator): New function. (grokdeclarator): Obscure tweaks for slightly different declarator representations. (start_method): Return error_mark_node to indicate failure. (cp_tree_node_structure_enum): Use TS_CP_DEFAULT_ARG for DEFAULT_ARGs. * decl2.c (constructor_name_full): Simplify. (constructor_name): Use it. (build_expr_from_tree): Adjust for changes to do new parser. (push_scope): Improve robustness. (validate_nonmember_using_decl): Process declarations, not names. (do_class_using_decl): Likewise. (handle_class_head): Do not mess with CLASSTYPE_DECLARED_CLASS here. * error.c (dump_expr): Handle IDENTIFIER_NODEs and BASELINKs. * expr.c (cxx_expand_expr): Handle BASELINKs. * init.c (member_init_ok_or_else): Issue more errors. (build_offset_ref): Tweak handling of FUNCTION_DECLs. * lex.c: Do not include parse.h. (yypring): Do not declare. (yylval): Likewise. (make_reference_declarator): Remove error-generating code. (rid_to_yy): Remove. (cxx_init): Do not call init_spew. (yypring): Remove. (check_for_missing_semicolon): Remove. * lex.h (got_scope): Remove. (got_object): Remove. * method.c (hack_identifier): Use finish_non_static_data_member. (implicitly_declare_fn): Adjust use of constructor_name. * parser.c: New file. * pt.c (parse.h): Do not include it. (maybe_get_template_decl_from_template): Do not declare it. (finish_member_template_decl): Tweak. (begin_explicit_instantiation): Adjust for processing_explicit_instantiation being boolean. (end_explicit_instantiation): Likewise. (maybe_process_partial_specialization): Tighten specialization test. (retrieve_local_specialization): Adjust ue of hash table. (eq_local_specializations): New function. (register_local_specialization): Likewise. (push_template_decl_real): Remove unnecessary test. (maybe_get_template_decl_from_type_decl): Don't make it static. (for_each_template_parm_r): Handle TYPEOF_TYPE. (tsubst_copy): Use retrieive_local_specialization to handle PARM_DECL. Adjust handling of CONST_DECLs. Handle BASELINKs. Handle COMPONENT_REFs with pseudo-destructor-expressions. Simplify handling of CALL_EXPR and METHOD_CALL_EXPR. (tsubst_expr): Pass decls, not names, to do_local_using_decl. (unify): Tweak handling of CONST_DECLs. (regenerate_decl_from_template): Use push_nested_class. (template_for_substitution): New funciton. (instantiate_decl): Use it. Register parameters as local specializations. * rtti.c (init_rtti_processing): Set type_info_ref_type. (build_typeid): Use it. (get_typeid): Likeise. * search.c (accessible_p): Use check_access, not flag_access_control. (adjust_result_of_qualified_name_lookup): Pay attention to the context_class. * semantics.c (finish_asm_stmt): Adjust error handling. (finish_label_stmt): Return the statement. (finish_non_static_data_member): New function. (finish_class_expr): Handle BASELINKs. (finish_call_expr): Handle PSEUDO_DTOR_EXPR. (finish_object_call_expr): Simplify handling during templates. (finish_pseudo_destructor_call_expr): Rename to ... (finish_pseudo_dtor_expr): ... this. (finish_compound_literal): New function. (begin_inline_definitions): Remove. (finish_sizeof): Remove special template handling. * spew.c: Do not include parse.h. * tree.c (get_overloaded_fn): Remove. * typeck.c (build_class_member_access_expr): Handle PSEUDO_DTOR_EXPR. Adjust handling of static member functions. (lookup_destructor): New function. (finish_class_member_access_expr): Use it. (convert_arguments): Simplify. (build_unary_op): Handle BASELINKs. From-SVN: r60560
2002-12-28 09:03:42 +01:00
/* A reference to a member function will appear as an overloaded
function (rather than a BASELINK) if an unqualified name was used
to refer to it. */
if (!BASELINK_P (fn) && is_overloaded_fn (fn))
{
tree f = fn;
Make-lang.in (po-generated): Remove parse.c. * Make-lang.in (po-generated): Remove parse.c. (CXX_OBJS): Remove parse.o and spew.o. Add parser.o. ($(srcdir)/cp/parse.h): Remove target. ($(srcdir)/cp/parse.c): Likewise. (gt-cp-parse.h): Likewise. (gt-cp-parser.h): New target. (c++.distclean): Do not remove parse.output. (c++.maintainer-clean): Do not remove parse.c or parse.h. (cp/spew.o): Remove target. (cp/lex.o): Adjust dependencies. (cp/pt.o): Likewise. (cp/parse.o): Likewise. (cp/TAGS): Do not mention parse.c. (cp/parser.o): New target. * NEWS: Mention the new parser. * call.c (build_scoped_method_call): Simplify. (build_method_call): Likewise. (build_new_function_call): Adjust calls to add_function_candidate and add_template_candidate. (build_new_op): Improve handling of erroroneous operands. (convert_default_arg): Remove circular argument processing. (name_as_c_string): New function. (build_new_method_call): Use it. (perform_implicit_conversion): Use error_operand_p. * class.c (finish_struct_anon): Use constructor_name_p. (check_field_decls): Likewise. (pop_nested_class): Use OVL_NEXT, not OVL_CHAIN. (resolve_address_of_overloaded_function): Likewise. (instantiate_type): Tweak pointer-to-member handling. (get_primary_binfo): Remove incorrect assertion. * config-lang.in (gtfiles): Add parser.c, remove parse.c. * cp-tree.h (DEFARG_TOKENS): New macro. (default_arg): New structure. (cp_tree_node_structure_enum): Add TS_CP_DEFAULT_ARG. (lang_tree_node): Add default_arg. (cp_tree_index): Add CPTI_TYPE_INFO_REF_TYPE. (type_info_ref_type): New macro. (saved_scope): Make processing_explicit_instantiation a boolean. (check_access): New field. (unparsed_text): Remove. (language_function): Remove unparsed_inlines. (error_operand_p): New macro. (lang_decl): Adjust pending_inline_info. (DEFARG_POINTER): Remove. (tag_types): Add typenames. (lookup_ualified_name): Declare. (lookup_name_real): Likewise. (shadow_tag): Adjust prototype. (get_scope_of_declarator): Declare it. (process_next_inline): Remove it. (check_for_missing_semicolon): Likewise. (maybe_get_template_decl_from_type_decl): Declare it. (finish_label_stmt): Adjust prototype. (finish_non_static_data_meber): Declare it. (finish_pseudo_destructor_call_expr): Rename to ... (finish_pseudo_destructor_expr): ... this. (finish_compound_literal): Declare it. (begin_inline_definitions): Remove it. (init_spew): Remove. (peekyylex): Likewise. (arbitrate_lookup): Likewise. (frob_opname): Likewise. (maybe_snarf_defarg): Likewise. (add_defarg_fn): Likewise. (do_pending_defargs): Likewise. (done_pending_defargs): Likewise. (unprocessed_defarg_fn): Likewise. (replace_defarg): Likewise. (end_input): Likewise. (get_overloaded_fn): Likewise. * cvt.c (convert_to_reference): Improve error handling. * decl.c (lookup_name_real): Do not declare it static. (maybe_push_to_top_level): Set check_access. (identifier_type_value): Adjust call to lookup_name_real. (lookup_qualified_name): New method. (lookup_name_real): Remove special-case parsing code. (lookup_name-nonclass): Adjust call to lookup_name_real. (lookup_name_namespace_only): Likewise. (lookup_name): Likewise. (check_tag_decl): Return the type declared. (shadow_tag): Likewise. (register_dtor_fn): Tweak check_access. (grokfndecl): Use constructor_name_p. (get_scope_of_declarator): New function. (grokdeclarator): Obscure tweaks for slightly different declarator representations. (start_method): Return error_mark_node to indicate failure. (cp_tree_node_structure_enum): Use TS_CP_DEFAULT_ARG for DEFAULT_ARGs. * decl2.c (constructor_name_full): Simplify. (constructor_name): Use it. (build_expr_from_tree): Adjust for changes to do new parser. (push_scope): Improve robustness. (validate_nonmember_using_decl): Process declarations, not names. (do_class_using_decl): Likewise. (handle_class_head): Do not mess with CLASSTYPE_DECLARED_CLASS here. * error.c (dump_expr): Handle IDENTIFIER_NODEs and BASELINKs. * expr.c (cxx_expand_expr): Handle BASELINKs. * init.c (member_init_ok_or_else): Issue more errors. (build_offset_ref): Tweak handling of FUNCTION_DECLs. * lex.c: Do not include parse.h. (yypring): Do not declare. (yylval): Likewise. (make_reference_declarator): Remove error-generating code. (rid_to_yy): Remove. (cxx_init): Do not call init_spew. (yypring): Remove. (check_for_missing_semicolon): Remove. * lex.h (got_scope): Remove. (got_object): Remove. * method.c (hack_identifier): Use finish_non_static_data_member. (implicitly_declare_fn): Adjust use of constructor_name. * parser.c: New file. * pt.c (parse.h): Do not include it. (maybe_get_template_decl_from_template): Do not declare it. (finish_member_template_decl): Tweak. (begin_explicit_instantiation): Adjust for processing_explicit_instantiation being boolean. (end_explicit_instantiation): Likewise. (maybe_process_partial_specialization): Tighten specialization test. (retrieve_local_specialization): Adjust ue of hash table. (eq_local_specializations): New function. (register_local_specialization): Likewise. (push_template_decl_real): Remove unnecessary test. (maybe_get_template_decl_from_type_decl): Don't make it static. (for_each_template_parm_r): Handle TYPEOF_TYPE. (tsubst_copy): Use retrieive_local_specialization to handle PARM_DECL. Adjust handling of CONST_DECLs. Handle BASELINKs. Handle COMPONENT_REFs with pseudo-destructor-expressions. Simplify handling of CALL_EXPR and METHOD_CALL_EXPR. (tsubst_expr): Pass decls, not names, to do_local_using_decl. (unify): Tweak handling of CONST_DECLs. (regenerate_decl_from_template): Use push_nested_class. (template_for_substitution): New funciton. (instantiate_decl): Use it. Register parameters as local specializations. * rtti.c (init_rtti_processing): Set type_info_ref_type. (build_typeid): Use it. (get_typeid): Likeise. * search.c (accessible_p): Use check_access, not flag_access_control. (adjust_result_of_qualified_name_lookup): Pay attention to the context_class. * semantics.c (finish_asm_stmt): Adjust error handling. (finish_label_stmt): Return the statement. (finish_non_static_data_member): New function. (finish_class_expr): Handle BASELINKs. (finish_call_expr): Handle PSEUDO_DTOR_EXPR. (finish_object_call_expr): Simplify handling during templates. (finish_pseudo_destructor_call_expr): Rename to ... (finish_pseudo_dtor_expr): ... this. (finish_compound_literal): New function. (begin_inline_definitions): Remove. (finish_sizeof): Remove special template handling. * spew.c: Do not include parse.h. * tree.c (get_overloaded_fn): Remove. * typeck.c (build_class_member_access_expr): Handle PSEUDO_DTOR_EXPR. Adjust handling of static member functions. (lookup_destructor): New function. (finish_class_member_access_expr): Use it. (convert_arguments): Simplify. (build_unary_op): Handle BASELINKs. From-SVN: r60560
2002-12-28 09:03:42 +01:00
if (TREE_CODE (f) == TEMPLATE_ID_EXPR)
f = TREE_OPERAND (f, 0);
f = get_first_fn (f);
Make-lang.in (po-generated): Remove parse.c. * Make-lang.in (po-generated): Remove parse.c. (CXX_OBJS): Remove parse.o and spew.o. Add parser.o. ($(srcdir)/cp/parse.h): Remove target. ($(srcdir)/cp/parse.c): Likewise. (gt-cp-parse.h): Likewise. (gt-cp-parser.h): New target. (c++.distclean): Do not remove parse.output. (c++.maintainer-clean): Do not remove parse.c or parse.h. (cp/spew.o): Remove target. (cp/lex.o): Adjust dependencies. (cp/pt.o): Likewise. (cp/parse.o): Likewise. (cp/TAGS): Do not mention parse.c. (cp/parser.o): New target. * NEWS: Mention the new parser. * call.c (build_scoped_method_call): Simplify. (build_method_call): Likewise. (build_new_function_call): Adjust calls to add_function_candidate and add_template_candidate. (build_new_op): Improve handling of erroroneous operands. (convert_default_arg): Remove circular argument processing. (name_as_c_string): New function. (build_new_method_call): Use it. (perform_implicit_conversion): Use error_operand_p. * class.c (finish_struct_anon): Use constructor_name_p. (check_field_decls): Likewise. (pop_nested_class): Use OVL_NEXT, not OVL_CHAIN. (resolve_address_of_overloaded_function): Likewise. (instantiate_type): Tweak pointer-to-member handling. (get_primary_binfo): Remove incorrect assertion. * config-lang.in (gtfiles): Add parser.c, remove parse.c. * cp-tree.h (DEFARG_TOKENS): New macro. (default_arg): New structure. (cp_tree_node_structure_enum): Add TS_CP_DEFAULT_ARG. (lang_tree_node): Add default_arg. (cp_tree_index): Add CPTI_TYPE_INFO_REF_TYPE. (type_info_ref_type): New macro. (saved_scope): Make processing_explicit_instantiation a boolean. (check_access): New field. (unparsed_text): Remove. (language_function): Remove unparsed_inlines. (error_operand_p): New macro. (lang_decl): Adjust pending_inline_info. (DEFARG_POINTER): Remove. (tag_types): Add typenames. (lookup_ualified_name): Declare. (lookup_name_real): Likewise. (shadow_tag): Adjust prototype. (get_scope_of_declarator): Declare it. (process_next_inline): Remove it. (check_for_missing_semicolon): Likewise. (maybe_get_template_decl_from_type_decl): Declare it. (finish_label_stmt): Adjust prototype. (finish_non_static_data_meber): Declare it. (finish_pseudo_destructor_call_expr): Rename to ... (finish_pseudo_destructor_expr): ... this. (finish_compound_literal): Declare it. (begin_inline_definitions): Remove it. (init_spew): Remove. (peekyylex): Likewise. (arbitrate_lookup): Likewise. (frob_opname): Likewise. (maybe_snarf_defarg): Likewise. (add_defarg_fn): Likewise. (do_pending_defargs): Likewise. (done_pending_defargs): Likewise. (unprocessed_defarg_fn): Likewise. (replace_defarg): Likewise. (end_input): Likewise. (get_overloaded_fn): Likewise. * cvt.c (convert_to_reference): Improve error handling. * decl.c (lookup_name_real): Do not declare it static. (maybe_push_to_top_level): Set check_access. (identifier_type_value): Adjust call to lookup_name_real. (lookup_qualified_name): New method. (lookup_name_real): Remove special-case parsing code. (lookup_name-nonclass): Adjust call to lookup_name_real. (lookup_name_namespace_only): Likewise. (lookup_name): Likewise. (check_tag_decl): Return the type declared. (shadow_tag): Likewise. (register_dtor_fn): Tweak check_access. (grokfndecl): Use constructor_name_p. (get_scope_of_declarator): New function. (grokdeclarator): Obscure tweaks for slightly different declarator representations. (start_method): Return error_mark_node to indicate failure. (cp_tree_node_structure_enum): Use TS_CP_DEFAULT_ARG for DEFAULT_ARGs. * decl2.c (constructor_name_full): Simplify. (constructor_name): Use it. (build_expr_from_tree): Adjust for changes to do new parser. (push_scope): Improve robustness. (validate_nonmember_using_decl): Process declarations, not names. (do_class_using_decl): Likewise. (handle_class_head): Do not mess with CLASSTYPE_DECLARED_CLASS here. * error.c (dump_expr): Handle IDENTIFIER_NODEs and BASELINKs. * expr.c (cxx_expand_expr): Handle BASELINKs. * init.c (member_init_ok_or_else): Issue more errors. (build_offset_ref): Tweak handling of FUNCTION_DECLs. * lex.c: Do not include parse.h. (yypring): Do not declare. (yylval): Likewise. (make_reference_declarator): Remove error-generating code. (rid_to_yy): Remove. (cxx_init): Do not call init_spew. (yypring): Remove. (check_for_missing_semicolon): Remove. * lex.h (got_scope): Remove. (got_object): Remove. * method.c (hack_identifier): Use finish_non_static_data_member. (implicitly_declare_fn): Adjust use of constructor_name. * parser.c: New file. * pt.c (parse.h): Do not include it. (maybe_get_template_decl_from_template): Do not declare it. (finish_member_template_decl): Tweak. (begin_explicit_instantiation): Adjust for processing_explicit_instantiation being boolean. (end_explicit_instantiation): Likewise. (maybe_process_partial_specialization): Tighten specialization test. (retrieve_local_specialization): Adjust ue of hash table. (eq_local_specializations): New function. (register_local_specialization): Likewise. (push_template_decl_real): Remove unnecessary test. (maybe_get_template_decl_from_type_decl): Don't make it static. (for_each_template_parm_r): Handle TYPEOF_TYPE. (tsubst_copy): Use retrieive_local_specialization to handle PARM_DECL. Adjust handling of CONST_DECLs. Handle BASELINKs. Handle COMPONENT_REFs with pseudo-destructor-expressions. Simplify handling of CALL_EXPR and METHOD_CALL_EXPR. (tsubst_expr): Pass decls, not names, to do_local_using_decl. (unify): Tweak handling of CONST_DECLs. (regenerate_decl_from_template): Use push_nested_class. (template_for_substitution): New funciton. (instantiate_decl): Use it. Register parameters as local specializations. * rtti.c (init_rtti_processing): Set type_info_ref_type. (build_typeid): Use it. (get_typeid): Likeise. * search.c (accessible_p): Use check_access, not flag_access_control. (adjust_result_of_qualified_name_lookup): Pay attention to the context_class. * semantics.c (finish_asm_stmt): Adjust error handling. (finish_label_stmt): Return the statement. (finish_non_static_data_member): New function. (finish_class_expr): Handle BASELINKs. (finish_call_expr): Handle PSEUDO_DTOR_EXPR. (finish_object_call_expr): Simplify handling during templates. (finish_pseudo_destructor_call_expr): Rename to ... (finish_pseudo_dtor_expr): ... this. (finish_compound_literal): New function. (begin_inline_definitions): Remove. (finish_sizeof): Remove special template handling. * spew.c: Do not include parse.h. * tree.c (get_overloaded_fn): Remove. * typeck.c (build_class_member_access_expr): Handle PSEUDO_DTOR_EXPR. Adjust handling of static member functions. (lookup_destructor): New function. (finish_class_member_access_expr): Use it. (convert_arguments): Simplify. (build_unary_op): Handle BASELINKs. From-SVN: r60560
2002-12-28 09:03:42 +01:00
if (DECL_FUNCTION_MEMBER_P (f))
{
tree type = currently_open_derived_class (DECL_CONTEXT (f));
fn = build_baselink (TYPE_BINFO (type),
TYPE_BINFO (type),
fn, /*optype=*/NULL_TREE);
}
}
fold-const.c (make_range): Do not access operand 1 for a zero-operand operator. * fold-const.c (make_range): Do not access operand 1 for a zero-operand operator. 2003-07-08 Mark Mitchell <mark@codesourcery.com> * cp-tree.def (NON_DEPENDENT_EXPR): New node. * cp-tree.h (build_call_from_tree): Remove. (build_member_call): Likewise. (dependent_template_arg_p): Remove. (any_dependent_template_arguments_p): New function. (dependent_template_id_p): Likewise. (any_type_dependent_arguments_p): Likewise. (build_non_dependent_expr): Likewise. (build_non_dependent_args): Likewise. (build_x_compound_expr): Adjust prototype. * call.c (build_new_method_call): Handle non-dependent expressions correctly. * decl2.c (grok_array_decl): Likewise. (build_offset_ref_call_from_tree): Likewise. (build_call_from_tree): Remove. * error.c (dump_decl): Handle NON_DEPENDENT_EXPR. (dump_expr): Likewise. * init.c (build_member_call): Remove. * mangle.c (write_expression): Update handling for template-ids. * parser.c (cp_parser_primary_expression): Use any_dependent_template_arguments_p. Update constant-expression handling. (cp_parser_postfix_expression): Use any_type_dependent_arguments_p. Simplify call processing. (cp_parser_unary_expression): Simplify. (cp_parser_expression): Adjust for changes to build_x_compound_expr. (cp_parser_template_argument): Implement standard-conforming parsing of non-type template arguments. (cp_parser_direct_declarator): Use cp_parser_fold_non_dependent_expr. (cp_parser_fold_non_dependent_expr): New function. (cp_parser_next_token_ends_template_argument_p): Likewise. * pt.c (convert_template_argument): Do not call maybe_fold_nontype_arg. (tsubst_baselink): Likewise. (tsubst_copy_and_build): Share common code. Make sizeof/alignof processing work correctly for non-dependent expressions. Adjust handling of COMPOUND_EXPR. Simplify call processing. (value_dependent_expression_p): Deal with functional casts and sizeof/alignof correctly. (type_dependent_expression_p): Handle overloaded functions. (any_type_dependent_arguments_p): New function. (any_dependent_template_arguments_p): Likewise. (dependent_template_p): Treat SCOPE_REFs as dependent. (dependent_template_id_p): Simplify. (build_non_dependent_expr): New function. (build_non_dependent_args): Likewise. * semantics.c (finish_stmt_expr): Don't make dependent statement-expresions have void type. (finish_call_expr): Handle non-dependent expressions correctly. * tree.c (lvalue_p_1): Treat NON_DEPENDENT_EXPRs as lvalues. * typeck.c (cxx_sizeof_or_alignof_type): Give the expression type size_t, even in templates. (expr_sizeof): Likewise. (finish_class_member_access_expr): Handle non-dependent expressions correctly. (build_x_indirect_ref): Likewise. (build_x_binary_op): Likewise. (build_x_unary_op): Likewise. (build_x_conditional_expr): Likewise. (build_x_compound_expr): Likewise. * typeck2.c (build_x_arrow): Likewise. 2003-07-08 Mark Mitchell <mark@codesourcery.com> * g++.dg/abi/mangle17.C: Make sure template expressions are dependent. * g++.dg/abi/mangle4.C: Mark erroneous casts. * g++.dg/debug/debug7.C: Mark erronous new-declarator. * g++.dg/opt/stack1.C: Remove erroneous code. * g++.dg/parse/template7.C: New test. * g++.dg/template/dependent-expr1.C: Mark erroneous code. * g++.old-deja/g++.pt/crash4.C: Likewise. 2003-07-09 Mark Mitchell <mark@codesourcery.com> * gcj/array.h (JvPrimClass): Don't parenthesize the output. From-SVN: r69130
2003-07-09 10:48:08 +02:00
result = NULL_TREE;
call.c (build_field_call): Do not look up the field by name. * call.c (build_field_call): Do not look up the field by name. (build_method_call): Simplify. (struct z_candidate): Add access_path and conversion_path. Remove basetype_path. (convert_class_to_reference): Adjust use of add_function_candidate. (add_candidate): Add conversion_path argument. (add_function_candidate): Use it. (add_conv_dndidate): Likewise. (build_builtin_candidate): Likewise. (add_template_candidate_real): Add conversion_path argument. (add_template_conv_candidate): Likewise. (add_template_candidate): Likewise. (build_user_type_conversion_1): Use it. (build_new_function_call): Remove name lookup code. Adjust use of add_template_candidate and add_function_candidate. (build_new_op): Likewise. (convert_like_real): Use build_special_member_call. (build_over_call): Use cand->conversion_path. (build_special_member_call): New method. (build_new_method_call): Remove name lookup code. * cp-tree.def (OFFSET_REF): Update documentation. (TEMPLATE_ID_EXPR): Likewise. * cp-tree.h (BASELINK_ACCESS_BINFO): New macro. (BASELINK_OPTYPE): Likewise. (build_new_method_call): Adjust prototype. (build_special_member_call): New method. (build_baselink): New method. (build_offset_ref_call_from_tree): Likewise. (build_call_from_tree): Likewise. (finish_qualified_call_expr): Remove. (finish_call_expr): Adjust prototype. (build_x_function_call): Remove. * cvt.c (ocp_convert): Use build_special_member_call. * decl2.c (reparse_absdcl_as_expr): Use finish_call_expr. (build_expr_from_tree): Adjust handling for TEMPLATE_ID_EXPR and CALL_EXPR. (build_offset_ref_call_from_tree): New function. (build_call_from_tree): Likewise. * init.c (expand_cleanup): Use build_special_member_call. (expand_default_init): Likewise. (build_member_call): Use finish_call_expr. (build_new_1): Use build_special_member_call. (push_base_cleanups): Likewise. * method.c (do_build_assign_ref): Likewise. * parse.y (template_id): Do not pass a COMPONENT_REF to lookup_template_function. (primary): Use parse_finish_call_epxr, not finish_call_expr. (parse_finish_call_expr): New function. * pt.c (lookup_template_function): Add assertions. * search.c (lookup_base): Allow T to be a binfo. (build_baselink): New function. (lookup_member): Use it. * semantics.c (finish_call_expr): Do not do name lookup. (finish_object_call_expr): Remove #if 0'd code. (finish_qualified_call_expr): Remove. * typeck.c (build_x_function_call): Remove. (build_static_case): Use build_special_member_call. * typeck2.c (build_functional_cast): Likewise. * g++.dg/inherit/operator1.C: New test. * g++.dg/lookup/disamb1.C: Fix typo in comment. * g++.dg/other/error1.C: Change expected error message. * g++.dg/template/conv4.C: Likewise. From-SVN: r55920
2002-08-01 06:46:23 +02:00
if (BASELINK_P (fn))
{
call.c (build_field_call): Do not look up the field by name. * call.c (build_field_call): Do not look up the field by name. (build_method_call): Simplify. (struct z_candidate): Add access_path and conversion_path. Remove basetype_path. (convert_class_to_reference): Adjust use of add_function_candidate. (add_candidate): Add conversion_path argument. (add_function_candidate): Use it. (add_conv_dndidate): Likewise. (build_builtin_candidate): Likewise. (add_template_candidate_real): Add conversion_path argument. (add_template_conv_candidate): Likewise. (add_template_candidate): Likewise. (build_user_type_conversion_1): Use it. (build_new_function_call): Remove name lookup code. Adjust use of add_template_candidate and add_function_candidate. (build_new_op): Likewise. (convert_like_real): Use build_special_member_call. (build_over_call): Use cand->conversion_path. (build_special_member_call): New method. (build_new_method_call): Remove name lookup code. * cp-tree.def (OFFSET_REF): Update documentation. (TEMPLATE_ID_EXPR): Likewise. * cp-tree.h (BASELINK_ACCESS_BINFO): New macro. (BASELINK_OPTYPE): Likewise. (build_new_method_call): Adjust prototype. (build_special_member_call): New method. (build_baselink): New method. (build_offset_ref_call_from_tree): Likewise. (build_call_from_tree): Likewise. (finish_qualified_call_expr): Remove. (finish_call_expr): Adjust prototype. (build_x_function_call): Remove. * cvt.c (ocp_convert): Use build_special_member_call. * decl2.c (reparse_absdcl_as_expr): Use finish_call_expr. (build_expr_from_tree): Adjust handling for TEMPLATE_ID_EXPR and CALL_EXPR. (build_offset_ref_call_from_tree): New function. (build_call_from_tree): Likewise. * init.c (expand_cleanup): Use build_special_member_call. (expand_default_init): Likewise. (build_member_call): Use finish_call_expr. (build_new_1): Use build_special_member_call. (push_base_cleanups): Likewise. * method.c (do_build_assign_ref): Likewise. * parse.y (template_id): Do not pass a COMPONENT_REF to lookup_template_function. (primary): Use parse_finish_call_epxr, not finish_call_expr. (parse_finish_call_expr): New function. * pt.c (lookup_template_function): Add assertions. * search.c (lookup_base): Allow T to be a binfo. (build_baselink): New function. (lookup_member): Use it. * semantics.c (finish_call_expr): Do not do name lookup. (finish_object_call_expr): Remove #if 0'd code. (finish_qualified_call_expr): Remove. * typeck.c (build_x_function_call): Remove. (build_static_case): Use build_special_member_call. * typeck2.c (build_functional_cast): Likewise. * g++.dg/inherit/operator1.C: New test. * g++.dg/lookup/disamb1.C: Fix typo in comment. * g++.dg/other/error1.C: Change expected error message. * g++.dg/template/conv4.C: Likewise. From-SVN: r55920
2002-08-01 06:46:23 +02:00
tree object;
/* A call to a member function. From [over.call.func]:
If the keyword this is in scope and refers to the class of
that member function, or a derived class thereof, then the
function call is transformed into a qualified function call
using (*this) as the postfix-expression to the left of the
. operator.... [Otherwise] a contrived object of type T
becomes the implied object argument.
This paragraph is unclear about this situation:
struct A { void f(); };
struct B : public A {};
struct C : public A { void g() { B::f(); }};
In particular, for `B::f', this paragraph does not make clear
whether "the class of that member function" refers to `A' or
to `B'. We believe it refers to `B'. */
if (current_class_type
&& DERIVED_FROM_P (BINFO_TYPE (BASELINK_ACCESS_BINFO (fn)),
current_class_type)
&& current_class_ref)
object = maybe_dummy_object (BINFO_TYPE (BASELINK_ACCESS_BINFO (fn)),
NULL);
call.c (build_field_call): Do not look up the field by name. * call.c (build_field_call): Do not look up the field by name. (build_method_call): Simplify. (struct z_candidate): Add access_path and conversion_path. Remove basetype_path. (convert_class_to_reference): Adjust use of add_function_candidate. (add_candidate): Add conversion_path argument. (add_function_candidate): Use it. (add_conv_dndidate): Likewise. (build_builtin_candidate): Likewise. (add_template_candidate_real): Add conversion_path argument. (add_template_conv_candidate): Likewise. (add_template_candidate): Likewise. (build_user_type_conversion_1): Use it. (build_new_function_call): Remove name lookup code. Adjust use of add_template_candidate and add_function_candidate. (build_new_op): Likewise. (convert_like_real): Use build_special_member_call. (build_over_call): Use cand->conversion_path. (build_special_member_call): New method. (build_new_method_call): Remove name lookup code. * cp-tree.def (OFFSET_REF): Update documentation. (TEMPLATE_ID_EXPR): Likewise. * cp-tree.h (BASELINK_ACCESS_BINFO): New macro. (BASELINK_OPTYPE): Likewise. (build_new_method_call): Adjust prototype. (build_special_member_call): New method. (build_baselink): New method. (build_offset_ref_call_from_tree): Likewise. (build_call_from_tree): Likewise. (finish_qualified_call_expr): Remove. (finish_call_expr): Adjust prototype. (build_x_function_call): Remove. * cvt.c (ocp_convert): Use build_special_member_call. * decl2.c (reparse_absdcl_as_expr): Use finish_call_expr. (build_expr_from_tree): Adjust handling for TEMPLATE_ID_EXPR and CALL_EXPR. (build_offset_ref_call_from_tree): New function. (build_call_from_tree): Likewise. * init.c (expand_cleanup): Use build_special_member_call. (expand_default_init): Likewise. (build_member_call): Use finish_call_expr. (build_new_1): Use build_special_member_call. (push_base_cleanups): Likewise. * method.c (do_build_assign_ref): Likewise. * parse.y (template_id): Do not pass a COMPONENT_REF to lookup_template_function. (primary): Use parse_finish_call_epxr, not finish_call_expr. (parse_finish_call_expr): New function. * pt.c (lookup_template_function): Add assertions. * search.c (lookup_base): Allow T to be a binfo. (build_baselink): New function. (lookup_member): Use it. * semantics.c (finish_call_expr): Do not do name lookup. (finish_object_call_expr): Remove #if 0'd code. (finish_qualified_call_expr): Remove. * typeck.c (build_x_function_call): Remove. (build_static_case): Use build_special_member_call. * typeck2.c (build_functional_cast): Likewise. * g++.dg/inherit/operator1.C: New test. * g++.dg/lookup/disamb1.C: Fix typo in comment. * g++.dg/other/error1.C: Change expected error message. * g++.dg/template/conv4.C: Likewise. From-SVN: r55920
2002-08-01 06:46:23 +02:00
else
{
tree representative_fn;
call.c (build_field_call): Do not look up the field by name. * call.c (build_field_call): Do not look up the field by name. (build_method_call): Simplify. (struct z_candidate): Add access_path and conversion_path. Remove basetype_path. (convert_class_to_reference): Adjust use of add_function_candidate. (add_candidate): Add conversion_path argument. (add_function_candidate): Use it. (add_conv_dndidate): Likewise. (build_builtin_candidate): Likewise. (add_template_candidate_real): Add conversion_path argument. (add_template_conv_candidate): Likewise. (add_template_candidate): Likewise. (build_user_type_conversion_1): Use it. (build_new_function_call): Remove name lookup code. Adjust use of add_template_candidate and add_function_candidate. (build_new_op): Likewise. (convert_like_real): Use build_special_member_call. (build_over_call): Use cand->conversion_path. (build_special_member_call): New method. (build_new_method_call): Remove name lookup code. * cp-tree.def (OFFSET_REF): Update documentation. (TEMPLATE_ID_EXPR): Likewise. * cp-tree.h (BASELINK_ACCESS_BINFO): New macro. (BASELINK_OPTYPE): Likewise. (build_new_method_call): Adjust prototype. (build_special_member_call): New method. (build_baselink): New method. (build_offset_ref_call_from_tree): Likewise. (build_call_from_tree): Likewise. (finish_qualified_call_expr): Remove. (finish_call_expr): Adjust prototype. (build_x_function_call): Remove. * cvt.c (ocp_convert): Use build_special_member_call. * decl2.c (reparse_absdcl_as_expr): Use finish_call_expr. (build_expr_from_tree): Adjust handling for TEMPLATE_ID_EXPR and CALL_EXPR. (build_offset_ref_call_from_tree): New function. (build_call_from_tree): Likewise. * init.c (expand_cleanup): Use build_special_member_call. (expand_default_init): Likewise. (build_member_call): Use finish_call_expr. (build_new_1): Use build_special_member_call. (push_base_cleanups): Likewise. * method.c (do_build_assign_ref): Likewise. * parse.y (template_id): Do not pass a COMPONENT_REF to lookup_template_function. (primary): Use parse_finish_call_epxr, not finish_call_expr. (parse_finish_call_expr): New function. * pt.c (lookup_template_function): Add assertions. * search.c (lookup_base): Allow T to be a binfo. (build_baselink): New function. (lookup_member): Use it. * semantics.c (finish_call_expr): Do not do name lookup. (finish_object_call_expr): Remove #if 0'd code. (finish_qualified_call_expr): Remove. * typeck.c (build_x_function_call): Remove. (build_static_case): Use build_special_member_call. * typeck2.c (build_functional_cast): Likewise. * g++.dg/inherit/operator1.C: New test. * g++.dg/lookup/disamb1.C: Fix typo in comment. * g++.dg/other/error1.C: Change expected error message. * g++.dg/template/conv4.C: Likewise. From-SVN: r55920
2002-08-01 06:46:23 +02:00
representative_fn = BASELINK_FUNCTIONS (fn);
if (TREE_CODE (representative_fn) == TEMPLATE_ID_EXPR)
representative_fn = TREE_OPERAND (representative_fn, 0);
representative_fn = get_first_fn (representative_fn);
object = build_dummy_object (DECL_CONTEXT (representative_fn));
}
fold-const.c (make_range): Do not access operand 1 for a zero-operand operator. * fold-const.c (make_range): Do not access operand 1 for a zero-operand operator. 2003-07-08 Mark Mitchell <mark@codesourcery.com> * cp-tree.def (NON_DEPENDENT_EXPR): New node. * cp-tree.h (build_call_from_tree): Remove. (build_member_call): Likewise. (dependent_template_arg_p): Remove. (any_dependent_template_arguments_p): New function. (dependent_template_id_p): Likewise. (any_type_dependent_arguments_p): Likewise. (build_non_dependent_expr): Likewise. (build_non_dependent_args): Likewise. (build_x_compound_expr): Adjust prototype. * call.c (build_new_method_call): Handle non-dependent expressions correctly. * decl2.c (grok_array_decl): Likewise. (build_offset_ref_call_from_tree): Likewise. (build_call_from_tree): Remove. * error.c (dump_decl): Handle NON_DEPENDENT_EXPR. (dump_expr): Likewise. * init.c (build_member_call): Remove. * mangle.c (write_expression): Update handling for template-ids. * parser.c (cp_parser_primary_expression): Use any_dependent_template_arguments_p. Update constant-expression handling. (cp_parser_postfix_expression): Use any_type_dependent_arguments_p. Simplify call processing. (cp_parser_unary_expression): Simplify. (cp_parser_expression): Adjust for changes to build_x_compound_expr. (cp_parser_template_argument): Implement standard-conforming parsing of non-type template arguments. (cp_parser_direct_declarator): Use cp_parser_fold_non_dependent_expr. (cp_parser_fold_non_dependent_expr): New function. (cp_parser_next_token_ends_template_argument_p): Likewise. * pt.c (convert_template_argument): Do not call maybe_fold_nontype_arg. (tsubst_baselink): Likewise. (tsubst_copy_and_build): Share common code. Make sizeof/alignof processing work correctly for non-dependent expressions. Adjust handling of COMPOUND_EXPR. Simplify call processing. (value_dependent_expression_p): Deal with functional casts and sizeof/alignof correctly. (type_dependent_expression_p): Handle overloaded functions. (any_type_dependent_arguments_p): New function. (any_dependent_template_arguments_p): Likewise. (dependent_template_p): Treat SCOPE_REFs as dependent. (dependent_template_id_p): Simplify. (build_non_dependent_expr): New function. (build_non_dependent_args): Likewise. * semantics.c (finish_stmt_expr): Don't make dependent statement-expresions have void type. (finish_call_expr): Handle non-dependent expressions correctly. * tree.c (lvalue_p_1): Treat NON_DEPENDENT_EXPRs as lvalues. * typeck.c (cxx_sizeof_or_alignof_type): Give the expression type size_t, even in templates. (expr_sizeof): Likewise. (finish_class_member_access_expr): Handle non-dependent expressions correctly. (build_x_indirect_ref): Likewise. (build_x_binary_op): Likewise. (build_x_unary_op): Likewise. (build_x_conditional_expr): Likewise. (build_x_compound_expr): Likewise. * typeck2.c (build_x_arrow): Likewise. 2003-07-08 Mark Mitchell <mark@codesourcery.com> * g++.dg/abi/mangle17.C: Make sure template expressions are dependent. * g++.dg/abi/mangle4.C: Mark erroneous casts. * g++.dg/debug/debug7.C: Mark erronous new-declarator. * g++.dg/opt/stack1.C: Remove erroneous code. * g++.dg/parse/template7.C: New test. * g++.dg/template/dependent-expr1.C: Mark erroneous code. * g++.old-deja/g++.pt/crash4.C: Likewise. 2003-07-09 Mark Mitchell <mark@codesourcery.com> * gcj/array.h (JvPrimClass): Don't parenthesize the output. From-SVN: r69130
2003-07-09 10:48:08 +02:00
if (processing_template_decl)
{
if (type_dependent_expression_p (object))
return build_nt (CALL_EXPR, orig_fn, orig_args);
object = build_non_dependent_expr (object);
}
result = build_new_method_call (object, fn, args, NULL_TREE,
(disallow_virtual
? LOOKUP_NONVIRTUAL : 0));
call.c (build_field_call): Do not look up the field by name. * call.c (build_field_call): Do not look up the field by name. (build_method_call): Simplify. (struct z_candidate): Add access_path and conversion_path. Remove basetype_path. (convert_class_to_reference): Adjust use of add_function_candidate. (add_candidate): Add conversion_path argument. (add_function_candidate): Use it. (add_conv_dndidate): Likewise. (build_builtin_candidate): Likewise. (add_template_candidate_real): Add conversion_path argument. (add_template_conv_candidate): Likewise. (add_template_candidate): Likewise. (build_user_type_conversion_1): Use it. (build_new_function_call): Remove name lookup code. Adjust use of add_template_candidate and add_function_candidate. (build_new_op): Likewise. (convert_like_real): Use build_special_member_call. (build_over_call): Use cand->conversion_path. (build_special_member_call): New method. (build_new_method_call): Remove name lookup code. * cp-tree.def (OFFSET_REF): Update documentation. (TEMPLATE_ID_EXPR): Likewise. * cp-tree.h (BASELINK_ACCESS_BINFO): New macro. (BASELINK_OPTYPE): Likewise. (build_new_method_call): Adjust prototype. (build_special_member_call): New method. (build_baselink): New method. (build_offset_ref_call_from_tree): Likewise. (build_call_from_tree): Likewise. (finish_qualified_call_expr): Remove. (finish_call_expr): Adjust prototype. (build_x_function_call): Remove. * cvt.c (ocp_convert): Use build_special_member_call. * decl2.c (reparse_absdcl_as_expr): Use finish_call_expr. (build_expr_from_tree): Adjust handling for TEMPLATE_ID_EXPR and CALL_EXPR. (build_offset_ref_call_from_tree): New function. (build_call_from_tree): Likewise. * init.c (expand_cleanup): Use build_special_member_call. (expand_default_init): Likewise. (build_member_call): Use finish_call_expr. (build_new_1): Use build_special_member_call. (push_base_cleanups): Likewise. * method.c (do_build_assign_ref): Likewise. * parse.y (template_id): Do not pass a COMPONENT_REF to lookup_template_function. (primary): Use parse_finish_call_epxr, not finish_call_expr. (parse_finish_call_expr): New function. * pt.c (lookup_template_function): Add assertions. * search.c (lookup_base): Allow T to be a binfo. (build_baselink): New function. (lookup_member): Use it. * semantics.c (finish_call_expr): Do not do name lookup. (finish_object_call_expr): Remove #if 0'd code. (finish_qualified_call_expr): Remove. * typeck.c (build_x_function_call): Remove. (build_static_case): Use build_special_member_call. * typeck2.c (build_functional_cast): Likewise. * g++.dg/inherit/operator1.C: New test. * g++.dg/lookup/disamb1.C: Fix typo in comment. * g++.dg/other/error1.C: Change expected error message. * g++.dg/template/conv4.C: Likewise. From-SVN: r55920
2002-08-01 06:46:23 +02:00
}
else if (is_overloaded_fn (fn))
/* A call to a namespace-scope function. */
fold-const.c (make_range): Do not access operand 1 for a zero-operand operator. * fold-const.c (make_range): Do not access operand 1 for a zero-operand operator. 2003-07-08 Mark Mitchell <mark@codesourcery.com> * cp-tree.def (NON_DEPENDENT_EXPR): New node. * cp-tree.h (build_call_from_tree): Remove. (build_member_call): Likewise. (dependent_template_arg_p): Remove. (any_dependent_template_arguments_p): New function. (dependent_template_id_p): Likewise. (any_type_dependent_arguments_p): Likewise. (build_non_dependent_expr): Likewise. (build_non_dependent_args): Likewise. (build_x_compound_expr): Adjust prototype. * call.c (build_new_method_call): Handle non-dependent expressions correctly. * decl2.c (grok_array_decl): Likewise. (build_offset_ref_call_from_tree): Likewise. (build_call_from_tree): Remove. * error.c (dump_decl): Handle NON_DEPENDENT_EXPR. (dump_expr): Likewise. * init.c (build_member_call): Remove. * mangle.c (write_expression): Update handling for template-ids. * parser.c (cp_parser_primary_expression): Use any_dependent_template_arguments_p. Update constant-expression handling. (cp_parser_postfix_expression): Use any_type_dependent_arguments_p. Simplify call processing. (cp_parser_unary_expression): Simplify. (cp_parser_expression): Adjust for changes to build_x_compound_expr. (cp_parser_template_argument): Implement standard-conforming parsing of non-type template arguments. (cp_parser_direct_declarator): Use cp_parser_fold_non_dependent_expr. (cp_parser_fold_non_dependent_expr): New function. (cp_parser_next_token_ends_template_argument_p): Likewise. * pt.c (convert_template_argument): Do not call maybe_fold_nontype_arg. (tsubst_baselink): Likewise. (tsubst_copy_and_build): Share common code. Make sizeof/alignof processing work correctly for non-dependent expressions. Adjust handling of COMPOUND_EXPR. Simplify call processing. (value_dependent_expression_p): Deal with functional casts and sizeof/alignof correctly. (type_dependent_expression_p): Handle overloaded functions. (any_type_dependent_arguments_p): New function. (any_dependent_template_arguments_p): Likewise. (dependent_template_p): Treat SCOPE_REFs as dependent. (dependent_template_id_p): Simplify. (build_non_dependent_expr): New function. (build_non_dependent_args): Likewise. * semantics.c (finish_stmt_expr): Don't make dependent statement-expresions have void type. (finish_call_expr): Handle non-dependent expressions correctly. * tree.c (lvalue_p_1): Treat NON_DEPENDENT_EXPRs as lvalues. * typeck.c (cxx_sizeof_or_alignof_type): Give the expression type size_t, even in templates. (expr_sizeof): Likewise. (finish_class_member_access_expr): Handle non-dependent expressions correctly. (build_x_indirect_ref): Likewise. (build_x_binary_op): Likewise. (build_x_unary_op): Likewise. (build_x_conditional_expr): Likewise. (build_x_compound_expr): Likewise. * typeck2.c (build_x_arrow): Likewise. 2003-07-08 Mark Mitchell <mark@codesourcery.com> * g++.dg/abi/mangle17.C: Make sure template expressions are dependent. * g++.dg/abi/mangle4.C: Mark erroneous casts. * g++.dg/debug/debug7.C: Mark erronous new-declarator. * g++.dg/opt/stack1.C: Remove erroneous code. * g++.dg/parse/template7.C: New test. * g++.dg/template/dependent-expr1.C: Mark erroneous code. * g++.old-deja/g++.pt/crash4.C: Likewise. 2003-07-09 Mark Mitchell <mark@codesourcery.com> * gcj/array.h (JvPrimClass): Don't parenthesize the output. From-SVN: r69130
2003-07-09 10:48:08 +02:00
result = build_new_function_call (fn, args);
Make-lang.in (po-generated): Remove parse.c. * Make-lang.in (po-generated): Remove parse.c. (CXX_OBJS): Remove parse.o and spew.o. Add parser.o. ($(srcdir)/cp/parse.h): Remove target. ($(srcdir)/cp/parse.c): Likewise. (gt-cp-parse.h): Likewise. (gt-cp-parser.h): New target. (c++.distclean): Do not remove parse.output. (c++.maintainer-clean): Do not remove parse.c or parse.h. (cp/spew.o): Remove target. (cp/lex.o): Adjust dependencies. (cp/pt.o): Likewise. (cp/parse.o): Likewise. (cp/TAGS): Do not mention parse.c. (cp/parser.o): New target. * NEWS: Mention the new parser. * call.c (build_scoped_method_call): Simplify. (build_method_call): Likewise. (build_new_function_call): Adjust calls to add_function_candidate and add_template_candidate. (build_new_op): Improve handling of erroroneous operands. (convert_default_arg): Remove circular argument processing. (name_as_c_string): New function. (build_new_method_call): Use it. (perform_implicit_conversion): Use error_operand_p. * class.c (finish_struct_anon): Use constructor_name_p. (check_field_decls): Likewise. (pop_nested_class): Use OVL_NEXT, not OVL_CHAIN. (resolve_address_of_overloaded_function): Likewise. (instantiate_type): Tweak pointer-to-member handling. (get_primary_binfo): Remove incorrect assertion. * config-lang.in (gtfiles): Add parser.c, remove parse.c. * cp-tree.h (DEFARG_TOKENS): New macro. (default_arg): New structure. (cp_tree_node_structure_enum): Add TS_CP_DEFAULT_ARG. (lang_tree_node): Add default_arg. (cp_tree_index): Add CPTI_TYPE_INFO_REF_TYPE. (type_info_ref_type): New macro. (saved_scope): Make processing_explicit_instantiation a boolean. (check_access): New field. (unparsed_text): Remove. (language_function): Remove unparsed_inlines. (error_operand_p): New macro. (lang_decl): Adjust pending_inline_info. (DEFARG_POINTER): Remove. (tag_types): Add typenames. (lookup_ualified_name): Declare. (lookup_name_real): Likewise. (shadow_tag): Adjust prototype. (get_scope_of_declarator): Declare it. (process_next_inline): Remove it. (check_for_missing_semicolon): Likewise. (maybe_get_template_decl_from_type_decl): Declare it. (finish_label_stmt): Adjust prototype. (finish_non_static_data_meber): Declare it. (finish_pseudo_destructor_call_expr): Rename to ... (finish_pseudo_destructor_expr): ... this. (finish_compound_literal): Declare it. (begin_inline_definitions): Remove it. (init_spew): Remove. (peekyylex): Likewise. (arbitrate_lookup): Likewise. (frob_opname): Likewise. (maybe_snarf_defarg): Likewise. (add_defarg_fn): Likewise. (do_pending_defargs): Likewise. (done_pending_defargs): Likewise. (unprocessed_defarg_fn): Likewise. (replace_defarg): Likewise. (end_input): Likewise. (get_overloaded_fn): Likewise. * cvt.c (convert_to_reference): Improve error handling. * decl.c (lookup_name_real): Do not declare it static. (maybe_push_to_top_level): Set check_access. (identifier_type_value): Adjust call to lookup_name_real. (lookup_qualified_name): New method. (lookup_name_real): Remove special-case parsing code. (lookup_name-nonclass): Adjust call to lookup_name_real. (lookup_name_namespace_only): Likewise. (lookup_name): Likewise. (check_tag_decl): Return the type declared. (shadow_tag): Likewise. (register_dtor_fn): Tweak check_access. (grokfndecl): Use constructor_name_p. (get_scope_of_declarator): New function. (grokdeclarator): Obscure tweaks for slightly different declarator representations. (start_method): Return error_mark_node to indicate failure. (cp_tree_node_structure_enum): Use TS_CP_DEFAULT_ARG for DEFAULT_ARGs. * decl2.c (constructor_name_full): Simplify. (constructor_name): Use it. (build_expr_from_tree): Adjust for changes to do new parser. (push_scope): Improve robustness. (validate_nonmember_using_decl): Process declarations, not names. (do_class_using_decl): Likewise. (handle_class_head): Do not mess with CLASSTYPE_DECLARED_CLASS here. * error.c (dump_expr): Handle IDENTIFIER_NODEs and BASELINKs. * expr.c (cxx_expand_expr): Handle BASELINKs. * init.c (member_init_ok_or_else): Issue more errors. (build_offset_ref): Tweak handling of FUNCTION_DECLs. * lex.c: Do not include parse.h. (yypring): Do not declare. (yylval): Likewise. (make_reference_declarator): Remove error-generating code. (rid_to_yy): Remove. (cxx_init): Do not call init_spew. (yypring): Remove. (check_for_missing_semicolon): Remove. * lex.h (got_scope): Remove. (got_object): Remove. * method.c (hack_identifier): Use finish_non_static_data_member. (implicitly_declare_fn): Adjust use of constructor_name. * parser.c: New file. * pt.c (parse.h): Do not include it. (maybe_get_template_decl_from_template): Do not declare it. (finish_member_template_decl): Tweak. (begin_explicit_instantiation): Adjust for processing_explicit_instantiation being boolean. (end_explicit_instantiation): Likewise. (maybe_process_partial_specialization): Tighten specialization test. (retrieve_local_specialization): Adjust ue of hash table. (eq_local_specializations): New function. (register_local_specialization): Likewise. (push_template_decl_real): Remove unnecessary test. (maybe_get_template_decl_from_type_decl): Don't make it static. (for_each_template_parm_r): Handle TYPEOF_TYPE. (tsubst_copy): Use retrieive_local_specialization to handle PARM_DECL. Adjust handling of CONST_DECLs. Handle BASELINKs. Handle COMPONENT_REFs with pseudo-destructor-expressions. Simplify handling of CALL_EXPR and METHOD_CALL_EXPR. (tsubst_expr): Pass decls, not names, to do_local_using_decl. (unify): Tweak handling of CONST_DECLs. (regenerate_decl_from_template): Use push_nested_class. (template_for_substitution): New funciton. (instantiate_decl): Use it. Register parameters as local specializations. * rtti.c (init_rtti_processing): Set type_info_ref_type. (build_typeid): Use it. (get_typeid): Likeise. * search.c (accessible_p): Use check_access, not flag_access_control. (adjust_result_of_qualified_name_lookup): Pay attention to the context_class. * semantics.c (finish_asm_stmt): Adjust error handling. (finish_label_stmt): Return the statement. (finish_non_static_data_member): New function. (finish_class_expr): Handle BASELINKs. (finish_call_expr): Handle PSEUDO_DTOR_EXPR. (finish_object_call_expr): Simplify handling during templates. (finish_pseudo_destructor_call_expr): Rename to ... (finish_pseudo_dtor_expr): ... this. (finish_compound_literal): New function. (begin_inline_definitions): Remove. (finish_sizeof): Remove special template handling. * spew.c: Do not include parse.h. * tree.c (get_overloaded_fn): Remove. * typeck.c (build_class_member_access_expr): Handle PSEUDO_DTOR_EXPR. Adjust handling of static member functions. (lookup_destructor): New function. (finish_class_member_access_expr): Use it. (convert_arguments): Simplify. (build_unary_op): Handle BASELINKs. From-SVN: r60560
2002-12-28 09:03:42 +01:00
else if (TREE_CODE (fn) == PSEUDO_DTOR_EXPR)
{
if (args)
error ("arguments to destructor are not allowed");
/* Mark the pseudo-destructor call as having side-effects so
that we do not issue warnings about its use. */
result = build1 (NOP_EXPR,
void_type_node,
TREE_OPERAND (fn, 0));
TREE_SIDE_EFFECTS (result) = 1;
}
call.c (build_field_call): Do not look up the field by name. * call.c (build_field_call): Do not look up the field by name. (build_method_call): Simplify. (struct z_candidate): Add access_path and conversion_path. Remove basetype_path. (convert_class_to_reference): Adjust use of add_function_candidate. (add_candidate): Add conversion_path argument. (add_function_candidate): Use it. (add_conv_dndidate): Likewise. (build_builtin_candidate): Likewise. (add_template_candidate_real): Add conversion_path argument. (add_template_conv_candidate): Likewise. (add_template_candidate): Likewise. (build_user_type_conversion_1): Use it. (build_new_function_call): Remove name lookup code. Adjust use of add_template_candidate and add_function_candidate. (build_new_op): Likewise. (convert_like_real): Use build_special_member_call. (build_over_call): Use cand->conversion_path. (build_special_member_call): New method. (build_new_method_call): Remove name lookup code. * cp-tree.def (OFFSET_REF): Update documentation. (TEMPLATE_ID_EXPR): Likewise. * cp-tree.h (BASELINK_ACCESS_BINFO): New macro. (BASELINK_OPTYPE): Likewise. (build_new_method_call): Adjust prototype. (build_special_member_call): New method. (build_baselink): New method. (build_offset_ref_call_from_tree): Likewise. (build_call_from_tree): Likewise. (finish_qualified_call_expr): Remove. (finish_call_expr): Adjust prototype. (build_x_function_call): Remove. * cvt.c (ocp_convert): Use build_special_member_call. * decl2.c (reparse_absdcl_as_expr): Use finish_call_expr. (build_expr_from_tree): Adjust handling for TEMPLATE_ID_EXPR and CALL_EXPR. (build_offset_ref_call_from_tree): New function. (build_call_from_tree): Likewise. * init.c (expand_cleanup): Use build_special_member_call. (expand_default_init): Likewise. (build_member_call): Use finish_call_expr. (build_new_1): Use build_special_member_call. (push_base_cleanups): Likewise. * method.c (do_build_assign_ref): Likewise. * parse.y (template_id): Do not pass a COMPONENT_REF to lookup_template_function. (primary): Use parse_finish_call_epxr, not finish_call_expr. (parse_finish_call_expr): New function. * pt.c (lookup_template_function): Add assertions. * search.c (lookup_base): Allow T to be a binfo. (build_baselink): New function. (lookup_member): Use it. * semantics.c (finish_call_expr): Do not do name lookup. (finish_object_call_expr): Remove #if 0'd code. (finish_qualified_call_expr): Remove. * typeck.c (build_x_function_call): Remove. (build_static_case): Use build_special_member_call. * typeck2.c (build_functional_cast): Likewise. * g++.dg/inherit/operator1.C: New test. * g++.dg/lookup/disamb1.C: Fix typo in comment. * g++.dg/other/error1.C: Change expected error message. * g++.dg/template/conv4.C: Likewise. From-SVN: r55920
2002-08-01 06:46:23 +02:00
else if (CLASS_TYPE_P (TREE_TYPE (fn)))
fold-const.c (make_range): Do not access operand 1 for a zero-operand operator. * fold-const.c (make_range): Do not access operand 1 for a zero-operand operator. 2003-07-08 Mark Mitchell <mark@codesourcery.com> * cp-tree.def (NON_DEPENDENT_EXPR): New node. * cp-tree.h (build_call_from_tree): Remove. (build_member_call): Likewise. (dependent_template_arg_p): Remove. (any_dependent_template_arguments_p): New function. (dependent_template_id_p): Likewise. (any_type_dependent_arguments_p): Likewise. (build_non_dependent_expr): Likewise. (build_non_dependent_args): Likewise. (build_x_compound_expr): Adjust prototype. * call.c (build_new_method_call): Handle non-dependent expressions correctly. * decl2.c (grok_array_decl): Likewise. (build_offset_ref_call_from_tree): Likewise. (build_call_from_tree): Remove. * error.c (dump_decl): Handle NON_DEPENDENT_EXPR. (dump_expr): Likewise. * init.c (build_member_call): Remove. * mangle.c (write_expression): Update handling for template-ids. * parser.c (cp_parser_primary_expression): Use any_dependent_template_arguments_p. Update constant-expression handling. (cp_parser_postfix_expression): Use any_type_dependent_arguments_p. Simplify call processing. (cp_parser_unary_expression): Simplify. (cp_parser_expression): Adjust for changes to build_x_compound_expr. (cp_parser_template_argument): Implement standard-conforming parsing of non-type template arguments. (cp_parser_direct_declarator): Use cp_parser_fold_non_dependent_expr. (cp_parser_fold_non_dependent_expr): New function. (cp_parser_next_token_ends_template_argument_p): Likewise. * pt.c (convert_template_argument): Do not call maybe_fold_nontype_arg. (tsubst_baselink): Likewise. (tsubst_copy_and_build): Share common code. Make sizeof/alignof processing work correctly for non-dependent expressions. Adjust handling of COMPOUND_EXPR. Simplify call processing. (value_dependent_expression_p): Deal with functional casts and sizeof/alignof correctly. (type_dependent_expression_p): Handle overloaded functions. (any_type_dependent_arguments_p): New function. (any_dependent_template_arguments_p): Likewise. (dependent_template_p): Treat SCOPE_REFs as dependent. (dependent_template_id_p): Simplify. (build_non_dependent_expr): New function. (build_non_dependent_args): Likewise. * semantics.c (finish_stmt_expr): Don't make dependent statement-expresions have void type. (finish_call_expr): Handle non-dependent expressions correctly. * tree.c (lvalue_p_1): Treat NON_DEPENDENT_EXPRs as lvalues. * typeck.c (cxx_sizeof_or_alignof_type): Give the expression type size_t, even in templates. (expr_sizeof): Likewise. (finish_class_member_access_expr): Handle non-dependent expressions correctly. (build_x_indirect_ref): Likewise. (build_x_binary_op): Likewise. (build_x_unary_op): Likewise. (build_x_conditional_expr): Likewise. (build_x_compound_expr): Likewise. * typeck2.c (build_x_arrow): Likewise. 2003-07-08 Mark Mitchell <mark@codesourcery.com> * g++.dg/abi/mangle17.C: Make sure template expressions are dependent. * g++.dg/abi/mangle4.C: Mark erroneous casts. * g++.dg/debug/debug7.C: Mark erronous new-declarator. * g++.dg/opt/stack1.C: Remove erroneous code. * g++.dg/parse/template7.C: New test. * g++.dg/template/dependent-expr1.C: Mark erroneous code. * g++.old-deja/g++.pt/crash4.C: Likewise. 2003-07-09 Mark Mitchell <mark@codesourcery.com> * gcj/array.h (JvPrimClass): Don't parenthesize the output. From-SVN: r69130
2003-07-09 10:48:08 +02:00
/* If the "function" is really an object of class type, it might
have an overloaded `operator ()'. */
result = build_new_op (CALL_EXPR, LOOKUP_NORMAL, fn, args, NULL_TREE);
if (!result)
/* A call where the function is unknown. */
result = build_function_call (fn, args);
call.c (build_field_call): Do not look up the field by name. * call.c (build_field_call): Do not look up the field by name. (build_method_call): Simplify. (struct z_candidate): Add access_path and conversion_path. Remove basetype_path. (convert_class_to_reference): Adjust use of add_function_candidate. (add_candidate): Add conversion_path argument. (add_function_candidate): Use it. (add_conv_dndidate): Likewise. (build_builtin_candidate): Likewise. (add_template_candidate_real): Add conversion_path argument. (add_template_conv_candidate): Likewise. (add_template_candidate): Likewise. (build_user_type_conversion_1): Use it. (build_new_function_call): Remove name lookup code. Adjust use of add_template_candidate and add_function_candidate. (build_new_op): Likewise. (convert_like_real): Use build_special_member_call. (build_over_call): Use cand->conversion_path. (build_special_member_call): New method. (build_new_method_call): Remove name lookup code. * cp-tree.def (OFFSET_REF): Update documentation. (TEMPLATE_ID_EXPR): Likewise. * cp-tree.h (BASELINK_ACCESS_BINFO): New macro. (BASELINK_OPTYPE): Likewise. (build_new_method_call): Adjust prototype. (build_special_member_call): New method. (build_baselink): New method. (build_offset_ref_call_from_tree): Likewise. (build_call_from_tree): Likewise. (finish_qualified_call_expr): Remove. (finish_call_expr): Adjust prototype. (build_x_function_call): Remove. * cvt.c (ocp_convert): Use build_special_member_call. * decl2.c (reparse_absdcl_as_expr): Use finish_call_expr. (build_expr_from_tree): Adjust handling for TEMPLATE_ID_EXPR and CALL_EXPR. (build_offset_ref_call_from_tree): New function. (build_call_from_tree): Likewise. * init.c (expand_cleanup): Use build_special_member_call. (expand_default_init): Likewise. (build_member_call): Use finish_call_expr. (build_new_1): Use build_special_member_call. (push_base_cleanups): Likewise. * method.c (do_build_assign_ref): Likewise. * parse.y (template_id): Do not pass a COMPONENT_REF to lookup_template_function. (primary): Use parse_finish_call_epxr, not finish_call_expr. (parse_finish_call_expr): New function. * pt.c (lookup_template_function): Add assertions. * search.c (lookup_base): Allow T to be a binfo. (build_baselink): New function. (lookup_member): Use it. * semantics.c (finish_call_expr): Do not do name lookup. (finish_object_call_expr): Remove #if 0'd code. (finish_qualified_call_expr): Remove. * typeck.c (build_x_function_call): Remove. (build_static_case): Use build_special_member_call. * typeck2.c (build_functional_cast): Likewise. * g++.dg/inherit/operator1.C: New test. * g++.dg/lookup/disamb1.C: Fix typo in comment. * g++.dg/other/error1.C: Change expected error message. * g++.dg/template/conv4.C: Likewise. From-SVN: r55920
2002-08-01 06:46:23 +02:00
fold-const.c (make_range): Do not access operand 1 for a zero-operand operator. * fold-const.c (make_range): Do not access operand 1 for a zero-operand operator. 2003-07-08 Mark Mitchell <mark@codesourcery.com> * cp-tree.def (NON_DEPENDENT_EXPR): New node. * cp-tree.h (build_call_from_tree): Remove. (build_member_call): Likewise. (dependent_template_arg_p): Remove. (any_dependent_template_arguments_p): New function. (dependent_template_id_p): Likewise. (any_type_dependent_arguments_p): Likewise. (build_non_dependent_expr): Likewise. (build_non_dependent_args): Likewise. (build_x_compound_expr): Adjust prototype. * call.c (build_new_method_call): Handle non-dependent expressions correctly. * decl2.c (grok_array_decl): Likewise. (build_offset_ref_call_from_tree): Likewise. (build_call_from_tree): Remove. * error.c (dump_decl): Handle NON_DEPENDENT_EXPR. (dump_expr): Likewise. * init.c (build_member_call): Remove. * mangle.c (write_expression): Update handling for template-ids. * parser.c (cp_parser_primary_expression): Use any_dependent_template_arguments_p. Update constant-expression handling. (cp_parser_postfix_expression): Use any_type_dependent_arguments_p. Simplify call processing. (cp_parser_unary_expression): Simplify. (cp_parser_expression): Adjust for changes to build_x_compound_expr. (cp_parser_template_argument): Implement standard-conforming parsing of non-type template arguments. (cp_parser_direct_declarator): Use cp_parser_fold_non_dependent_expr. (cp_parser_fold_non_dependent_expr): New function. (cp_parser_next_token_ends_template_argument_p): Likewise. * pt.c (convert_template_argument): Do not call maybe_fold_nontype_arg. (tsubst_baselink): Likewise. (tsubst_copy_and_build): Share common code. Make sizeof/alignof processing work correctly for non-dependent expressions. Adjust handling of COMPOUND_EXPR. Simplify call processing. (value_dependent_expression_p): Deal with functional casts and sizeof/alignof correctly. (type_dependent_expression_p): Handle overloaded functions. (any_type_dependent_arguments_p): New function. (any_dependent_template_arguments_p): Likewise. (dependent_template_p): Treat SCOPE_REFs as dependent. (dependent_template_id_p): Simplify. (build_non_dependent_expr): New function. (build_non_dependent_args): Likewise. * semantics.c (finish_stmt_expr): Don't make dependent statement-expresions have void type. (finish_call_expr): Handle non-dependent expressions correctly. * tree.c (lvalue_p_1): Treat NON_DEPENDENT_EXPRs as lvalues. * typeck.c (cxx_sizeof_or_alignof_type): Give the expression type size_t, even in templates. (expr_sizeof): Likewise. (finish_class_member_access_expr): Handle non-dependent expressions correctly. (build_x_indirect_ref): Likewise. (build_x_binary_op): Likewise. (build_x_unary_op): Likewise. (build_x_conditional_expr): Likewise. (build_x_compound_expr): Likewise. * typeck2.c (build_x_arrow): Likewise. 2003-07-08 Mark Mitchell <mark@codesourcery.com> * g++.dg/abi/mangle17.C: Make sure template expressions are dependent. * g++.dg/abi/mangle4.C: Mark erroneous casts. * g++.dg/debug/debug7.C: Mark erronous new-declarator. * g++.dg/opt/stack1.C: Remove erroneous code. * g++.dg/parse/template7.C: New test. * g++.dg/template/dependent-expr1.C: Mark erroneous code. * g++.old-deja/g++.pt/crash4.C: Likewise. 2003-07-09 Mark Mitchell <mark@codesourcery.com> * gcj/array.h (JvPrimClass): Don't parenthesize the output. From-SVN: r69130
2003-07-09 10:48:08 +02:00
if (processing_template_decl)
{
result = build (CALL_EXPR, TREE_TYPE (result), orig_fn, orig_args);
KOENIG_LOOKUP_P (result) = koenig_p;
}
fold-const.c (make_range): Do not access operand 1 for a zero-operand operator. * fold-const.c (make_range): Do not access operand 1 for a zero-operand operator. 2003-07-08 Mark Mitchell <mark@codesourcery.com> * cp-tree.def (NON_DEPENDENT_EXPR): New node. * cp-tree.h (build_call_from_tree): Remove. (build_member_call): Likewise. (dependent_template_arg_p): Remove. (any_dependent_template_arguments_p): New function. (dependent_template_id_p): Likewise. (any_type_dependent_arguments_p): Likewise. (build_non_dependent_expr): Likewise. (build_non_dependent_args): Likewise. (build_x_compound_expr): Adjust prototype. * call.c (build_new_method_call): Handle non-dependent expressions correctly. * decl2.c (grok_array_decl): Likewise. (build_offset_ref_call_from_tree): Likewise. (build_call_from_tree): Remove. * error.c (dump_decl): Handle NON_DEPENDENT_EXPR. (dump_expr): Likewise. * init.c (build_member_call): Remove. * mangle.c (write_expression): Update handling for template-ids. * parser.c (cp_parser_primary_expression): Use any_dependent_template_arguments_p. Update constant-expression handling. (cp_parser_postfix_expression): Use any_type_dependent_arguments_p. Simplify call processing. (cp_parser_unary_expression): Simplify. (cp_parser_expression): Adjust for changes to build_x_compound_expr. (cp_parser_template_argument): Implement standard-conforming parsing of non-type template arguments. (cp_parser_direct_declarator): Use cp_parser_fold_non_dependent_expr. (cp_parser_fold_non_dependent_expr): New function. (cp_parser_next_token_ends_template_argument_p): Likewise. * pt.c (convert_template_argument): Do not call maybe_fold_nontype_arg. (tsubst_baselink): Likewise. (tsubst_copy_and_build): Share common code. Make sizeof/alignof processing work correctly for non-dependent expressions. Adjust handling of COMPOUND_EXPR. Simplify call processing. (value_dependent_expression_p): Deal with functional casts and sizeof/alignof correctly. (type_dependent_expression_p): Handle overloaded functions. (any_type_dependent_arguments_p): New function. (any_dependent_template_arguments_p): Likewise. (dependent_template_p): Treat SCOPE_REFs as dependent. (dependent_template_id_p): Simplify. (build_non_dependent_expr): New function. (build_non_dependent_args): Likewise. * semantics.c (finish_stmt_expr): Don't make dependent statement-expresions have void type. (finish_call_expr): Handle non-dependent expressions correctly. * tree.c (lvalue_p_1): Treat NON_DEPENDENT_EXPRs as lvalues. * typeck.c (cxx_sizeof_or_alignof_type): Give the expression type size_t, even in templates. (expr_sizeof): Likewise. (finish_class_member_access_expr): Handle non-dependent expressions correctly. (build_x_indirect_ref): Likewise. (build_x_binary_op): Likewise. (build_x_unary_op): Likewise. (build_x_conditional_expr): Likewise. (build_x_compound_expr): Likewise. * typeck2.c (build_x_arrow): Likewise. 2003-07-08 Mark Mitchell <mark@codesourcery.com> * g++.dg/abi/mangle17.C: Make sure template expressions are dependent. * g++.dg/abi/mangle4.C: Mark erroneous casts. * g++.dg/debug/debug7.C: Mark erronous new-declarator. * g++.dg/opt/stack1.C: Remove erroneous code. * g++.dg/parse/template7.C: New test. * g++.dg/template/dependent-expr1.C: Mark erroneous code. * g++.old-deja/g++.pt/crash4.C: Likewise. 2003-07-09 Mark Mitchell <mark@codesourcery.com> * gcj/array.h (JvPrimClass): Don't parenthesize the output. From-SVN: r69130
2003-07-09 10:48:08 +02:00
return result;
}
/* Finish a call to a postfix increment or decrement or EXPR. (Which
is indicated by CODE, which should be POSTINCREMENT_EXPR or
POSTDECREMENT_EXPR.) */
tree
finish_increment_expr (tree expr, enum tree_code code)
{
return build_x_unary_op (code, expr);
}
/* Finish a use of `this'. Returns an expression for `this'. */
tree
finish_this_expr (void)
{
tree result;
if (current_class_ptr)
{
result = current_class_ptr;
}
else if (current_function_decl
&& DECL_STATIC_FUNCTION_P (current_function_decl))
{
error ("`this' is unavailable for static member functions");
result = error_mark_node;
}
else
{
if (current_function_decl)
error ("invalid use of `this' in non-member function");
else
error ("invalid use of `this' at top level");
result = error_mark_node;
}
return result;
}
/* Finish a member function call using OBJECT and ARGS as arguments to
FN. Returns an expression for the call. */
tree
finish_object_call_expr (tree fn, tree object, tree args)
{
if (DECL_DECLARES_TYPE_P (fn))
{
if (processing_template_decl)
/* This can happen on code like:
class X;
template <class T> void f(T t) {
t.X();
}
We just grab the underlying IDENTIFIER. */
fn = DECL_NAME (fn);
else
{
error ("calling type `%T' like a method", fn);
return error_mark_node;
}
}
call.c (build_field_call): Do not look up the field by name. * call.c (build_field_call): Do not look up the field by name. (build_method_call): Simplify. (struct z_candidate): Add access_path and conversion_path. Remove basetype_path. (convert_class_to_reference): Adjust use of add_function_candidate. (add_candidate): Add conversion_path argument. (add_function_candidate): Use it. (add_conv_dndidate): Likewise. (build_builtin_candidate): Likewise. (add_template_candidate_real): Add conversion_path argument. (add_template_conv_candidate): Likewise. (add_template_candidate): Likewise. (build_user_type_conversion_1): Use it. (build_new_function_call): Remove name lookup code. Adjust use of add_template_candidate and add_function_candidate. (build_new_op): Likewise. (convert_like_real): Use build_special_member_call. (build_over_call): Use cand->conversion_path. (build_special_member_call): New method. (build_new_method_call): Remove name lookup code. * cp-tree.def (OFFSET_REF): Update documentation. (TEMPLATE_ID_EXPR): Likewise. * cp-tree.h (BASELINK_ACCESS_BINFO): New macro. (BASELINK_OPTYPE): Likewise. (build_new_method_call): Adjust prototype. (build_special_member_call): New method. (build_baselink): New method. (build_offset_ref_call_from_tree): Likewise. (build_call_from_tree): Likewise. (finish_qualified_call_expr): Remove. (finish_call_expr): Adjust prototype. (build_x_function_call): Remove. * cvt.c (ocp_convert): Use build_special_member_call. * decl2.c (reparse_absdcl_as_expr): Use finish_call_expr. (build_expr_from_tree): Adjust handling for TEMPLATE_ID_EXPR and CALL_EXPR. (build_offset_ref_call_from_tree): New function. (build_call_from_tree): Likewise. * init.c (expand_cleanup): Use build_special_member_call. (expand_default_init): Likewise. (build_member_call): Use finish_call_expr. (build_new_1): Use build_special_member_call. (push_base_cleanups): Likewise. * method.c (do_build_assign_ref): Likewise. * parse.y (template_id): Do not pass a COMPONENT_REF to lookup_template_function. (primary): Use parse_finish_call_epxr, not finish_call_expr. (parse_finish_call_expr): New function. * pt.c (lookup_template_function): Add assertions. * search.c (lookup_base): Allow T to be a binfo. (build_baselink): New function. (lookup_member): Use it. * semantics.c (finish_call_expr): Do not do name lookup. (finish_object_call_expr): Remove #if 0'd code. (finish_qualified_call_expr): Remove. * typeck.c (build_x_function_call): Remove. (build_static_case): Use build_special_member_call. * typeck2.c (build_functional_cast): Likewise. * g++.dg/inherit/operator1.C: New test. * g++.dg/lookup/disamb1.C: Fix typo in comment. * g++.dg/other/error1.C: Change expected error message. * g++.dg/template/conv4.C: Likewise. From-SVN: r55920
2002-08-01 06:46:23 +02:00
Make-lang.in (po-generated): Remove parse.c. * Make-lang.in (po-generated): Remove parse.c. (CXX_OBJS): Remove parse.o and spew.o. Add parser.o. ($(srcdir)/cp/parse.h): Remove target. ($(srcdir)/cp/parse.c): Likewise. (gt-cp-parse.h): Likewise. (gt-cp-parser.h): New target. (c++.distclean): Do not remove parse.output. (c++.maintainer-clean): Do not remove parse.c or parse.h. (cp/spew.o): Remove target. (cp/lex.o): Adjust dependencies. (cp/pt.o): Likewise. (cp/parse.o): Likewise. (cp/TAGS): Do not mention parse.c. (cp/parser.o): New target. * NEWS: Mention the new parser. * call.c (build_scoped_method_call): Simplify. (build_method_call): Likewise. (build_new_function_call): Adjust calls to add_function_candidate and add_template_candidate. (build_new_op): Improve handling of erroroneous operands. (convert_default_arg): Remove circular argument processing. (name_as_c_string): New function. (build_new_method_call): Use it. (perform_implicit_conversion): Use error_operand_p. * class.c (finish_struct_anon): Use constructor_name_p. (check_field_decls): Likewise. (pop_nested_class): Use OVL_NEXT, not OVL_CHAIN. (resolve_address_of_overloaded_function): Likewise. (instantiate_type): Tweak pointer-to-member handling. (get_primary_binfo): Remove incorrect assertion. * config-lang.in (gtfiles): Add parser.c, remove parse.c. * cp-tree.h (DEFARG_TOKENS): New macro. (default_arg): New structure. (cp_tree_node_structure_enum): Add TS_CP_DEFAULT_ARG. (lang_tree_node): Add default_arg. (cp_tree_index): Add CPTI_TYPE_INFO_REF_TYPE. (type_info_ref_type): New macro. (saved_scope): Make processing_explicit_instantiation a boolean. (check_access): New field. (unparsed_text): Remove. (language_function): Remove unparsed_inlines. (error_operand_p): New macro. (lang_decl): Adjust pending_inline_info. (DEFARG_POINTER): Remove. (tag_types): Add typenames. (lookup_ualified_name): Declare. (lookup_name_real): Likewise. (shadow_tag): Adjust prototype. (get_scope_of_declarator): Declare it. (process_next_inline): Remove it. (check_for_missing_semicolon): Likewise. (maybe_get_template_decl_from_type_decl): Declare it. (finish_label_stmt): Adjust prototype. (finish_non_static_data_meber): Declare it. (finish_pseudo_destructor_call_expr): Rename to ... (finish_pseudo_destructor_expr): ... this. (finish_compound_literal): Declare it. (begin_inline_definitions): Remove it. (init_spew): Remove. (peekyylex): Likewise. (arbitrate_lookup): Likewise. (frob_opname): Likewise. (maybe_snarf_defarg): Likewise. (add_defarg_fn): Likewise. (do_pending_defargs): Likewise. (done_pending_defargs): Likewise. (unprocessed_defarg_fn): Likewise. (replace_defarg): Likewise. (end_input): Likewise. (get_overloaded_fn): Likewise. * cvt.c (convert_to_reference): Improve error handling. * decl.c (lookup_name_real): Do not declare it static. (maybe_push_to_top_level): Set check_access. (identifier_type_value): Adjust call to lookup_name_real. (lookup_qualified_name): New method. (lookup_name_real): Remove special-case parsing code. (lookup_name-nonclass): Adjust call to lookup_name_real. (lookup_name_namespace_only): Likewise. (lookup_name): Likewise. (check_tag_decl): Return the type declared. (shadow_tag): Likewise. (register_dtor_fn): Tweak check_access. (grokfndecl): Use constructor_name_p. (get_scope_of_declarator): New function. (grokdeclarator): Obscure tweaks for slightly different declarator representations. (start_method): Return error_mark_node to indicate failure. (cp_tree_node_structure_enum): Use TS_CP_DEFAULT_ARG for DEFAULT_ARGs. * decl2.c (constructor_name_full): Simplify. (constructor_name): Use it. (build_expr_from_tree): Adjust for changes to do new parser. (push_scope): Improve robustness. (validate_nonmember_using_decl): Process declarations, not names. (do_class_using_decl): Likewise. (handle_class_head): Do not mess with CLASSTYPE_DECLARED_CLASS here. * error.c (dump_expr): Handle IDENTIFIER_NODEs and BASELINKs. * expr.c (cxx_expand_expr): Handle BASELINKs. * init.c (member_init_ok_or_else): Issue more errors. (build_offset_ref): Tweak handling of FUNCTION_DECLs. * lex.c: Do not include parse.h. (yypring): Do not declare. (yylval): Likewise. (make_reference_declarator): Remove error-generating code. (rid_to_yy): Remove. (cxx_init): Do not call init_spew. (yypring): Remove. (check_for_missing_semicolon): Remove. * lex.h (got_scope): Remove. (got_object): Remove. * method.c (hack_identifier): Use finish_non_static_data_member. (implicitly_declare_fn): Adjust use of constructor_name. * parser.c: New file. * pt.c (parse.h): Do not include it. (maybe_get_template_decl_from_template): Do not declare it. (finish_member_template_decl): Tweak. (begin_explicit_instantiation): Adjust for processing_explicit_instantiation being boolean. (end_explicit_instantiation): Likewise. (maybe_process_partial_specialization): Tighten specialization test. (retrieve_local_specialization): Adjust ue of hash table. (eq_local_specializations): New function. (register_local_specialization): Likewise. (push_template_decl_real): Remove unnecessary test. (maybe_get_template_decl_from_type_decl): Don't make it static. (for_each_template_parm_r): Handle TYPEOF_TYPE. (tsubst_copy): Use retrieive_local_specialization to handle PARM_DECL. Adjust handling of CONST_DECLs. Handle BASELINKs. Handle COMPONENT_REFs with pseudo-destructor-expressions. Simplify handling of CALL_EXPR and METHOD_CALL_EXPR. (tsubst_expr): Pass decls, not names, to do_local_using_decl. (unify): Tweak handling of CONST_DECLs. (regenerate_decl_from_template): Use push_nested_class. (template_for_substitution): New funciton. (instantiate_decl): Use it. Register parameters as local specializations. * rtti.c (init_rtti_processing): Set type_info_ref_type. (build_typeid): Use it. (get_typeid): Likeise. * search.c (accessible_p): Use check_access, not flag_access_control. (adjust_result_of_qualified_name_lookup): Pay attention to the context_class. * semantics.c (finish_asm_stmt): Adjust error handling. (finish_label_stmt): Return the statement. (finish_non_static_data_member): New function. (finish_class_expr): Handle BASELINKs. (finish_call_expr): Handle PSEUDO_DTOR_EXPR. (finish_object_call_expr): Simplify handling during templates. (finish_pseudo_destructor_call_expr): Rename to ... (finish_pseudo_dtor_expr): ... this. (finish_compound_literal): New function. (begin_inline_definitions): Remove. (finish_sizeof): Remove special template handling. * spew.c: Do not include parse.h. * tree.c (get_overloaded_fn): Remove. * typeck.c (build_class_member_access_expr): Handle PSEUDO_DTOR_EXPR. Adjust handling of static member functions. (lookup_destructor): New function. (finish_class_member_access_expr): Use it. (convert_arguments): Simplify. (build_unary_op): Handle BASELINKs. From-SVN: r60560
2002-12-28 09:03:42 +01:00
if (processing_template_decl)
return build_nt (CALL_EXPR,
build_nt (COMPONENT_REF, object, fn),
args);
Rework build_component_ref. * call.c (build_vfield_ref): Do not go through build_component_ref. (build_field_call): Use build_class_member_access_expr. (build_user_type_conversion_1): Use BASELINK_FUNCTIONS. (build_object_call): Likewise. * class.c (convert_to_base): New function. (type_requires_array_cookie): Use BASELINK_FUNCTIONS. (instantiate_type): Handle BASELINKs. * cp-tree.def (BASELINK): New tree code. * cp-tree.h (BASELINK_P): Reimplement. (SET_BASELINK_P): Remove. (BASELINK_BINFO): Reimplement. (BASELINK_FUNCTIONS): Likewise. (BASELINK_ACCESS_BINFO): Likewise. (BASELINK_OPTYPE): Likewise. (convert_to_base): New function. (name_p): Likewise. (build_object_ref): Remove. (build_component_ref_1): Likewise. (build_component_ref): Likewise. (build_x_component_ref): Likewise. (build_class_member_access_expr): New function. (finish_class_member_access_expr): Likewise. (build_ptrmemfunc_access_expr): Likewise. * decl.c (grokdeclarator): Handle BASELINKs. * decl2. (build_expr_from_tree): Handle COMPONENT_REFs by using finish_class_member_access_expr. (arg_assoc): Handle BASELINKs. (do_class_using_decl): Likewise. * error.c (dump_decl): Likewise. (dump_expr): Use build_ptrmemfunc_access_expr. * except.c (dtor_nothrow): Use CLASSTYPE_DESTRUCTORS to find destructors. (build_throw): Use BASELINK_FUNCTIONS. * init.c (perform_member_init): Use build_class_member_access_expr. (build_offset_ref): Handle BASELINKs. Use build_class_member_access_expr. * method.c (hack_identifier): Likewise. * parse.y (do_id): Use BASELINK, not TREE_LIST. (primary): Remove uses of build_object_ref. * pt.c (lookup_template_function): Handle BASELINKs. (resolve_overloaded_unification): Likewise. * search.c (build_baselink): Build a BASELINK, not a TREE_LIST. (lookup_field): Use BASELINK, not TREE_LIST. (lookup_fnfiels): Likewise. (setup_class_bindings): Likewise. * semantics.c (finish_object_call_expr): Do not use build_method_call when we already know what function is being called. * spew.c (identifier_type): Use BASELINK, not TREE_LIST. * tree.c (really_overloaded_fn): Use OVL_CHAIN for OVERLOADs, not TREE_CHAIN. (name_p): New function. * typeck.c (build_object_ref): Remove. (build_component_ref_1): Likewise. (build_x_component_ref): Likewise. (build_class_member_access_expr): New function. (finish_class_member_access_expr): Likewise. (build_ptrmemfunc_access_expr): Likewise. (get_member_function_from_ptrfunc): Use build_ptrmemfunc_access_expr. (build_binary_op): Likewise. (build_unary_op): Likewise. (build_ptrmemfunc): Likewise. (pfn_from_ptrmemfunc): Likewise. * typeck2.c (build_m_component_ref): Adjust comment. * g++.dg/abi/offsetof.C: Tweak error messages. * g++.old-deja/g++.mike/p10769a.C: Likewise. From-SVN: r56117
2002-08-08 07:48:39 +02:00
if (name_p (fn))
return build_method_call (object, fn, args, NULL_TREE, LOOKUP_NORMAL);
else
return build_new_method_call (object, fn, args, NULL_TREE, LOOKUP_NORMAL);
}
Make-lang.in (po-generated): Remove parse.c. * Make-lang.in (po-generated): Remove parse.c. (CXX_OBJS): Remove parse.o and spew.o. Add parser.o. ($(srcdir)/cp/parse.h): Remove target. ($(srcdir)/cp/parse.c): Likewise. (gt-cp-parse.h): Likewise. (gt-cp-parser.h): New target. (c++.distclean): Do not remove parse.output. (c++.maintainer-clean): Do not remove parse.c or parse.h. (cp/spew.o): Remove target. (cp/lex.o): Adjust dependencies. (cp/pt.o): Likewise. (cp/parse.o): Likewise. (cp/TAGS): Do not mention parse.c. (cp/parser.o): New target. * NEWS: Mention the new parser. * call.c (build_scoped_method_call): Simplify. (build_method_call): Likewise. (build_new_function_call): Adjust calls to add_function_candidate and add_template_candidate. (build_new_op): Improve handling of erroroneous operands. (convert_default_arg): Remove circular argument processing. (name_as_c_string): New function. (build_new_method_call): Use it. (perform_implicit_conversion): Use error_operand_p. * class.c (finish_struct_anon): Use constructor_name_p. (check_field_decls): Likewise. (pop_nested_class): Use OVL_NEXT, not OVL_CHAIN. (resolve_address_of_overloaded_function): Likewise. (instantiate_type): Tweak pointer-to-member handling. (get_primary_binfo): Remove incorrect assertion. * config-lang.in (gtfiles): Add parser.c, remove parse.c. * cp-tree.h (DEFARG_TOKENS): New macro. (default_arg): New structure. (cp_tree_node_structure_enum): Add TS_CP_DEFAULT_ARG. (lang_tree_node): Add default_arg. (cp_tree_index): Add CPTI_TYPE_INFO_REF_TYPE. (type_info_ref_type): New macro. (saved_scope): Make processing_explicit_instantiation a boolean. (check_access): New field. (unparsed_text): Remove. (language_function): Remove unparsed_inlines. (error_operand_p): New macro. (lang_decl): Adjust pending_inline_info. (DEFARG_POINTER): Remove. (tag_types): Add typenames. (lookup_ualified_name): Declare. (lookup_name_real): Likewise. (shadow_tag): Adjust prototype. (get_scope_of_declarator): Declare it. (process_next_inline): Remove it. (check_for_missing_semicolon): Likewise. (maybe_get_template_decl_from_type_decl): Declare it. (finish_label_stmt): Adjust prototype. (finish_non_static_data_meber): Declare it. (finish_pseudo_destructor_call_expr): Rename to ... (finish_pseudo_destructor_expr): ... this. (finish_compound_literal): Declare it. (begin_inline_definitions): Remove it. (init_spew): Remove. (peekyylex): Likewise. (arbitrate_lookup): Likewise. (frob_opname): Likewise. (maybe_snarf_defarg): Likewise. (add_defarg_fn): Likewise. (do_pending_defargs): Likewise. (done_pending_defargs): Likewise. (unprocessed_defarg_fn): Likewise. (replace_defarg): Likewise. (end_input): Likewise. (get_overloaded_fn): Likewise. * cvt.c (convert_to_reference): Improve error handling. * decl.c (lookup_name_real): Do not declare it static. (maybe_push_to_top_level): Set check_access. (identifier_type_value): Adjust call to lookup_name_real. (lookup_qualified_name): New method. (lookup_name_real): Remove special-case parsing code. (lookup_name-nonclass): Adjust call to lookup_name_real. (lookup_name_namespace_only): Likewise. (lookup_name): Likewise. (check_tag_decl): Return the type declared. (shadow_tag): Likewise. (register_dtor_fn): Tweak check_access. (grokfndecl): Use constructor_name_p. (get_scope_of_declarator): New function. (grokdeclarator): Obscure tweaks for slightly different declarator representations. (start_method): Return error_mark_node to indicate failure. (cp_tree_node_structure_enum): Use TS_CP_DEFAULT_ARG for DEFAULT_ARGs. * decl2.c (constructor_name_full): Simplify. (constructor_name): Use it. (build_expr_from_tree): Adjust for changes to do new parser. (push_scope): Improve robustness. (validate_nonmember_using_decl): Process declarations, not names. (do_class_using_decl): Likewise. (handle_class_head): Do not mess with CLASSTYPE_DECLARED_CLASS here. * error.c (dump_expr): Handle IDENTIFIER_NODEs and BASELINKs. * expr.c (cxx_expand_expr): Handle BASELINKs. * init.c (member_init_ok_or_else): Issue more errors. (build_offset_ref): Tweak handling of FUNCTION_DECLs. * lex.c: Do not include parse.h. (yypring): Do not declare. (yylval): Likewise. (make_reference_declarator): Remove error-generating code. (rid_to_yy): Remove. (cxx_init): Do not call init_spew. (yypring): Remove. (check_for_missing_semicolon): Remove. * lex.h (got_scope): Remove. (got_object): Remove. * method.c (hack_identifier): Use finish_non_static_data_member. (implicitly_declare_fn): Adjust use of constructor_name. * parser.c: New file. * pt.c (parse.h): Do not include it. (maybe_get_template_decl_from_template): Do not declare it. (finish_member_template_decl): Tweak. (begin_explicit_instantiation): Adjust for processing_explicit_instantiation being boolean. (end_explicit_instantiation): Likewise. (maybe_process_partial_specialization): Tighten specialization test. (retrieve_local_specialization): Adjust ue of hash table. (eq_local_specializations): New function. (register_local_specialization): Likewise. (push_template_decl_real): Remove unnecessary test. (maybe_get_template_decl_from_type_decl): Don't make it static. (for_each_template_parm_r): Handle TYPEOF_TYPE. (tsubst_copy): Use retrieive_local_specialization to handle PARM_DECL. Adjust handling of CONST_DECLs. Handle BASELINKs. Handle COMPONENT_REFs with pseudo-destructor-expressions. Simplify handling of CALL_EXPR and METHOD_CALL_EXPR. (tsubst_expr): Pass decls, not names, to do_local_using_decl. (unify): Tweak handling of CONST_DECLs. (regenerate_decl_from_template): Use push_nested_class. (template_for_substitution): New funciton. (instantiate_decl): Use it. Register parameters as local specializations. * rtti.c (init_rtti_processing): Set type_info_ref_type. (build_typeid): Use it. (get_typeid): Likeise. * search.c (accessible_p): Use check_access, not flag_access_control. (adjust_result_of_qualified_name_lookup): Pay attention to the context_class. * semantics.c (finish_asm_stmt): Adjust error handling. (finish_label_stmt): Return the statement. (finish_non_static_data_member): New function. (finish_class_expr): Handle BASELINKs. (finish_call_expr): Handle PSEUDO_DTOR_EXPR. (finish_object_call_expr): Simplify handling during templates. (finish_pseudo_destructor_call_expr): Rename to ... (finish_pseudo_dtor_expr): ... this. (finish_compound_literal): New function. (begin_inline_definitions): Remove. (finish_sizeof): Remove special template handling. * spew.c: Do not include parse.h. * tree.c (get_overloaded_fn): Remove. * typeck.c (build_class_member_access_expr): Handle PSEUDO_DTOR_EXPR. Adjust handling of static member functions. (lookup_destructor): New function. (finish_class_member_access_expr): Use it. (convert_arguments): Simplify. (build_unary_op): Handle BASELINKs. From-SVN: r60560
2002-12-28 09:03:42 +01:00
/* Finish a pseudo-destructor expression. If SCOPE is NULL, the
expression was of the form `OBJECT.~DESTRUCTOR' where DESTRUCTOR is
the TYPE for the type given. If SCOPE is non-NULL, the expression
was of the form `OBJECT.SCOPE::~DESTRUCTOR'. */
tree
finish_pseudo_destructor_expr (tree object, tree scope, tree destructor)
{
Make-lang.in (po-generated): Remove parse.c. * Make-lang.in (po-generated): Remove parse.c. (CXX_OBJS): Remove parse.o and spew.o. Add parser.o. ($(srcdir)/cp/parse.h): Remove target. ($(srcdir)/cp/parse.c): Likewise. (gt-cp-parse.h): Likewise. (gt-cp-parser.h): New target. (c++.distclean): Do not remove parse.output. (c++.maintainer-clean): Do not remove parse.c or parse.h. (cp/spew.o): Remove target. (cp/lex.o): Adjust dependencies. (cp/pt.o): Likewise. (cp/parse.o): Likewise. (cp/TAGS): Do not mention parse.c. (cp/parser.o): New target. * NEWS: Mention the new parser. * call.c (build_scoped_method_call): Simplify. (build_method_call): Likewise. (build_new_function_call): Adjust calls to add_function_candidate and add_template_candidate. (build_new_op): Improve handling of erroroneous operands. (convert_default_arg): Remove circular argument processing. (name_as_c_string): New function. (build_new_method_call): Use it. (perform_implicit_conversion): Use error_operand_p. * class.c (finish_struct_anon): Use constructor_name_p. (check_field_decls): Likewise. (pop_nested_class): Use OVL_NEXT, not OVL_CHAIN. (resolve_address_of_overloaded_function): Likewise. (instantiate_type): Tweak pointer-to-member handling. (get_primary_binfo): Remove incorrect assertion. * config-lang.in (gtfiles): Add parser.c, remove parse.c. * cp-tree.h (DEFARG_TOKENS): New macro. (default_arg): New structure. (cp_tree_node_structure_enum): Add TS_CP_DEFAULT_ARG. (lang_tree_node): Add default_arg. (cp_tree_index): Add CPTI_TYPE_INFO_REF_TYPE. (type_info_ref_type): New macro. (saved_scope): Make processing_explicit_instantiation a boolean. (check_access): New field. (unparsed_text): Remove. (language_function): Remove unparsed_inlines. (error_operand_p): New macro. (lang_decl): Adjust pending_inline_info. (DEFARG_POINTER): Remove. (tag_types): Add typenames. (lookup_ualified_name): Declare. (lookup_name_real): Likewise. (shadow_tag): Adjust prototype. (get_scope_of_declarator): Declare it. (process_next_inline): Remove it. (check_for_missing_semicolon): Likewise. (maybe_get_template_decl_from_type_decl): Declare it. (finish_label_stmt): Adjust prototype. (finish_non_static_data_meber): Declare it. (finish_pseudo_destructor_call_expr): Rename to ... (finish_pseudo_destructor_expr): ... this. (finish_compound_literal): Declare it. (begin_inline_definitions): Remove it. (init_spew): Remove. (peekyylex): Likewise. (arbitrate_lookup): Likewise. (frob_opname): Likewise. (maybe_snarf_defarg): Likewise. (add_defarg_fn): Likewise. (do_pending_defargs): Likewise. (done_pending_defargs): Likewise. (unprocessed_defarg_fn): Likewise. (replace_defarg): Likewise. (end_input): Likewise. (get_overloaded_fn): Likewise. * cvt.c (convert_to_reference): Improve error handling. * decl.c (lookup_name_real): Do not declare it static. (maybe_push_to_top_level): Set check_access. (identifier_type_value): Adjust call to lookup_name_real. (lookup_qualified_name): New method. (lookup_name_real): Remove special-case parsing code. (lookup_name-nonclass): Adjust call to lookup_name_real. (lookup_name_namespace_only): Likewise. (lookup_name): Likewise. (check_tag_decl): Return the type declared. (shadow_tag): Likewise. (register_dtor_fn): Tweak check_access. (grokfndecl): Use constructor_name_p. (get_scope_of_declarator): New function. (grokdeclarator): Obscure tweaks for slightly different declarator representations. (start_method): Return error_mark_node to indicate failure. (cp_tree_node_structure_enum): Use TS_CP_DEFAULT_ARG for DEFAULT_ARGs. * decl2.c (constructor_name_full): Simplify. (constructor_name): Use it. (build_expr_from_tree): Adjust for changes to do new parser. (push_scope): Improve robustness. (validate_nonmember_using_decl): Process declarations, not names. (do_class_using_decl): Likewise. (handle_class_head): Do not mess with CLASSTYPE_DECLARED_CLASS here. * error.c (dump_expr): Handle IDENTIFIER_NODEs and BASELINKs. * expr.c (cxx_expand_expr): Handle BASELINKs. * init.c (member_init_ok_or_else): Issue more errors. (build_offset_ref): Tweak handling of FUNCTION_DECLs. * lex.c: Do not include parse.h. (yypring): Do not declare. (yylval): Likewise. (make_reference_declarator): Remove error-generating code. (rid_to_yy): Remove. (cxx_init): Do not call init_spew. (yypring): Remove. (check_for_missing_semicolon): Remove. * lex.h (got_scope): Remove. (got_object): Remove. * method.c (hack_identifier): Use finish_non_static_data_member. (implicitly_declare_fn): Adjust use of constructor_name. * parser.c: New file. * pt.c (parse.h): Do not include it. (maybe_get_template_decl_from_template): Do not declare it. (finish_member_template_decl): Tweak. (begin_explicit_instantiation): Adjust for processing_explicit_instantiation being boolean. (end_explicit_instantiation): Likewise. (maybe_process_partial_specialization): Tighten specialization test. (retrieve_local_specialization): Adjust ue of hash table. (eq_local_specializations): New function. (register_local_specialization): Likewise. (push_template_decl_real): Remove unnecessary test. (maybe_get_template_decl_from_type_decl): Don't make it static. (for_each_template_parm_r): Handle TYPEOF_TYPE. (tsubst_copy): Use retrieive_local_specialization to handle PARM_DECL. Adjust handling of CONST_DECLs. Handle BASELINKs. Handle COMPONENT_REFs with pseudo-destructor-expressions. Simplify handling of CALL_EXPR and METHOD_CALL_EXPR. (tsubst_expr): Pass decls, not names, to do_local_using_decl. (unify): Tweak handling of CONST_DECLs. (regenerate_decl_from_template): Use push_nested_class. (template_for_substitution): New funciton. (instantiate_decl): Use it. Register parameters as local specializations. * rtti.c (init_rtti_processing): Set type_info_ref_type. (build_typeid): Use it. (get_typeid): Likeise. * search.c (accessible_p): Use check_access, not flag_access_control. (adjust_result_of_qualified_name_lookup): Pay attention to the context_class. * semantics.c (finish_asm_stmt): Adjust error handling. (finish_label_stmt): Return the statement. (finish_non_static_data_member): New function. (finish_class_expr): Handle BASELINKs. (finish_call_expr): Handle PSEUDO_DTOR_EXPR. (finish_object_call_expr): Simplify handling during templates. (finish_pseudo_destructor_call_expr): Rename to ... (finish_pseudo_dtor_expr): ... this. (finish_compound_literal): New function. (begin_inline_definitions): Remove. (finish_sizeof): Remove special template handling. * spew.c: Do not include parse.h. * tree.c (get_overloaded_fn): Remove. * typeck.c (build_class_member_access_expr): Handle PSEUDO_DTOR_EXPR. Adjust handling of static member functions. (lookup_destructor): New function. (finish_class_member_access_expr): Use it. (convert_arguments): Simplify. (build_unary_op): Handle BASELINKs. From-SVN: r60560
2002-12-28 09:03:42 +01:00
if (destructor == error_mark_node)
return error_mark_node;
Make-lang.in (po-generated): Remove parse.c. * Make-lang.in (po-generated): Remove parse.c. (CXX_OBJS): Remove parse.o and spew.o. Add parser.o. ($(srcdir)/cp/parse.h): Remove target. ($(srcdir)/cp/parse.c): Likewise. (gt-cp-parse.h): Likewise. (gt-cp-parser.h): New target. (c++.distclean): Do not remove parse.output. (c++.maintainer-clean): Do not remove parse.c or parse.h. (cp/spew.o): Remove target. (cp/lex.o): Adjust dependencies. (cp/pt.o): Likewise. (cp/parse.o): Likewise. (cp/TAGS): Do not mention parse.c. (cp/parser.o): New target. * NEWS: Mention the new parser. * call.c (build_scoped_method_call): Simplify. (build_method_call): Likewise. (build_new_function_call): Adjust calls to add_function_candidate and add_template_candidate. (build_new_op): Improve handling of erroroneous operands. (convert_default_arg): Remove circular argument processing. (name_as_c_string): New function. (build_new_method_call): Use it. (perform_implicit_conversion): Use error_operand_p. * class.c (finish_struct_anon): Use constructor_name_p. (check_field_decls): Likewise. (pop_nested_class): Use OVL_NEXT, not OVL_CHAIN. (resolve_address_of_overloaded_function): Likewise. (instantiate_type): Tweak pointer-to-member handling. (get_primary_binfo): Remove incorrect assertion. * config-lang.in (gtfiles): Add parser.c, remove parse.c. * cp-tree.h (DEFARG_TOKENS): New macro. (default_arg): New structure. (cp_tree_node_structure_enum): Add TS_CP_DEFAULT_ARG. (lang_tree_node): Add default_arg. (cp_tree_index): Add CPTI_TYPE_INFO_REF_TYPE. (type_info_ref_type): New macro. (saved_scope): Make processing_explicit_instantiation a boolean. (check_access): New field. (unparsed_text): Remove. (language_function): Remove unparsed_inlines. (error_operand_p): New macro. (lang_decl): Adjust pending_inline_info. (DEFARG_POINTER): Remove. (tag_types): Add typenames. (lookup_ualified_name): Declare. (lookup_name_real): Likewise. (shadow_tag): Adjust prototype. (get_scope_of_declarator): Declare it. (process_next_inline): Remove it. (check_for_missing_semicolon): Likewise. (maybe_get_template_decl_from_type_decl): Declare it. (finish_label_stmt): Adjust prototype. (finish_non_static_data_meber): Declare it. (finish_pseudo_destructor_call_expr): Rename to ... (finish_pseudo_destructor_expr): ... this. (finish_compound_literal): Declare it. (begin_inline_definitions): Remove it. (init_spew): Remove. (peekyylex): Likewise. (arbitrate_lookup): Likewise. (frob_opname): Likewise. (maybe_snarf_defarg): Likewise. (add_defarg_fn): Likewise. (do_pending_defargs): Likewise. (done_pending_defargs): Likewise. (unprocessed_defarg_fn): Likewise. (replace_defarg): Likewise. (end_input): Likewise. (get_overloaded_fn): Likewise. * cvt.c (convert_to_reference): Improve error handling. * decl.c (lookup_name_real): Do not declare it static. (maybe_push_to_top_level): Set check_access. (identifier_type_value): Adjust call to lookup_name_real. (lookup_qualified_name): New method. (lookup_name_real): Remove special-case parsing code. (lookup_name-nonclass): Adjust call to lookup_name_real. (lookup_name_namespace_only): Likewise. (lookup_name): Likewise. (check_tag_decl): Return the type declared. (shadow_tag): Likewise. (register_dtor_fn): Tweak check_access. (grokfndecl): Use constructor_name_p. (get_scope_of_declarator): New function. (grokdeclarator): Obscure tweaks for slightly different declarator representations. (start_method): Return error_mark_node to indicate failure. (cp_tree_node_structure_enum): Use TS_CP_DEFAULT_ARG for DEFAULT_ARGs. * decl2.c (constructor_name_full): Simplify. (constructor_name): Use it. (build_expr_from_tree): Adjust for changes to do new parser. (push_scope): Improve robustness. (validate_nonmember_using_decl): Process declarations, not names. (do_class_using_decl): Likewise. (handle_class_head): Do not mess with CLASSTYPE_DECLARED_CLASS here. * error.c (dump_expr): Handle IDENTIFIER_NODEs and BASELINKs. * expr.c (cxx_expand_expr): Handle BASELINKs. * init.c (member_init_ok_or_else): Issue more errors. (build_offset_ref): Tweak handling of FUNCTION_DECLs. * lex.c: Do not include parse.h. (yypring): Do not declare. (yylval): Likewise. (make_reference_declarator): Remove error-generating code. (rid_to_yy): Remove. (cxx_init): Do not call init_spew. (yypring): Remove. (check_for_missing_semicolon): Remove. * lex.h (got_scope): Remove. (got_object): Remove. * method.c (hack_identifier): Use finish_non_static_data_member. (implicitly_declare_fn): Adjust use of constructor_name. * parser.c: New file. * pt.c (parse.h): Do not include it. (maybe_get_template_decl_from_template): Do not declare it. (finish_member_template_decl): Tweak. (begin_explicit_instantiation): Adjust for processing_explicit_instantiation being boolean. (end_explicit_instantiation): Likewise. (maybe_process_partial_specialization): Tighten specialization test. (retrieve_local_specialization): Adjust ue of hash table. (eq_local_specializations): New function. (register_local_specialization): Likewise. (push_template_decl_real): Remove unnecessary test. (maybe_get_template_decl_from_type_decl): Don't make it static. (for_each_template_parm_r): Handle TYPEOF_TYPE. (tsubst_copy): Use retrieive_local_specialization to handle PARM_DECL. Adjust handling of CONST_DECLs. Handle BASELINKs. Handle COMPONENT_REFs with pseudo-destructor-expressions. Simplify handling of CALL_EXPR and METHOD_CALL_EXPR. (tsubst_expr): Pass decls, not names, to do_local_using_decl. (unify): Tweak handling of CONST_DECLs. (regenerate_decl_from_template): Use push_nested_class. (template_for_substitution): New funciton. (instantiate_decl): Use it. Register parameters as local specializations. * rtti.c (init_rtti_processing): Set type_info_ref_type. (build_typeid): Use it. (get_typeid): Likeise. * search.c (accessible_p): Use check_access, not flag_access_control. (adjust_result_of_qualified_name_lookup): Pay attention to the context_class. * semantics.c (finish_asm_stmt): Adjust error handling. (finish_label_stmt): Return the statement. (finish_non_static_data_member): New function. (finish_class_expr): Handle BASELINKs. (finish_call_expr): Handle PSEUDO_DTOR_EXPR. (finish_object_call_expr): Simplify handling during templates. (finish_pseudo_destructor_call_expr): Rename to ... (finish_pseudo_dtor_expr): ... this. (finish_compound_literal): New function. (begin_inline_definitions): Remove. (finish_sizeof): Remove special template handling. * spew.c: Do not include parse.h. * tree.c (get_overloaded_fn): Remove. * typeck.c (build_class_member_access_expr): Handle PSEUDO_DTOR_EXPR. Adjust handling of static member functions. (lookup_destructor): New function. (finish_class_member_access_expr): Use it. (convert_arguments): Simplify. (build_unary_op): Handle BASELINKs. From-SVN: r60560
2002-12-28 09:03:42 +01:00
my_friendly_assert (TYPE_P (destructor), 20010905);
Make-lang.in (po-generated): Remove parse.c. * Make-lang.in (po-generated): Remove parse.c. (CXX_OBJS): Remove parse.o and spew.o. Add parser.o. ($(srcdir)/cp/parse.h): Remove target. ($(srcdir)/cp/parse.c): Likewise. (gt-cp-parse.h): Likewise. (gt-cp-parser.h): New target. (c++.distclean): Do not remove parse.output. (c++.maintainer-clean): Do not remove parse.c or parse.h. (cp/spew.o): Remove target. (cp/lex.o): Adjust dependencies. (cp/pt.o): Likewise. (cp/parse.o): Likewise. (cp/TAGS): Do not mention parse.c. (cp/parser.o): New target. * NEWS: Mention the new parser. * call.c (build_scoped_method_call): Simplify. (build_method_call): Likewise. (build_new_function_call): Adjust calls to add_function_candidate and add_template_candidate. (build_new_op): Improve handling of erroroneous operands. (convert_default_arg): Remove circular argument processing. (name_as_c_string): New function. (build_new_method_call): Use it. (perform_implicit_conversion): Use error_operand_p. * class.c (finish_struct_anon): Use constructor_name_p. (check_field_decls): Likewise. (pop_nested_class): Use OVL_NEXT, not OVL_CHAIN. (resolve_address_of_overloaded_function): Likewise. (instantiate_type): Tweak pointer-to-member handling. (get_primary_binfo): Remove incorrect assertion. * config-lang.in (gtfiles): Add parser.c, remove parse.c. * cp-tree.h (DEFARG_TOKENS): New macro. (default_arg): New structure. (cp_tree_node_structure_enum): Add TS_CP_DEFAULT_ARG. (lang_tree_node): Add default_arg. (cp_tree_index): Add CPTI_TYPE_INFO_REF_TYPE. (type_info_ref_type): New macro. (saved_scope): Make processing_explicit_instantiation a boolean. (check_access): New field. (unparsed_text): Remove. (language_function): Remove unparsed_inlines. (error_operand_p): New macro. (lang_decl): Adjust pending_inline_info. (DEFARG_POINTER): Remove. (tag_types): Add typenames. (lookup_ualified_name): Declare. (lookup_name_real): Likewise. (shadow_tag): Adjust prototype. (get_scope_of_declarator): Declare it. (process_next_inline): Remove it. (check_for_missing_semicolon): Likewise. (maybe_get_template_decl_from_type_decl): Declare it. (finish_label_stmt): Adjust prototype. (finish_non_static_data_meber): Declare it. (finish_pseudo_destructor_call_expr): Rename to ... (finish_pseudo_destructor_expr): ... this. (finish_compound_literal): Declare it. (begin_inline_definitions): Remove it. (init_spew): Remove. (peekyylex): Likewise. (arbitrate_lookup): Likewise. (frob_opname): Likewise. (maybe_snarf_defarg): Likewise. (add_defarg_fn): Likewise. (do_pending_defargs): Likewise. (done_pending_defargs): Likewise. (unprocessed_defarg_fn): Likewise. (replace_defarg): Likewise. (end_input): Likewise. (get_overloaded_fn): Likewise. * cvt.c (convert_to_reference): Improve error handling. * decl.c (lookup_name_real): Do not declare it static. (maybe_push_to_top_level): Set check_access. (identifier_type_value): Adjust call to lookup_name_real. (lookup_qualified_name): New method. (lookup_name_real): Remove special-case parsing code. (lookup_name-nonclass): Adjust call to lookup_name_real. (lookup_name_namespace_only): Likewise. (lookup_name): Likewise. (check_tag_decl): Return the type declared. (shadow_tag): Likewise. (register_dtor_fn): Tweak check_access. (grokfndecl): Use constructor_name_p. (get_scope_of_declarator): New function. (grokdeclarator): Obscure tweaks for slightly different declarator representations. (start_method): Return error_mark_node to indicate failure. (cp_tree_node_structure_enum): Use TS_CP_DEFAULT_ARG for DEFAULT_ARGs. * decl2.c (constructor_name_full): Simplify. (constructor_name): Use it. (build_expr_from_tree): Adjust for changes to do new parser. (push_scope): Improve robustness. (validate_nonmember_using_decl): Process declarations, not names. (do_class_using_decl): Likewise. (handle_class_head): Do not mess with CLASSTYPE_DECLARED_CLASS here. * error.c (dump_expr): Handle IDENTIFIER_NODEs and BASELINKs. * expr.c (cxx_expand_expr): Handle BASELINKs. * init.c (member_init_ok_or_else): Issue more errors. (build_offset_ref): Tweak handling of FUNCTION_DECLs. * lex.c: Do not include parse.h. (yypring): Do not declare. (yylval): Likewise. (make_reference_declarator): Remove error-generating code. (rid_to_yy): Remove. (cxx_init): Do not call init_spew. (yypring): Remove. (check_for_missing_semicolon): Remove. * lex.h (got_scope): Remove. (got_object): Remove. * method.c (hack_identifier): Use finish_non_static_data_member. (implicitly_declare_fn): Adjust use of constructor_name. * parser.c: New file. * pt.c (parse.h): Do not include it. (maybe_get_template_decl_from_template): Do not declare it. (finish_member_template_decl): Tweak. (begin_explicit_instantiation): Adjust for processing_explicit_instantiation being boolean. (end_explicit_instantiation): Likewise. (maybe_process_partial_specialization): Tighten specialization test. (retrieve_local_specialization): Adjust ue of hash table. (eq_local_specializations): New function. (register_local_specialization): Likewise. (push_template_decl_real): Remove unnecessary test. (maybe_get_template_decl_from_type_decl): Don't make it static. (for_each_template_parm_r): Handle TYPEOF_TYPE. (tsubst_copy): Use retrieive_local_specialization to handle PARM_DECL. Adjust handling of CONST_DECLs. Handle BASELINKs. Handle COMPONENT_REFs with pseudo-destructor-expressions. Simplify handling of CALL_EXPR and METHOD_CALL_EXPR. (tsubst_expr): Pass decls, not names, to do_local_using_decl. (unify): Tweak handling of CONST_DECLs. (regenerate_decl_from_template): Use push_nested_class. (template_for_substitution): New funciton. (instantiate_decl): Use it. Register parameters as local specializations. * rtti.c (init_rtti_processing): Set type_info_ref_type. (build_typeid): Use it. (get_typeid): Likeise. * search.c (accessible_p): Use check_access, not flag_access_control. (adjust_result_of_qualified_name_lookup): Pay attention to the context_class. * semantics.c (finish_asm_stmt): Adjust error handling. (finish_label_stmt): Return the statement. (finish_non_static_data_member): New function. (finish_class_expr): Handle BASELINKs. (finish_call_expr): Handle PSEUDO_DTOR_EXPR. (finish_object_call_expr): Simplify handling during templates. (finish_pseudo_destructor_call_expr): Rename to ... (finish_pseudo_dtor_expr): ... this. (finish_compound_literal): New function. (begin_inline_definitions): Remove. (finish_sizeof): Remove special template handling. * spew.c: Do not include parse.h. * tree.c (get_overloaded_fn): Remove. * typeck.c (build_class_member_access_expr): Handle PSEUDO_DTOR_EXPR. Adjust handling of static member functions. (lookup_destructor): New function. (finish_class_member_access_expr): Use it. (convert_arguments): Simplify. (build_unary_op): Handle BASELINKs. From-SVN: r60560
2002-12-28 09:03:42 +01:00
if (!processing_template_decl)
{
if (scope == error_mark_node)
{
error ("invalid qualifying scope in pseudo-destructor name");
return error_mark_node;
}
if (!same_type_p (TREE_TYPE (object), destructor))
{
error ("`%E' is not of type `%T'", object, destructor);
return error_mark_node;
}
}
Make-lang.in (po-generated): Remove parse.c. * Make-lang.in (po-generated): Remove parse.c. (CXX_OBJS): Remove parse.o and spew.o. Add parser.o. ($(srcdir)/cp/parse.h): Remove target. ($(srcdir)/cp/parse.c): Likewise. (gt-cp-parse.h): Likewise. (gt-cp-parser.h): New target. (c++.distclean): Do not remove parse.output. (c++.maintainer-clean): Do not remove parse.c or parse.h. (cp/spew.o): Remove target. (cp/lex.o): Adjust dependencies. (cp/pt.o): Likewise. (cp/parse.o): Likewise. (cp/TAGS): Do not mention parse.c. (cp/parser.o): New target. * NEWS: Mention the new parser. * call.c (build_scoped_method_call): Simplify. (build_method_call): Likewise. (build_new_function_call): Adjust calls to add_function_candidate and add_template_candidate. (build_new_op): Improve handling of erroroneous operands. (convert_default_arg): Remove circular argument processing. (name_as_c_string): New function. (build_new_method_call): Use it. (perform_implicit_conversion): Use error_operand_p. * class.c (finish_struct_anon): Use constructor_name_p. (check_field_decls): Likewise. (pop_nested_class): Use OVL_NEXT, not OVL_CHAIN. (resolve_address_of_overloaded_function): Likewise. (instantiate_type): Tweak pointer-to-member handling. (get_primary_binfo): Remove incorrect assertion. * config-lang.in (gtfiles): Add parser.c, remove parse.c. * cp-tree.h (DEFARG_TOKENS): New macro. (default_arg): New structure. (cp_tree_node_structure_enum): Add TS_CP_DEFAULT_ARG. (lang_tree_node): Add default_arg. (cp_tree_index): Add CPTI_TYPE_INFO_REF_TYPE. (type_info_ref_type): New macro. (saved_scope): Make processing_explicit_instantiation a boolean. (check_access): New field. (unparsed_text): Remove. (language_function): Remove unparsed_inlines. (error_operand_p): New macro. (lang_decl): Adjust pending_inline_info. (DEFARG_POINTER): Remove. (tag_types): Add typenames. (lookup_ualified_name): Declare. (lookup_name_real): Likewise. (shadow_tag): Adjust prototype. (get_scope_of_declarator): Declare it. (process_next_inline): Remove it. (check_for_missing_semicolon): Likewise. (maybe_get_template_decl_from_type_decl): Declare it. (finish_label_stmt): Adjust prototype. (finish_non_static_data_meber): Declare it. (finish_pseudo_destructor_call_expr): Rename to ... (finish_pseudo_destructor_expr): ... this. (finish_compound_literal): Declare it. (begin_inline_definitions): Remove it. (init_spew): Remove. (peekyylex): Likewise. (arbitrate_lookup): Likewise. (frob_opname): Likewise. (maybe_snarf_defarg): Likewise. (add_defarg_fn): Likewise. (do_pending_defargs): Likewise. (done_pending_defargs): Likewise. (unprocessed_defarg_fn): Likewise. (replace_defarg): Likewise. (end_input): Likewise. (get_overloaded_fn): Likewise. * cvt.c (convert_to_reference): Improve error handling. * decl.c (lookup_name_real): Do not declare it static. (maybe_push_to_top_level): Set check_access. (identifier_type_value): Adjust call to lookup_name_real. (lookup_qualified_name): New method. (lookup_name_real): Remove special-case parsing code. (lookup_name-nonclass): Adjust call to lookup_name_real. (lookup_name_namespace_only): Likewise. (lookup_name): Likewise. (check_tag_decl): Return the type declared. (shadow_tag): Likewise. (register_dtor_fn): Tweak check_access. (grokfndecl): Use constructor_name_p. (get_scope_of_declarator): New function. (grokdeclarator): Obscure tweaks for slightly different declarator representations. (start_method): Return error_mark_node to indicate failure. (cp_tree_node_structure_enum): Use TS_CP_DEFAULT_ARG for DEFAULT_ARGs. * decl2.c (constructor_name_full): Simplify. (constructor_name): Use it. (build_expr_from_tree): Adjust for changes to do new parser. (push_scope): Improve robustness. (validate_nonmember_using_decl): Process declarations, not names. (do_class_using_decl): Likewise. (handle_class_head): Do not mess with CLASSTYPE_DECLARED_CLASS here. * error.c (dump_expr): Handle IDENTIFIER_NODEs and BASELINKs. * expr.c (cxx_expand_expr): Handle BASELINKs. * init.c (member_init_ok_or_else): Issue more errors. (build_offset_ref): Tweak handling of FUNCTION_DECLs. * lex.c: Do not include parse.h. (yypring): Do not declare. (yylval): Likewise. (make_reference_declarator): Remove error-generating code. (rid_to_yy): Remove. (cxx_init): Do not call init_spew. (yypring): Remove. (check_for_missing_semicolon): Remove. * lex.h (got_scope): Remove. (got_object): Remove. * method.c (hack_identifier): Use finish_non_static_data_member. (implicitly_declare_fn): Adjust use of constructor_name. * parser.c: New file. * pt.c (parse.h): Do not include it. (maybe_get_template_decl_from_template): Do not declare it. (finish_member_template_decl): Tweak. (begin_explicit_instantiation): Adjust for processing_explicit_instantiation being boolean. (end_explicit_instantiation): Likewise. (maybe_process_partial_specialization): Tighten specialization test. (retrieve_local_specialization): Adjust ue of hash table. (eq_local_specializations): New function. (register_local_specialization): Likewise. (push_template_decl_real): Remove unnecessary test. (maybe_get_template_decl_from_type_decl): Don't make it static. (for_each_template_parm_r): Handle TYPEOF_TYPE. (tsubst_copy): Use retrieive_local_specialization to handle PARM_DECL. Adjust handling of CONST_DECLs. Handle BASELINKs. Handle COMPONENT_REFs with pseudo-destructor-expressions. Simplify handling of CALL_EXPR and METHOD_CALL_EXPR. (tsubst_expr): Pass decls, not names, to do_local_using_decl. (unify): Tweak handling of CONST_DECLs. (regenerate_decl_from_template): Use push_nested_class. (template_for_substitution): New funciton. (instantiate_decl): Use it. Register parameters as local specializations. * rtti.c (init_rtti_processing): Set type_info_ref_type. (build_typeid): Use it. (get_typeid): Likeise. * search.c (accessible_p): Use check_access, not flag_access_control. (adjust_result_of_qualified_name_lookup): Pay attention to the context_class. * semantics.c (finish_asm_stmt): Adjust error handling. (finish_label_stmt): Return the statement. (finish_non_static_data_member): New function. (finish_class_expr): Handle BASELINKs. (finish_call_expr): Handle PSEUDO_DTOR_EXPR. (finish_object_call_expr): Simplify handling during templates. (finish_pseudo_destructor_call_expr): Rename to ... (finish_pseudo_dtor_expr): ... this. (finish_compound_literal): New function. (begin_inline_definitions): Remove. (finish_sizeof): Remove special template handling. * spew.c: Do not include parse.h. * tree.c (get_overloaded_fn): Remove. * typeck.c (build_class_member_access_expr): Handle PSEUDO_DTOR_EXPR. Adjust handling of static member functions. (lookup_destructor): New function. (finish_class_member_access_expr): Use it. (convert_arguments): Simplify. (build_unary_op): Handle BASELINKs. From-SVN: r60560
2002-12-28 09:03:42 +01:00
return build (PSEUDO_DTOR_EXPR, void_type_node, object, scope, destructor);
}
/* Finish an expression of the form CODE EXPR. */
tree
finish_unary_op_expr (enum tree_code code, tree expr)
{
tree result = build_x_unary_op (code, expr);
/* Inside a template, build_x_unary_op does not fold the
expression. So check whether the result is folded before
setting TREE_NEGATED_INT. */
if (code == NEGATE_EXPR && TREE_CODE (expr) == INTEGER_CST
&& TREE_CODE (result) == INTEGER_CST
&& !TREE_UNSIGNED (TREE_TYPE (result))
&& INT_CST_LT (result, integer_zero_node))
TREE_NEGATED_INT (result) = 1;
overflow_warning (result);
return result;
}
Make-lang.in (po-generated): Remove parse.c. * Make-lang.in (po-generated): Remove parse.c. (CXX_OBJS): Remove parse.o and spew.o. Add parser.o. ($(srcdir)/cp/parse.h): Remove target. ($(srcdir)/cp/parse.c): Likewise. (gt-cp-parse.h): Likewise. (gt-cp-parser.h): New target. (c++.distclean): Do not remove parse.output. (c++.maintainer-clean): Do not remove parse.c or parse.h. (cp/spew.o): Remove target. (cp/lex.o): Adjust dependencies. (cp/pt.o): Likewise. (cp/parse.o): Likewise. (cp/TAGS): Do not mention parse.c. (cp/parser.o): New target. * NEWS: Mention the new parser. * call.c (build_scoped_method_call): Simplify. (build_method_call): Likewise. (build_new_function_call): Adjust calls to add_function_candidate and add_template_candidate. (build_new_op): Improve handling of erroroneous operands. (convert_default_arg): Remove circular argument processing. (name_as_c_string): New function. (build_new_method_call): Use it. (perform_implicit_conversion): Use error_operand_p. * class.c (finish_struct_anon): Use constructor_name_p. (check_field_decls): Likewise. (pop_nested_class): Use OVL_NEXT, not OVL_CHAIN. (resolve_address_of_overloaded_function): Likewise. (instantiate_type): Tweak pointer-to-member handling. (get_primary_binfo): Remove incorrect assertion. * config-lang.in (gtfiles): Add parser.c, remove parse.c. * cp-tree.h (DEFARG_TOKENS): New macro. (default_arg): New structure. (cp_tree_node_structure_enum): Add TS_CP_DEFAULT_ARG. (lang_tree_node): Add default_arg. (cp_tree_index): Add CPTI_TYPE_INFO_REF_TYPE. (type_info_ref_type): New macro. (saved_scope): Make processing_explicit_instantiation a boolean. (check_access): New field. (unparsed_text): Remove. (language_function): Remove unparsed_inlines. (error_operand_p): New macro. (lang_decl): Adjust pending_inline_info. (DEFARG_POINTER): Remove. (tag_types): Add typenames. (lookup_ualified_name): Declare. (lookup_name_real): Likewise. (shadow_tag): Adjust prototype. (get_scope_of_declarator): Declare it. (process_next_inline): Remove it. (check_for_missing_semicolon): Likewise. (maybe_get_template_decl_from_type_decl): Declare it. (finish_label_stmt): Adjust prototype. (finish_non_static_data_meber): Declare it. (finish_pseudo_destructor_call_expr): Rename to ... (finish_pseudo_destructor_expr): ... this. (finish_compound_literal): Declare it. (begin_inline_definitions): Remove it. (init_spew): Remove. (peekyylex): Likewise. (arbitrate_lookup): Likewise. (frob_opname): Likewise. (maybe_snarf_defarg): Likewise. (add_defarg_fn): Likewise. (do_pending_defargs): Likewise. (done_pending_defargs): Likewise. (unprocessed_defarg_fn): Likewise. (replace_defarg): Likewise. (end_input): Likewise. (get_overloaded_fn): Likewise. * cvt.c (convert_to_reference): Improve error handling. * decl.c (lookup_name_real): Do not declare it static. (maybe_push_to_top_level): Set check_access. (identifier_type_value): Adjust call to lookup_name_real. (lookup_qualified_name): New method. (lookup_name_real): Remove special-case parsing code. (lookup_name-nonclass): Adjust call to lookup_name_real. (lookup_name_namespace_only): Likewise. (lookup_name): Likewise. (check_tag_decl): Return the type declared. (shadow_tag): Likewise. (register_dtor_fn): Tweak check_access. (grokfndecl): Use constructor_name_p. (get_scope_of_declarator): New function. (grokdeclarator): Obscure tweaks for slightly different declarator representations. (start_method): Return error_mark_node to indicate failure. (cp_tree_node_structure_enum): Use TS_CP_DEFAULT_ARG for DEFAULT_ARGs. * decl2.c (constructor_name_full): Simplify. (constructor_name): Use it. (build_expr_from_tree): Adjust for changes to do new parser. (push_scope): Improve robustness. (validate_nonmember_using_decl): Process declarations, not names. (do_class_using_decl): Likewise. (handle_class_head): Do not mess with CLASSTYPE_DECLARED_CLASS here. * error.c (dump_expr): Handle IDENTIFIER_NODEs and BASELINKs. * expr.c (cxx_expand_expr): Handle BASELINKs. * init.c (member_init_ok_or_else): Issue more errors. (build_offset_ref): Tweak handling of FUNCTION_DECLs. * lex.c: Do not include parse.h. (yypring): Do not declare. (yylval): Likewise. (make_reference_declarator): Remove error-generating code. (rid_to_yy): Remove. (cxx_init): Do not call init_spew. (yypring): Remove. (check_for_missing_semicolon): Remove. * lex.h (got_scope): Remove. (got_object): Remove. * method.c (hack_identifier): Use finish_non_static_data_member. (implicitly_declare_fn): Adjust use of constructor_name. * parser.c: New file. * pt.c (parse.h): Do not include it. (maybe_get_template_decl_from_template): Do not declare it. (finish_member_template_decl): Tweak. (begin_explicit_instantiation): Adjust for processing_explicit_instantiation being boolean. (end_explicit_instantiation): Likewise. (maybe_process_partial_specialization): Tighten specialization test. (retrieve_local_specialization): Adjust ue of hash table. (eq_local_specializations): New function. (register_local_specialization): Likewise. (push_template_decl_real): Remove unnecessary test. (maybe_get_template_decl_from_type_decl): Don't make it static. (for_each_template_parm_r): Handle TYPEOF_TYPE. (tsubst_copy): Use retrieive_local_specialization to handle PARM_DECL. Adjust handling of CONST_DECLs. Handle BASELINKs. Handle COMPONENT_REFs with pseudo-destructor-expressions. Simplify handling of CALL_EXPR and METHOD_CALL_EXPR. (tsubst_expr): Pass decls, not names, to do_local_using_decl. (unify): Tweak handling of CONST_DECLs. (regenerate_decl_from_template): Use push_nested_class. (template_for_substitution): New funciton. (instantiate_decl): Use it. Register parameters as local specializations. * rtti.c (init_rtti_processing): Set type_info_ref_type. (build_typeid): Use it. (get_typeid): Likeise. * search.c (accessible_p): Use check_access, not flag_access_control. (adjust_result_of_qualified_name_lookup): Pay attention to the context_class. * semantics.c (finish_asm_stmt): Adjust error handling. (finish_label_stmt): Return the statement. (finish_non_static_data_member): New function. (finish_class_expr): Handle BASELINKs. (finish_call_expr): Handle PSEUDO_DTOR_EXPR. (finish_object_call_expr): Simplify handling during templates. (finish_pseudo_destructor_call_expr): Rename to ... (finish_pseudo_dtor_expr): ... this. (finish_compound_literal): New function. (begin_inline_definitions): Remove. (finish_sizeof): Remove special template handling. * spew.c: Do not include parse.h. * tree.c (get_overloaded_fn): Remove. * typeck.c (build_class_member_access_expr): Handle PSEUDO_DTOR_EXPR. Adjust handling of static member functions. (lookup_destructor): New function. (finish_class_member_access_expr): Use it. (convert_arguments): Simplify. (build_unary_op): Handle BASELINKs. From-SVN: r60560
2002-12-28 09:03:42 +01:00
/* Finish a compound-literal expression. TYPE is the type to which
the INITIALIZER_LIST is being cast. */
tree
finish_compound_literal (tree type, tree initializer_list)
Make-lang.in (po-generated): Remove parse.c. * Make-lang.in (po-generated): Remove parse.c. (CXX_OBJS): Remove parse.o and spew.o. Add parser.o. ($(srcdir)/cp/parse.h): Remove target. ($(srcdir)/cp/parse.c): Likewise. (gt-cp-parse.h): Likewise. (gt-cp-parser.h): New target. (c++.distclean): Do not remove parse.output. (c++.maintainer-clean): Do not remove parse.c or parse.h. (cp/spew.o): Remove target. (cp/lex.o): Adjust dependencies. (cp/pt.o): Likewise. (cp/parse.o): Likewise. (cp/TAGS): Do not mention parse.c. (cp/parser.o): New target. * NEWS: Mention the new parser. * call.c (build_scoped_method_call): Simplify. (build_method_call): Likewise. (build_new_function_call): Adjust calls to add_function_candidate and add_template_candidate. (build_new_op): Improve handling of erroroneous operands. (convert_default_arg): Remove circular argument processing. (name_as_c_string): New function. (build_new_method_call): Use it. (perform_implicit_conversion): Use error_operand_p. * class.c (finish_struct_anon): Use constructor_name_p. (check_field_decls): Likewise. (pop_nested_class): Use OVL_NEXT, not OVL_CHAIN. (resolve_address_of_overloaded_function): Likewise. (instantiate_type): Tweak pointer-to-member handling. (get_primary_binfo): Remove incorrect assertion. * config-lang.in (gtfiles): Add parser.c, remove parse.c. * cp-tree.h (DEFARG_TOKENS): New macro. (default_arg): New structure. (cp_tree_node_structure_enum): Add TS_CP_DEFAULT_ARG. (lang_tree_node): Add default_arg. (cp_tree_index): Add CPTI_TYPE_INFO_REF_TYPE. (type_info_ref_type): New macro. (saved_scope): Make processing_explicit_instantiation a boolean. (check_access): New field. (unparsed_text): Remove. (language_function): Remove unparsed_inlines. (error_operand_p): New macro. (lang_decl): Adjust pending_inline_info. (DEFARG_POINTER): Remove. (tag_types): Add typenames. (lookup_ualified_name): Declare. (lookup_name_real): Likewise. (shadow_tag): Adjust prototype. (get_scope_of_declarator): Declare it. (process_next_inline): Remove it. (check_for_missing_semicolon): Likewise. (maybe_get_template_decl_from_type_decl): Declare it. (finish_label_stmt): Adjust prototype. (finish_non_static_data_meber): Declare it. (finish_pseudo_destructor_call_expr): Rename to ... (finish_pseudo_destructor_expr): ... this. (finish_compound_literal): Declare it. (begin_inline_definitions): Remove it. (init_spew): Remove. (peekyylex): Likewise. (arbitrate_lookup): Likewise. (frob_opname): Likewise. (maybe_snarf_defarg): Likewise. (add_defarg_fn): Likewise. (do_pending_defargs): Likewise. (done_pending_defargs): Likewise. (unprocessed_defarg_fn): Likewise. (replace_defarg): Likewise. (end_input): Likewise. (get_overloaded_fn): Likewise. * cvt.c (convert_to_reference): Improve error handling. * decl.c (lookup_name_real): Do not declare it static. (maybe_push_to_top_level): Set check_access. (identifier_type_value): Adjust call to lookup_name_real. (lookup_qualified_name): New method. (lookup_name_real): Remove special-case parsing code. (lookup_name-nonclass): Adjust call to lookup_name_real. (lookup_name_namespace_only): Likewise. (lookup_name): Likewise. (check_tag_decl): Return the type declared. (shadow_tag): Likewise. (register_dtor_fn): Tweak check_access. (grokfndecl): Use constructor_name_p. (get_scope_of_declarator): New function. (grokdeclarator): Obscure tweaks for slightly different declarator representations. (start_method): Return error_mark_node to indicate failure. (cp_tree_node_structure_enum): Use TS_CP_DEFAULT_ARG for DEFAULT_ARGs. * decl2.c (constructor_name_full): Simplify. (constructor_name): Use it. (build_expr_from_tree): Adjust for changes to do new parser. (push_scope): Improve robustness. (validate_nonmember_using_decl): Process declarations, not names. (do_class_using_decl): Likewise. (handle_class_head): Do not mess with CLASSTYPE_DECLARED_CLASS here. * error.c (dump_expr): Handle IDENTIFIER_NODEs and BASELINKs. * expr.c (cxx_expand_expr): Handle BASELINKs. * init.c (member_init_ok_or_else): Issue more errors. (build_offset_ref): Tweak handling of FUNCTION_DECLs. * lex.c: Do not include parse.h. (yypring): Do not declare. (yylval): Likewise. (make_reference_declarator): Remove error-generating code. (rid_to_yy): Remove. (cxx_init): Do not call init_spew. (yypring): Remove. (check_for_missing_semicolon): Remove. * lex.h (got_scope): Remove. (got_object): Remove. * method.c (hack_identifier): Use finish_non_static_data_member. (implicitly_declare_fn): Adjust use of constructor_name. * parser.c: New file. * pt.c (parse.h): Do not include it. (maybe_get_template_decl_from_template): Do not declare it. (finish_member_template_decl): Tweak. (begin_explicit_instantiation): Adjust for processing_explicit_instantiation being boolean. (end_explicit_instantiation): Likewise. (maybe_process_partial_specialization): Tighten specialization test. (retrieve_local_specialization): Adjust ue of hash table. (eq_local_specializations): New function. (register_local_specialization): Likewise. (push_template_decl_real): Remove unnecessary test. (maybe_get_template_decl_from_type_decl): Don't make it static. (for_each_template_parm_r): Handle TYPEOF_TYPE. (tsubst_copy): Use retrieive_local_specialization to handle PARM_DECL. Adjust handling of CONST_DECLs. Handle BASELINKs. Handle COMPONENT_REFs with pseudo-destructor-expressions. Simplify handling of CALL_EXPR and METHOD_CALL_EXPR. (tsubst_expr): Pass decls, not names, to do_local_using_decl. (unify): Tweak handling of CONST_DECLs. (regenerate_decl_from_template): Use push_nested_class. (template_for_substitution): New funciton. (instantiate_decl): Use it. Register parameters as local specializations. * rtti.c (init_rtti_processing): Set type_info_ref_type. (build_typeid): Use it. (get_typeid): Likeise. * search.c (accessible_p): Use check_access, not flag_access_control. (adjust_result_of_qualified_name_lookup): Pay attention to the context_class. * semantics.c (finish_asm_stmt): Adjust error handling. (finish_label_stmt): Return the statement. (finish_non_static_data_member): New function. (finish_class_expr): Handle BASELINKs. (finish_call_expr): Handle PSEUDO_DTOR_EXPR. (finish_object_call_expr): Simplify handling during templates. (finish_pseudo_destructor_call_expr): Rename to ... (finish_pseudo_dtor_expr): ... this. (finish_compound_literal): New function. (begin_inline_definitions): Remove. (finish_sizeof): Remove special template handling. * spew.c: Do not include parse.h. * tree.c (get_overloaded_fn): Remove. * typeck.c (build_class_member_access_expr): Handle PSEUDO_DTOR_EXPR. Adjust handling of static member functions. (lookup_destructor): New function. (finish_class_member_access_expr): Use it. (convert_arguments): Simplify. (build_unary_op): Handle BASELINKs. From-SVN: r60560
2002-12-28 09:03:42 +01:00
{
tree compound_literal;
/* Build a CONSTRUCTOR for the INITIALIZER_LIST. */
tree.c (build_constructor): New function. * tree.c (build_constructor): New function. * tree.h: Prototype it. * c-typeck.c (build_c_cast, pop_init_level) * profile.c (build_function_info_value, build_gcov_info_value) (create_profiler): Use build_constructor. * builtins.c (expand_builtin_args_info): Remove #if 0 blocks. * objc/objc-act.c (build_constructor): Rename objc_build_constructor. Use build_constructor. (build_objc_string_object, objc_add_static_instance) (init_def_list, init_objc_symtab, init_module_descriptor) (generate_static_references, build_selector_translation_table) (build_descriptor_table_initializer, generate_descriptor_table) (build_protocol_initializer, build_ivar_list_initializer) (generate_ivars_list, build_dispatch_table_initializer) (generate_dispatch_table, generate_protocol_list) (build_category_initializer, build_shared_structure_initializer): Update to match. ada: * gigi.h, utils2.c (build_constructor): Rename gnat_build_constructor. Use build_constructor. * decl.c (gnat_to_gnu_entity) * trans.c (tree_transform, pos_to_constructor, extract_values) * ada/utils.c (build_template, convert_to_fat_pointer, convert) (unchecked_convert) * ada/utils2.c (build_binary_op, build_call_raise, build_allocator) (fill_vms_descriptor): Update to match. cp: * class.c (initialize_array) * decl.c (reshape_init) * decl2.c (build_expr_from_tree) * init.c (build_zero_init) * pt.c (tsubst_copy, tsubst_copy_and_build) * rtti.c (tinfo_base_init, generic_initializer, ptr_initializer) (ptm_initializer, class_initializer, get_pseudo_ti_init) * semantics.c (finish_compound_literal) * typeck.c (build_ptrmemfunc1) * typeck2.c (store_init_value, process_init_constructor) (build_functional_cast): Use build_constructor. f: * com.c (ffecom_build_complex_constant_, ffecom_expr_) (ffecom_init_zero_, ffecom_transform_namelist_, ffecom_vardesc_) (ffecom_vardesc_array_, ffecom_vardesc_dims_, ffecom_2) * ste.c (ffeste_io_ialist_, ffeste_io_cilist_, ffeste_io_cllist_) (ffeste_io_icilist_, ffeste_io_inlist_, ffeste_io_olist_): Use build_constructor. java: * class.c (make_field_value, make_method_value, get_dispatch_table) (make_class_data, emit_offset_symbol_table) * constants.c (build_constants_constructor) * java-tree.h (START_RECORD_CONSTRUCTOR) * parse.y (maybe_build_array_element_wfl): Use build_constructor. From-SVN: r65539
2003-04-13 03:45:35 +02:00
compound_literal = build_constructor (NULL_TREE, initializer_list);
Make-lang.in (po-generated): Remove parse.c. * Make-lang.in (po-generated): Remove parse.c. (CXX_OBJS): Remove parse.o and spew.o. Add parser.o. ($(srcdir)/cp/parse.h): Remove target. ($(srcdir)/cp/parse.c): Likewise. (gt-cp-parse.h): Likewise. (gt-cp-parser.h): New target. (c++.distclean): Do not remove parse.output. (c++.maintainer-clean): Do not remove parse.c or parse.h. (cp/spew.o): Remove target. (cp/lex.o): Adjust dependencies. (cp/pt.o): Likewise. (cp/parse.o): Likewise. (cp/TAGS): Do not mention parse.c. (cp/parser.o): New target. * NEWS: Mention the new parser. * call.c (build_scoped_method_call): Simplify. (build_method_call): Likewise. (build_new_function_call): Adjust calls to add_function_candidate and add_template_candidate. (build_new_op): Improve handling of erroroneous operands. (convert_default_arg): Remove circular argument processing. (name_as_c_string): New function. (build_new_method_call): Use it. (perform_implicit_conversion): Use error_operand_p. * class.c (finish_struct_anon): Use constructor_name_p. (check_field_decls): Likewise. (pop_nested_class): Use OVL_NEXT, not OVL_CHAIN. (resolve_address_of_overloaded_function): Likewise. (instantiate_type): Tweak pointer-to-member handling. (get_primary_binfo): Remove incorrect assertion. * config-lang.in (gtfiles): Add parser.c, remove parse.c. * cp-tree.h (DEFARG_TOKENS): New macro. (default_arg): New structure. (cp_tree_node_structure_enum): Add TS_CP_DEFAULT_ARG. (lang_tree_node): Add default_arg. (cp_tree_index): Add CPTI_TYPE_INFO_REF_TYPE. (type_info_ref_type): New macro. (saved_scope): Make processing_explicit_instantiation a boolean. (check_access): New field. (unparsed_text): Remove. (language_function): Remove unparsed_inlines. (error_operand_p): New macro. (lang_decl): Adjust pending_inline_info. (DEFARG_POINTER): Remove. (tag_types): Add typenames. (lookup_ualified_name): Declare. (lookup_name_real): Likewise. (shadow_tag): Adjust prototype. (get_scope_of_declarator): Declare it. (process_next_inline): Remove it. (check_for_missing_semicolon): Likewise. (maybe_get_template_decl_from_type_decl): Declare it. (finish_label_stmt): Adjust prototype. (finish_non_static_data_meber): Declare it. (finish_pseudo_destructor_call_expr): Rename to ... (finish_pseudo_destructor_expr): ... this. (finish_compound_literal): Declare it. (begin_inline_definitions): Remove it. (init_spew): Remove. (peekyylex): Likewise. (arbitrate_lookup): Likewise. (frob_opname): Likewise. (maybe_snarf_defarg): Likewise. (add_defarg_fn): Likewise. (do_pending_defargs): Likewise. (done_pending_defargs): Likewise. (unprocessed_defarg_fn): Likewise. (replace_defarg): Likewise. (end_input): Likewise. (get_overloaded_fn): Likewise. * cvt.c (convert_to_reference): Improve error handling. * decl.c (lookup_name_real): Do not declare it static. (maybe_push_to_top_level): Set check_access. (identifier_type_value): Adjust call to lookup_name_real. (lookup_qualified_name): New method. (lookup_name_real): Remove special-case parsing code. (lookup_name-nonclass): Adjust call to lookup_name_real. (lookup_name_namespace_only): Likewise. (lookup_name): Likewise. (check_tag_decl): Return the type declared. (shadow_tag): Likewise. (register_dtor_fn): Tweak check_access. (grokfndecl): Use constructor_name_p. (get_scope_of_declarator): New function. (grokdeclarator): Obscure tweaks for slightly different declarator representations. (start_method): Return error_mark_node to indicate failure. (cp_tree_node_structure_enum): Use TS_CP_DEFAULT_ARG for DEFAULT_ARGs. * decl2.c (constructor_name_full): Simplify. (constructor_name): Use it. (build_expr_from_tree): Adjust for changes to do new parser. (push_scope): Improve robustness. (validate_nonmember_using_decl): Process declarations, not names. (do_class_using_decl): Likewise. (handle_class_head): Do not mess with CLASSTYPE_DECLARED_CLASS here. * error.c (dump_expr): Handle IDENTIFIER_NODEs and BASELINKs. * expr.c (cxx_expand_expr): Handle BASELINKs. * init.c (member_init_ok_or_else): Issue more errors. (build_offset_ref): Tweak handling of FUNCTION_DECLs. * lex.c: Do not include parse.h. (yypring): Do not declare. (yylval): Likewise. (make_reference_declarator): Remove error-generating code. (rid_to_yy): Remove. (cxx_init): Do not call init_spew. (yypring): Remove. (check_for_missing_semicolon): Remove. * lex.h (got_scope): Remove. (got_object): Remove. * method.c (hack_identifier): Use finish_non_static_data_member. (implicitly_declare_fn): Adjust use of constructor_name. * parser.c: New file. * pt.c (parse.h): Do not include it. (maybe_get_template_decl_from_template): Do not declare it. (finish_member_template_decl): Tweak. (begin_explicit_instantiation): Adjust for processing_explicit_instantiation being boolean. (end_explicit_instantiation): Likewise. (maybe_process_partial_specialization): Tighten specialization test. (retrieve_local_specialization): Adjust ue of hash table. (eq_local_specializations): New function. (register_local_specialization): Likewise. (push_template_decl_real): Remove unnecessary test. (maybe_get_template_decl_from_type_decl): Don't make it static. (for_each_template_parm_r): Handle TYPEOF_TYPE. (tsubst_copy): Use retrieive_local_specialization to handle PARM_DECL. Adjust handling of CONST_DECLs. Handle BASELINKs. Handle COMPONENT_REFs with pseudo-destructor-expressions. Simplify handling of CALL_EXPR and METHOD_CALL_EXPR. (tsubst_expr): Pass decls, not names, to do_local_using_decl. (unify): Tweak handling of CONST_DECLs. (regenerate_decl_from_template): Use push_nested_class. (template_for_substitution): New funciton. (instantiate_decl): Use it. Register parameters as local specializations. * rtti.c (init_rtti_processing): Set type_info_ref_type. (build_typeid): Use it. (get_typeid): Likeise. * search.c (accessible_p): Use check_access, not flag_access_control. (adjust_result_of_qualified_name_lookup): Pay attention to the context_class. * semantics.c (finish_asm_stmt): Adjust error handling. (finish_label_stmt): Return the statement. (finish_non_static_data_member): New function. (finish_class_expr): Handle BASELINKs. (finish_call_expr): Handle PSEUDO_DTOR_EXPR. (finish_object_call_expr): Simplify handling during templates. (finish_pseudo_destructor_call_expr): Rename to ... (finish_pseudo_dtor_expr): ... this. (finish_compound_literal): New function. (begin_inline_definitions): Remove. (finish_sizeof): Remove special template handling. * spew.c: Do not include parse.h. * tree.c (get_overloaded_fn): Remove. * typeck.c (build_class_member_access_expr): Handle PSEUDO_DTOR_EXPR. Adjust handling of static member functions. (lookup_destructor): New function. (finish_class_member_access_expr): Use it. (convert_arguments): Simplify. (build_unary_op): Handle BASELINKs. From-SVN: r60560
2002-12-28 09:03:42 +01:00
/* Mark it as a compound-literal. */
TREE_HAS_CONSTRUCTOR (compound_literal) = 1;
if (processing_template_decl)
TREE_TYPE (compound_literal) = type;
else
{
/* Check the initialization. */
compound_literal = digest_init (type, compound_literal, NULL);
/* If the TYPE was an array type with an unknown bound, then we can
figure out the dimension now. For example, something like:
`(int []) { 2, 3 }'
implies that the array has two elements. */
if (TREE_CODE (type) == ARRAY_TYPE && !COMPLETE_TYPE_P (type))
complete_array_type (type, compound_literal, 1);
}
return compound_literal;
}
/* Return the declaration for the function-name variable indicated by
ID. */
tree
finish_fname (tree id)
{
tree decl;
decl = fname_decl (C_RID_CODE (id), id);
if (processing_template_decl)
decl = DECL_NAME (decl);
return decl;
}
/* Begin a function definition declared with DECL_SPECS, ATTRIBUTES,
and DECLARATOR. Returns nonzero if the function-declaration is
valid. */
int
begin_function_definition (tree decl_specs, tree attributes, tree declarator)
{
if (!start_function (decl_specs, declarator, attributes, SF_DEFAULT))
return 0;
/* The things we're about to see are not directly qualified by any
template headers we've seen thus far. */
reset_specialization ();
return 1;
}
/* Finish a translation unit. */
void
finish_translation_unit (void)
{
/* In case there were missing closebraces,
get us back to the global binding level. */
pop_everything ();
while (current_namespace != global_namespace)
pop_namespace ();
Lazy __FUNCTION__ generation. gcc: Lazy __FUNCTION__ generation. * c-common.h (RID_FUNCTION_NAME, RID_PRETTY_FUNCTION_NAME, RID_C99_FUNCTION_NAME): New _RIDs. (CTI_FUNCTION_ID, CTI_PRETTY_FUNCTION_ID, CTI_FUNC_ID): Remove. (CTI_FUNCTION_NAME_DECL, CTI_PRETTY_FUNCTION_NAME_DECL, CTI_C99_FUNCTION_NAME_DECL, CTI_SAVED_FUNCTION_NAME_DECLS): New global tree slots. (function_id_node, pretty_function_id_node, func_id_node): Remove. (c99_function_name_decl_node, function_name_decl_node, pretty_function_name_decl_node, saved_function_name_decls): Declare. (struct language_function): Remove x_function_name_declared_p. (make_fname_decl): Remove a parameter. (declare_function_names): Remove prototype. (start_fname_decls, finish_fname_decls): Prototype. (fname_as_string): Likewise. (fname_string, fname_decl): Likewise. * c-common.c (make_fname_decl): Adjust. (struct fname_var_t): New struct. (fname_vars): New static array. (declare_function_name): Remove. (start_fname_decls, finish_fname_decls): New functions. (fname_as_string): New function from remnants of declare_function_name. (fname_string, fname_decl): New functions. * c-decl.c (c_function_name_declared_p): Remove. (init_decl_processing): Don't generate __FUNCTION__ et al ids, don't call declare_function_name. Call start_fname_decls. (c_make_fname_decl): Adjust parameters. Generate the name. Don't clobber the line number. Call finish_decl. (start_function): Call start_fname_decls. (finish_function): Call finish_fname_decls. Remove c_function_name_declared_p. (push_c_function_context): Don't push c_function_name_declared_p. (pop_c_function_context): Don't pop c_function_name_declared_p. (c_begin_compound_stmt): Don't check c_function_name_declared_p. * c-parse.in (STRING_FUNC_NAME, VAR_FUNC_NAME): New tokens. (program): Call finish_fname_decls for C. (primary): Add VAR_FUNC_NAME. (reswords): Add slots for __FUNCTION__ et al. (rid_to_yy): Add mappings for __FUNCTION__ et al. (yylexname): If it's a STRING_FUNC_NAME generate the function name now. Don't look for VAR_DECLs containing __FUNCTION__ et al. * c-semantics.c (prune_unused_decls): Remove. (finish_stmt_tree): Don't call prune_unused_decls. (genrtl_decl_stmt): Don't prune unused decls here. cp: Lazy __FUNCTION__ generation. * cp-tree.def (FUNCTION_NAME): Remove. * cp-tree.h (function_name_declared_p): Remove. (cp_fname_init): Prototype. * decl.c (init_decl_processing): Don't generate __FUNCTION__ et al ids, don't call declare_function_name. Call start_fname_decls. (cp_make_fname_decl): Adjust parameters. Generate the name. Don't clobber the line number. (cp_fname_init): New function. (start_function): Call start_fname_decls. (finish_function): Call finish_fname_decls. * lex.c (reswords): Add slots for __FUNCTION__ et al. (rid_to_yy): Add mappings for __FUNCTION__ et al. * optimize.c (maybe_clone_body): Remove function_name_declared_p. * parse.y (VAR_FUNC_NAME): New token. (primary): Add VAR_FUNC_NAME. * pt.c (tsubst_decl): Adjust a DECL_PRETTY_FUNCTION_P's generation. (tsubst, FUNCTION_NAME case): Remove. (tsubst_copy, FUNCTION_NAME case): Remove. (tsubst_expr, DECL_STMT case): Be careful with a DECL_PRETTY_FUNCTION_P. (instantiate_decl): Remove function_name_declared_p. * semantics.c (begin_compound_statement): Don't call declare_function_name here. (setup_vtbl_ptr). Don't save & restore function_name_declared_p. (finish_translation_unit): Call finish_fname_decls. (expand_body): Remove function_name_declared_p. * typeck2.c (digest_init): Allow any ERROR_MARK. testsuite: * gcc.dg/c99-func-2.c: Remove xfail. * gcc.dg/c99-func-3.c: Remove xfail. * gcc.dg/c99-func-4.c: Remove xfail. From-SVN: r41520
2001-04-24 10:22:06 +02:00
/* Do file scope __FUNCTION__ et al. */
Lazy __FUNCTION__ generation. gcc: Lazy __FUNCTION__ generation. * c-common.h (RID_FUNCTION_NAME, RID_PRETTY_FUNCTION_NAME, RID_C99_FUNCTION_NAME): New _RIDs. (CTI_FUNCTION_ID, CTI_PRETTY_FUNCTION_ID, CTI_FUNC_ID): Remove. (CTI_FUNCTION_NAME_DECL, CTI_PRETTY_FUNCTION_NAME_DECL, CTI_C99_FUNCTION_NAME_DECL, CTI_SAVED_FUNCTION_NAME_DECLS): New global tree slots. (function_id_node, pretty_function_id_node, func_id_node): Remove. (c99_function_name_decl_node, function_name_decl_node, pretty_function_name_decl_node, saved_function_name_decls): Declare. (struct language_function): Remove x_function_name_declared_p. (make_fname_decl): Remove a parameter. (declare_function_names): Remove prototype. (start_fname_decls, finish_fname_decls): Prototype. (fname_as_string): Likewise. (fname_string, fname_decl): Likewise. * c-common.c (make_fname_decl): Adjust. (struct fname_var_t): New struct. (fname_vars): New static array. (declare_function_name): Remove. (start_fname_decls, finish_fname_decls): New functions. (fname_as_string): New function from remnants of declare_function_name. (fname_string, fname_decl): New functions. * c-decl.c (c_function_name_declared_p): Remove. (init_decl_processing): Don't generate __FUNCTION__ et al ids, don't call declare_function_name. Call start_fname_decls. (c_make_fname_decl): Adjust parameters. Generate the name. Don't clobber the line number. Call finish_decl. (start_function): Call start_fname_decls. (finish_function): Call finish_fname_decls. Remove c_function_name_declared_p. (push_c_function_context): Don't push c_function_name_declared_p. (pop_c_function_context): Don't pop c_function_name_declared_p. (c_begin_compound_stmt): Don't check c_function_name_declared_p. * c-parse.in (STRING_FUNC_NAME, VAR_FUNC_NAME): New tokens. (program): Call finish_fname_decls for C. (primary): Add VAR_FUNC_NAME. (reswords): Add slots for __FUNCTION__ et al. (rid_to_yy): Add mappings for __FUNCTION__ et al. (yylexname): If it's a STRING_FUNC_NAME generate the function name now. Don't look for VAR_DECLs containing __FUNCTION__ et al. * c-semantics.c (prune_unused_decls): Remove. (finish_stmt_tree): Don't call prune_unused_decls. (genrtl_decl_stmt): Don't prune unused decls here. cp: Lazy __FUNCTION__ generation. * cp-tree.def (FUNCTION_NAME): Remove. * cp-tree.h (function_name_declared_p): Remove. (cp_fname_init): Prototype. * decl.c (init_decl_processing): Don't generate __FUNCTION__ et al ids, don't call declare_function_name. Call start_fname_decls. (cp_make_fname_decl): Adjust parameters. Generate the name. Don't clobber the line number. (cp_fname_init): New function. (start_function): Call start_fname_decls. (finish_function): Call finish_fname_decls. * lex.c (reswords): Add slots for __FUNCTION__ et al. (rid_to_yy): Add mappings for __FUNCTION__ et al. * optimize.c (maybe_clone_body): Remove function_name_declared_p. * parse.y (VAR_FUNC_NAME): New token. (primary): Add VAR_FUNC_NAME. * pt.c (tsubst_decl): Adjust a DECL_PRETTY_FUNCTION_P's generation. (tsubst, FUNCTION_NAME case): Remove. (tsubst_copy, FUNCTION_NAME case): Remove. (tsubst_expr, DECL_STMT case): Be careful with a DECL_PRETTY_FUNCTION_P. (instantiate_decl): Remove function_name_declared_p. * semantics.c (begin_compound_statement): Don't call declare_function_name here. (setup_vtbl_ptr). Don't save & restore function_name_declared_p. (finish_translation_unit): Call finish_fname_decls. (expand_body): Remove function_name_declared_p. * typeck2.c (digest_init): Allow any ERROR_MARK. testsuite: * gcc.dg/c99-func-2.c: Remove xfail. * gcc.dg/c99-func-3.c: Remove xfail. * gcc.dg/c99-func-4.c: Remove xfail. From-SVN: r41520
2001-04-24 10:22:06 +02:00
finish_fname_decls ();
}
/* Finish a template type parameter, specified as AGGR IDENTIFIER.
Returns the parameter. */
tree
finish_template_type_parm (tree aggr, tree identifier)
{
extend.texi (C++ Signatures): Remove node. * extend.texi (C++ Signatures): Remove node. * invoke.texi: Remove discussion of -fhandle-signatures, signature, sigof, __signature__, and __sigof__. * Make-lang.in (CXX_SRCS): Remove sig.c. * Makefile.in (CXX_OBJS): Remove sig.o. (sig.o): Remove. * cp-tree.h (CPTI_OPAQUE_TYPE): Remove. (CPTI_SIGNATURE_TYPE): Likewise. (CPTI_SIGTABLE_ENTRY_TYPE): Likewise. (opaque_type_node): Likewise. (signature_type_node): Likewise. (sigtable_entry_type): Likewise. (flag_handle_signatures): Likewise. (lang_type): Remove is_signature, is_signature_pointer, is_signature_reference, has_opaque_typedecls, sigtables_has_been_generated. Adjust dummy. Remove signature, signature_pointer_to, signature_reference_to. (IS_SIGNATURE): Remove. (SET_SIGNATURE): Remove. (CLEAR_SIGNATURE): Remove. (IS_SIGNATURE_POINTER): Remove. (IS_SIGNATURE_REFERENCE): Remove. (SIGNATURE_HAS_OPAQUE_TYPEDECLS): Remove. (SIGTABLE_HAS_BEEN_GENERATED): Remove. (CLASSTYPE_SIGNATURE): Remove. (SIGNATURE_TYPE): Remove. (SIGNATURE_METHOD_VEC): Remove. (SIGNATURE_POINTER_TO): Remove. (SIGNATURE_REFERENCE_TO): Remove. (lang_decl_flags): Remove is_default_implementation. Rename memfunc_pointer_to to saved_tree. (IS_DEFAULT_IMPLEMENTATION): Remove. (DECL_MEMFUNC_POINTER_TO): Remove. (DECL_MEMFUNC_POINTING_TO): Remove. (DECL_SAVED_TREE): Adjust definition. (tag_types): Remove signature_type_node. (SIGNATURE_FIELD_NAME): Remove. (SIGNATURE_FIELD_NAME_FORMAT): Likewise. (SIGNATURE_OPTR_NAME): Likewise. (SIGNATURE_SPTR_NAME): Likewise. (SIGNATURE_POINTER_NAME): Likewise. (SIGNATURE_POINTER_NAME_FORMAT): Likewise. (SIGNATURE_REFERENCE_NAME): Likewise. (SIGNATURE_REFERNECE_NAME_FORMAT): Likewise. (SIGTABLE_PTR_TYPE): Likewise. (SIGTABLE_NAME_FORMAT): Likewise. (SIGTABLE_NAME_FORMAT_LONG): Likewise. (SIGTABLE_TAG_NAME): Likewise. (SIGTABLE_VB_OFF_NAME): Likewise. (SIGTABLE_VT_OFF_NAME): Likewise. (finish_base_specifiers): Change prototype. (build_signature_pointer_type): Remove. (build_signature_reference_type): Remove. (build_signature_pointer_constructor): Remove. (build_signature_method_call): Remove. (build_optr_ref): Likewise. (append_signature_fields): Likewise. (signature_error): Likewise. * call.c (build_this): Remove signature support. (build_over_call): Likewise. (build_new_method_call): Likewise. * class.c (add_implicitly_declared_members): Likewise. (finish_struct_1): Likewise. (finish_struct): Likewise. * cvt.c (cp_convert_to_pointer): Likewise. (convert_to_pointer_force): Likewise. (ocp_convert): Likewise. * decl.c (sigtable_decl_p): Remove. (init_decl_processing): Remove support for signatures. (cp_finish_decl): Likewise. (grokdeclarator): Likewise. (grokparms): Likewise. (xref_tag): Likewise. (start_function): Likewise. (start_method): Likewise. * decl2.c (finish_sigtable_vardecl): Remove. (flag_handle_signatures): Remove. (lang_f_options): Remove handle-signatures. (grokfield): Remove support for signatures. (grokbitfield): Likewise. (finish_file): Likewise. (reparse_absdcl_as_casts): Likewise. * error.c (dump_type_real): Likewise. (dump_function_decl): Likewise. * friend.c (make_friend_class): Likewise. * gxx.gperf: Remove __signature__, signature, __sigof__, sigof. * hash.h: Regenerated. * init.c (build_new_1): Remove support for signatures. * lang-options.h: Remove -fhandle-signatures, -fno-handle-signatures. * lex.c (init_parse): Remove support for signatures. (yyprint): Likewise. * lex.h (rid): Remove RID_SIGNATURE. * method.c (build_decl_overload_real): Remove support for signatures. (hack_identifier): Likewise. * parse.y (base_class): Likewise. (base_class.1): Likewise. (access_specifier): Likewise. * search.c (lookup_member): Likewise. * semantics.c (finish_qualified_object_call_expr): Likewise. (finish_template_type_parm): Likewise. (begin_class_definition): Likewise. (finish_base_specifier): Likewise. * sig.c: Remove. * tree.c (build_cplus_method_type): Remove support for signatures. * typeck.c (require_complete_type): Likewise. (c_sizeof): Likewise. (c_alignof): Likewise. (build_object_ref): Likewise. (build_component_ref): Likewise. (build_indirect_ref): Likewise. (build_c_cast): Likewise. (build_modify_expr): Likewise. (convert_for_initialization): Likewise. * typeck2.c (signature_error): Remove. (store_init_value): Remove support for signatures. (digest_init): Likewise. (build_x_arrow): Likewise. (build_functional_cast): Likewise. * xref.c (GNU_xref_decl): Likewise. From-SVN: r28677
1999-08-11 22:22:41 +02:00
if (aggr != class_type_node)
{
pedwarn ("template type parameters must use the keyword `class' or `typename'");
aggr = class_type_node;
}
return build_tree_list (aggr, identifier);
}
/* Finish a template template parameter, specified as AGGR IDENTIFIER.
Returns the parameter. */
tree
finish_template_template_parm (tree aggr, tree identifier)
{
tree decl = build_decl (TYPE_DECL, identifier, NULL_TREE);
tree tmpl = build_lang_decl (TEMPLATE_DECL, identifier, NULL_TREE);
DECL_TEMPLATE_PARMS (tmpl) = current_template_parms;
DECL_TEMPLATE_RESULT (tmpl) = decl;
DECL_ARTIFICIAL (decl) = 1;
end_template_decl ();
my_friendly_assert (DECL_TEMPLATE_PARMS (tmpl), 20010110);
return finish_template_type_parm (aggr, tmpl);
}
/* ARGUMENT is the default-argument value for a template template
parameter. If ARGUMENT is invalid, issue error messages and return
the ERROR_MARK_NODE. Otherwise, ARGUMENT itself is returned. */
tree
check_template_template_default_arg (tree argument)
{
if (TREE_CODE (argument) != TEMPLATE_DECL
&& TREE_CODE (argument) != TEMPLATE_TEMPLATE_PARM
&& TREE_CODE (argument) != TYPE_DECL
&& TREE_CODE (argument) != UNBOUND_CLASS_TEMPLATE)
{
error ("invalid default template argument");
return error_mark_node;
}
return argument;
}
/* Finish a parameter list, indicated by PARMS. If ELLIPSIS is
nonzero, the parameter list was terminated by a `...'. */
tree
finish_parmlist (tree parms, int ellipsis)
{
if (parms)
{
/* We mark the PARMS as a parmlist so that declarator processing can
disambiguate certain constructs. */
TREE_PARMLIST (parms) = 1;
/* We do not append void_list_node here, but leave it to grokparms
to do that. */
PARMLIST_ELLIPSIS_P (parms) = ellipsis;
}
return parms;
}
/* Begin a class definition, as indicated by T. */
tree
begin_class_definition (tree t)
{
if (t == error_mark_node)
return error_mark_node;
if (processing_template_parmlist)
{
error ("definition of `%#T' inside template parameter list", t);
return error_mark_node;
}
/* A non-implicit typename comes from code like:
template <typename T> struct A {
template <typename U> struct A<T>::B ...
This is erroneous. */
else if (TREE_CODE (t) == TYPENAME_TYPE)
{
error ("invalid definition of qualified type `%T'", t);
t = error_mark_node;
}
if (t == error_mark_node || ! IS_AGGR_TYPE (t))
{
t = make_aggr_type (RECORD_TYPE);
pushtag (make_anon_name (), t, 0);
}
/* If this type was already complete, and we see another definition,
that's an error. */
cp-tree.h (lang_type_class): Remove is_partial_instantiation. * cp-tree.h (lang_type_class): Remove is_partial_instantiation. (PARTIAL_INSTANTIATION_P): Remove. (IMPLICIT_TYPENAME_P): Likewise. (IMPLICIT_TYPENAME_TYPE_DECL_P): Likewise. (build_typename_type): Remove declaration. (parmlist_is_exprlist): Likewise. * decl.c (build_typename_type): Make it static, remove third parameter. (push_class_binding): Don't do implicit typename stuff. (make_typename_type): Likewise. (lookup_name_real): Likewise. (grokdeclarator): Don't try to convert declarations into initializations. Don't do implicit typename stuff. (parmlist_is_exprlist): Remove. (xref_basetypes): Simplify. * decl2.c (grokfield): Don't try to convert declarations into initializations. (build_anon_union_vars): Do this while processing templates, too. (finish_anon_union): Likewise. * error.c (dump_type): Remove implicit typename handling. * parser.c (cp_parser_diagnose_invalid_type_name): New method. (cp_parser_primary_expression): Correct handling of names not found by unqualified name lookup in templates. (cp_parser_nested_name_specifier_opt): Avoid checking dependency of types when possible. (cp_parser_simple_declaration): Complain intelligently about some invalid declarations. (cp_parser_member_declaration): Likewise. (cp_parser_constructor_declarator_p): Don't check when we're in a function scope. * pt.c (instantiate_class_template): Remove PARTIAL_INSTANTIATION_P gunk. * search.c (lookup_field_r): Don't build implicit typenames. (marked_pushdecls_p): Don't enter dependent base types. (unmarked_pushdecls_p): Likewise. * semantics.c (begin_class_definition): Remove implicit typename stuff. * config/locale/gnu/messages_members.h: Use this-> to refer to unqualified members of base clasess. * config/locale/ieee_1003.1-2001/codecvt_specializations.h: Likewise. * include/bits/codecvt.h: Likewise. * include/bits/deque.tcc: Likewise. * include/bits/fstream.tcc: Likewise. * include/bits/istream.tcc: Likewise. * include/bits/list.tcc: Likewise. * include/bits/locale_facets.h: Likewise. * include/bits/ostream.tcc: Likewise. * include/bits/sstream.tcc: Likewise. * include/bits/stl_bvector.h: Likewise. * include/bits/stl_deque.h: Likewise. * include/bits/stl_list.h: Likewise. * include/bits/stl_tree.h: Likewise. * include/bits/stl_vector.h: Likewise. * include/bits/vector.tcc: Likewise. * include/ext/ropeimpl.h: Likewise. * include/ext/stdio_filebuf.h: Likewise. * include/ext/stl_rope.h: Likewise. * include/std/std_fstream.h: Likewise. * include/std/std_sstream.h: Likewise. Co-Authored-By: Jeffrey Oldham <oldham@codesourcery.com> From-SVN: r61403
2003-01-16 21:30:50 +01:00
if (COMPLETE_TYPE_P (t))
{
error ("redefinition of `%#T'", t);
cp_error_at ("previous definition of `%#T'", t);
return error_mark_node;
}
/* Update the location of the decl. */
DECL_SOURCE_LOCATION (TYPE_NAME (t)) = input_location;
if (TYPE_BEING_DEFINED (t))
{
t = make_aggr_type (TREE_CODE (t));
pushtag (TYPE_IDENTIFIER (t), t, 0);
}
maybe_process_partial_specialization (t);
pushclass (t);
TYPE_BEING_DEFINED (t) = 1;
TYPE_PACKED (t) = flag_pack_struct;
/* Reset the interface data, at the earliest possible
moment, as it might have been set via a class foo;
before. */
if (! TYPE_ANONYMOUS_P (t))
{
CLASSTYPE_INTERFACE_ONLY (t) = interface_only;
SET_CLASSTYPE_INTERFACE_UNKNOWN_X
(t, interface_unknown);
}
reset_specialization();
/* Make a declaration for this class in its own scope. */
build_self_reference ();
return t;
}
cp-tree.def (PTRMEM_CST): New tree node. * cp-tree.def (PTRMEM_CST): New tree node. * cp-tree.h (ptrmem_cst): New type. (lang_type): Remove local_typedecls. (dummy): Increase to 12 bits from 11. (CLASSTYPE_LOCAL_TYPEDECLS): Remove. (PTRMEM_CST_CLASS): New macro. (PTRMEM_CST_MEMBER): Likewise. (current_access_specifier): New variable. (current_class_type): Remove duplicate declaration. (finish_struct): Change prototype. (unreverse_member_declarations): New function. (pushdecl_class_level): Change prototype. (grok_enum_decls): Remove. (fixup_anonymous_union): New function. (grok_x_components): Change prototype. (tsubst_chain): Remove. (finish_member_template_decl): Likewise. (check_explicit_specialization): Fix indentation. (finish_class_definition): Change prototype. (finish_member_class_template): Likewise. (finish_member_declaration): New function. (check_multiple_declarators): Likewise. * class.c (class_stack_node_t): New type. (current_class_base): Remove. (current_class_stack): Change type. (current_access_specifier): New variable. (grow_method): Remove. (check_member_decl_is_same_in_complete_scope): Break out from finish_struct. (make_method_vec): New function. (free_method_vec): Likewise. (add_implicitly_declared_members): Break out from finish_struct_1. (free_method_vecs): New variable. (add_method): Rework for direct use from parser. (handle_using_decl): Watch for NULL_TREE while iterating through CLASSTYPE_METHOD_VEC. (finish_struct_methods): Don't build CLASSTYPE_METHOD_VEC here; just do some error-checking. (warn_hidden): Change iteration through CLASSTYPE_METHOD_VEC. (finish_struct_1): Simplify. Use add_implicitly_declared_members. (finish_struct): Change prototype. Simplify; fields and methods are already set up at this point. (init_class_processing): Set up current_class_stack. (pushclass): Save current_access_specifier. (popclass): Restore it. (currently_open_class): Simplify. (build_self_reference): Remove use of CLASSTYPE_LOCAL_TYPEDECLS. * decl.c (saved_scope): Add access_specifier. (maybe_push_to_top_level): Save it. (pop_from_top_level): Restore it. (maybe_process_template_type_declaration): Use finish_member_declaration. (pushtag): Likewise. (pushdecl_class_level): Don't return a value. (fixup_anonymous_union): Break out from grok_x_components. (shadow_tag): Use it. (xref_tag): Complain about using an elaborated type specifier to reference a template type parameter or typedef name. (xref_basetypes): Don't set CLASSTYPE_LOCAL_TYPEDECLS. (current_local_enum): Remove. (build_enumerator): Call finish_member_declaration. (grok_enum_decls): Remove. * decl2.c (grok_x_components): Simplify. (check_classfn): Change iteration through CLASSTYPE_METHOD_VEC. (grokfield): Don't set CLASSTYPE_LOCAL_TYPEDECLS. (merge_functions): Add to comment. (arg_assoc_type): Prototype. (arg_assoc): Pass as many arguments as there are parameters. * error.c (dump_expr): Handle PTRMEM_CST. Improve handling of OFFSET_REF. * expr.c (cpls_expand_expr): Remove dead code. Handle PTRMEM_CST. * friend.c (do_friend): Lookup friends when in nested classes. Change comments. * init.c (build_offset_ref): Do lookup even for classes that are only partially defined. (decl_constant_value): Remove dead code. * method.c (build_overload_value): Remove hack where by TYPE was not a TYPE. Handle PTRMEM_CST. (build_template_parm_names): Don't pass a PARM_DECL where a TYPE should go. * parse.y (components, notype_components, component_decl, component_decl_1, component_declarator, component_declarator0): Now all are itype rather than ttype. Rework to add members to classes on the fly. (typesqpecqual_reserved): Use check_multiple_declarators. (structsp): Update class to finish_class_definition. (do_xref_defn): Unsplit into named_class_head. (access_specifier): Set current_access_specifier. * pt.c (set_current_access_from_decl): New function. (finish_member_template_decl): Don't take the parameters. (comp_template_args): Make more robust. (lookup_template_class): Don't use current_local_enum. (for_each_template_parm): Handle PTRMEM_CST. (instantiate_class_template): Use set_current_access_from_decl, finish_member_declaration and unreverse_member_declarations. Set lineno/input_filename before generating implicit member functions. (type_unification_real): Don't assume back-unification happens only for the last argument. (regenerate_decl_from_template): Call pushclass a bit earlier. (tsubst_chain): Remove. (tsubst_enum): Use set_current_access_from_decl. (set_mangled_name_for_template_decl): Fix indentation. * search.c (lookup_fnfields_1): Change iteration through CLASSTYPE_METHOD_VEC. (dfs_pushdecls): Likewise. (dfs_compress_decls): Likewise. (add_conversions): Likewise. * semantics.c (finish_class_definition): Don't take components. Change call to finish_struct. (finish_member_declaration): New function. (finish_member_class_template): Don't take template parameters. Change call to grok_x_components. Call finish_member_template_decl. (check_multiple_declarators): New function. * sig.c (append_signature_fields): Work from the TYPE_METHODS, not a passed in fieldlist. * tree.c (search_tree): Handle PTRMEM_CST. (mapcar): Likewise. * typeck.c (unary_complex_lvalue): Build PTRMEM_CSTs, not INTEGER_CSTs, for pointer-to-data members. From-SVN: r22869
1998-10-06 16:20:30 +02:00
/* Finish the member declaration given by DECL. */
void
finish_member_declaration (tree decl)
cp-tree.def (PTRMEM_CST): New tree node. * cp-tree.def (PTRMEM_CST): New tree node. * cp-tree.h (ptrmem_cst): New type. (lang_type): Remove local_typedecls. (dummy): Increase to 12 bits from 11. (CLASSTYPE_LOCAL_TYPEDECLS): Remove. (PTRMEM_CST_CLASS): New macro. (PTRMEM_CST_MEMBER): Likewise. (current_access_specifier): New variable. (current_class_type): Remove duplicate declaration. (finish_struct): Change prototype. (unreverse_member_declarations): New function. (pushdecl_class_level): Change prototype. (grok_enum_decls): Remove. (fixup_anonymous_union): New function. (grok_x_components): Change prototype. (tsubst_chain): Remove. (finish_member_template_decl): Likewise. (check_explicit_specialization): Fix indentation. (finish_class_definition): Change prototype. (finish_member_class_template): Likewise. (finish_member_declaration): New function. (check_multiple_declarators): Likewise. * class.c (class_stack_node_t): New type. (current_class_base): Remove. (current_class_stack): Change type. (current_access_specifier): New variable. (grow_method): Remove. (check_member_decl_is_same_in_complete_scope): Break out from finish_struct. (make_method_vec): New function. (free_method_vec): Likewise. (add_implicitly_declared_members): Break out from finish_struct_1. (free_method_vecs): New variable. (add_method): Rework for direct use from parser. (handle_using_decl): Watch for NULL_TREE while iterating through CLASSTYPE_METHOD_VEC. (finish_struct_methods): Don't build CLASSTYPE_METHOD_VEC here; just do some error-checking. (warn_hidden): Change iteration through CLASSTYPE_METHOD_VEC. (finish_struct_1): Simplify. Use add_implicitly_declared_members. (finish_struct): Change prototype. Simplify; fields and methods are already set up at this point. (init_class_processing): Set up current_class_stack. (pushclass): Save current_access_specifier. (popclass): Restore it. (currently_open_class): Simplify. (build_self_reference): Remove use of CLASSTYPE_LOCAL_TYPEDECLS. * decl.c (saved_scope): Add access_specifier. (maybe_push_to_top_level): Save it. (pop_from_top_level): Restore it. (maybe_process_template_type_declaration): Use finish_member_declaration. (pushtag): Likewise. (pushdecl_class_level): Don't return a value. (fixup_anonymous_union): Break out from grok_x_components. (shadow_tag): Use it. (xref_tag): Complain about using an elaborated type specifier to reference a template type parameter or typedef name. (xref_basetypes): Don't set CLASSTYPE_LOCAL_TYPEDECLS. (current_local_enum): Remove. (build_enumerator): Call finish_member_declaration. (grok_enum_decls): Remove. * decl2.c (grok_x_components): Simplify. (check_classfn): Change iteration through CLASSTYPE_METHOD_VEC. (grokfield): Don't set CLASSTYPE_LOCAL_TYPEDECLS. (merge_functions): Add to comment. (arg_assoc_type): Prototype. (arg_assoc): Pass as many arguments as there are parameters. * error.c (dump_expr): Handle PTRMEM_CST. Improve handling of OFFSET_REF. * expr.c (cpls_expand_expr): Remove dead code. Handle PTRMEM_CST. * friend.c (do_friend): Lookup friends when in nested classes. Change comments. * init.c (build_offset_ref): Do lookup even for classes that are only partially defined. (decl_constant_value): Remove dead code. * method.c (build_overload_value): Remove hack where by TYPE was not a TYPE. Handle PTRMEM_CST. (build_template_parm_names): Don't pass a PARM_DECL where a TYPE should go. * parse.y (components, notype_components, component_decl, component_decl_1, component_declarator, component_declarator0): Now all are itype rather than ttype. Rework to add members to classes on the fly. (typesqpecqual_reserved): Use check_multiple_declarators. (structsp): Update class to finish_class_definition. (do_xref_defn): Unsplit into named_class_head. (access_specifier): Set current_access_specifier. * pt.c (set_current_access_from_decl): New function. (finish_member_template_decl): Don't take the parameters. (comp_template_args): Make more robust. (lookup_template_class): Don't use current_local_enum. (for_each_template_parm): Handle PTRMEM_CST. (instantiate_class_template): Use set_current_access_from_decl, finish_member_declaration and unreverse_member_declarations. Set lineno/input_filename before generating implicit member functions. (type_unification_real): Don't assume back-unification happens only for the last argument. (regenerate_decl_from_template): Call pushclass a bit earlier. (tsubst_chain): Remove. (tsubst_enum): Use set_current_access_from_decl. (set_mangled_name_for_template_decl): Fix indentation. * search.c (lookup_fnfields_1): Change iteration through CLASSTYPE_METHOD_VEC. (dfs_pushdecls): Likewise. (dfs_compress_decls): Likewise. (add_conversions): Likewise. * semantics.c (finish_class_definition): Don't take components. Change call to finish_struct. (finish_member_declaration): New function. (finish_member_class_template): Don't take template parameters. Change call to grok_x_components. Call finish_member_template_decl. (check_multiple_declarators): New function. * sig.c (append_signature_fields): Work from the TYPE_METHODS, not a passed in fieldlist. * tree.c (search_tree): Handle PTRMEM_CST. (mapcar): Likewise. * typeck.c (unary_complex_lvalue): Build PTRMEM_CSTs, not INTEGER_CSTs, for pointer-to-data members. From-SVN: r22869
1998-10-06 16:20:30 +02:00
{
if (decl == error_mark_node || decl == NULL_TREE)
return;
if (decl == void_type_node)
/* The COMPONENT was a friend, not a member, and so there's
nothing for us to do. */
return;
/* We should see only one DECL at a time. */
my_friendly_assert (TREE_CHAIN (decl) == NULL_TREE, 0);
/* Set up access control for DECL. */
TREE_PRIVATE (decl)
= (current_access_specifier == access_private_node);
TREE_PROTECTED (decl)
= (current_access_specifier == access_protected_node);
if (TREE_CODE (decl) == TEMPLATE_DECL)
{
c-convert.c (convert): Return if output or input type is ERROR_MARK. * c-convert.c (convert): Return if output or input type is ERROR_MARK. * c-decl.c (duplicate_decls): Only look at DECL_BUILT_IN_NONANSI and DECL_INLINE if FUNCTION_DECL. (pushdecl, redeclaration_error_message): Likewise, for DECL_INLINE. (store_parm_decls): Check for type of PARM_DECL being ERROR_MARK. Use DECL_WEAK, not DECL_RESULT, to flag for already seen. (combine_parm_decls): Likewise. * ggc-common.c (gcc_mark_tree_children, case 'd'): Use DECL_RESULT_FLD. * print-tree.c (print_node): Likewise. Only test DECL_PACKED, DECL_INLINE, DECL_BIT_FIELD, and DECL_TRANSPARENT_UNION on proper decl types. Properly handly DECL_INCOMING_RTL and DECL_SAVED_INSNS. * stor-layout.c (layout_decl): Only check DECL_PACKED and DECL_BIT_FIELD of FIELD_DECL. * tree.h (DECL_RESULT_FLD): New macro. * cp/class.c (check_field_decl): Fix typo. (build_vtbl_or_vbase_field): Don't clear DECL_SAVED_INSNS. (check_methods): Likewise. (check_field_decls): Likewise. Use DECL_CONTEXT, not DECL_FIELD_CONTEXT. * cp-tree.h (DECL_SHADOWED_FOR_VAR, DECL_TEMPLATE_RESULT): Use DECL_RESULT_FLD, not DECL_RESULT. * cp/decl.c (xref_tag): Use DECL_TEMPLATE_RESULT. * cp/lex.c (identifier_type): Likewise. * cp/pt.c (determine_specialization, lookup_template_class): Likewise. (tsubst_friend_function, tsubst_decl, instantiate_template): Likewise. (resolve_overloaded_unification, more_specialized): Likewise. * cp/semantics.c (finish_member_declaration): Likewise. * cp/typeck.c (build_x_function_call): Likewise. From-SVN: r32759
2000-03-27 03:26:18 +02:00
TREE_PRIVATE (DECL_TEMPLATE_RESULT (decl)) = TREE_PRIVATE (decl);
TREE_PROTECTED (DECL_TEMPLATE_RESULT (decl)) = TREE_PROTECTED (decl);
cp-tree.def (PTRMEM_CST): New tree node. * cp-tree.def (PTRMEM_CST): New tree node. * cp-tree.h (ptrmem_cst): New type. (lang_type): Remove local_typedecls. (dummy): Increase to 12 bits from 11. (CLASSTYPE_LOCAL_TYPEDECLS): Remove. (PTRMEM_CST_CLASS): New macro. (PTRMEM_CST_MEMBER): Likewise. (current_access_specifier): New variable. (current_class_type): Remove duplicate declaration. (finish_struct): Change prototype. (unreverse_member_declarations): New function. (pushdecl_class_level): Change prototype. (grok_enum_decls): Remove. (fixup_anonymous_union): New function. (grok_x_components): Change prototype. (tsubst_chain): Remove. (finish_member_template_decl): Likewise. (check_explicit_specialization): Fix indentation. (finish_class_definition): Change prototype. (finish_member_class_template): Likewise. (finish_member_declaration): New function. (check_multiple_declarators): Likewise. * class.c (class_stack_node_t): New type. (current_class_base): Remove. (current_class_stack): Change type. (current_access_specifier): New variable. (grow_method): Remove. (check_member_decl_is_same_in_complete_scope): Break out from finish_struct. (make_method_vec): New function. (free_method_vec): Likewise. (add_implicitly_declared_members): Break out from finish_struct_1. (free_method_vecs): New variable. (add_method): Rework for direct use from parser. (handle_using_decl): Watch for NULL_TREE while iterating through CLASSTYPE_METHOD_VEC. (finish_struct_methods): Don't build CLASSTYPE_METHOD_VEC here; just do some error-checking. (warn_hidden): Change iteration through CLASSTYPE_METHOD_VEC. (finish_struct_1): Simplify. Use add_implicitly_declared_members. (finish_struct): Change prototype. Simplify; fields and methods are already set up at this point. (init_class_processing): Set up current_class_stack. (pushclass): Save current_access_specifier. (popclass): Restore it. (currently_open_class): Simplify. (build_self_reference): Remove use of CLASSTYPE_LOCAL_TYPEDECLS. * decl.c (saved_scope): Add access_specifier. (maybe_push_to_top_level): Save it. (pop_from_top_level): Restore it. (maybe_process_template_type_declaration): Use finish_member_declaration. (pushtag): Likewise. (pushdecl_class_level): Don't return a value. (fixup_anonymous_union): Break out from grok_x_components. (shadow_tag): Use it. (xref_tag): Complain about using an elaborated type specifier to reference a template type parameter or typedef name. (xref_basetypes): Don't set CLASSTYPE_LOCAL_TYPEDECLS. (current_local_enum): Remove. (build_enumerator): Call finish_member_declaration. (grok_enum_decls): Remove. * decl2.c (grok_x_components): Simplify. (check_classfn): Change iteration through CLASSTYPE_METHOD_VEC. (grokfield): Don't set CLASSTYPE_LOCAL_TYPEDECLS. (merge_functions): Add to comment. (arg_assoc_type): Prototype. (arg_assoc): Pass as many arguments as there are parameters. * error.c (dump_expr): Handle PTRMEM_CST. Improve handling of OFFSET_REF. * expr.c (cpls_expand_expr): Remove dead code. Handle PTRMEM_CST. * friend.c (do_friend): Lookup friends when in nested classes. Change comments. * init.c (build_offset_ref): Do lookup even for classes that are only partially defined. (decl_constant_value): Remove dead code. * method.c (build_overload_value): Remove hack where by TYPE was not a TYPE. Handle PTRMEM_CST. (build_template_parm_names): Don't pass a PARM_DECL where a TYPE should go. * parse.y (components, notype_components, component_decl, component_decl_1, component_declarator, component_declarator0): Now all are itype rather than ttype. Rework to add members to classes on the fly. (typesqpecqual_reserved): Use check_multiple_declarators. (structsp): Update class to finish_class_definition. (do_xref_defn): Unsplit into named_class_head. (access_specifier): Set current_access_specifier. * pt.c (set_current_access_from_decl): New function. (finish_member_template_decl): Don't take the parameters. (comp_template_args): Make more robust. (lookup_template_class): Don't use current_local_enum. (for_each_template_parm): Handle PTRMEM_CST. (instantiate_class_template): Use set_current_access_from_decl, finish_member_declaration and unreverse_member_declarations. Set lineno/input_filename before generating implicit member functions. (type_unification_real): Don't assume back-unification happens only for the last argument. (regenerate_decl_from_template): Call pushclass a bit earlier. (tsubst_chain): Remove. (tsubst_enum): Use set_current_access_from_decl. (set_mangled_name_for_template_decl): Fix indentation. * search.c (lookup_fnfields_1): Change iteration through CLASSTYPE_METHOD_VEC. (dfs_pushdecls): Likewise. (dfs_compress_decls): Likewise. (add_conversions): Likewise. * semantics.c (finish_class_definition): Don't take components. Change call to finish_struct. (finish_member_declaration): New function. (finish_member_class_template): Don't take template parameters. Change call to grok_x_components. Call finish_member_template_decl. (check_multiple_declarators): New function. * sig.c (append_signature_fields): Work from the TYPE_METHODS, not a passed in fieldlist. * tree.c (search_tree): Handle PTRMEM_CST. (mapcar): Likewise. * typeck.c (unary_complex_lvalue): Build PTRMEM_CSTs, not INTEGER_CSTs, for pointer-to-data members. From-SVN: r22869
1998-10-06 16:20:30 +02:00
}
/* Mark the DECL as a member of the current class. */
Make DECL_CONTEXT mean the class in which a member function was declared, even for a virtual function. Make DECL_CONTEXT mean the class in which a member function was declared, even for a virtual function. * cp-tree.h (DECL_CLASS_CONTEXT): Adjust. (DECL_FRIEND_CONTEXT): New macro. (DECL_REAL_CONTEXT): Remove. (SET_DECL_FRIEND_CONTEXT): Likewise. (DECL_VIRTUAL_CONTEXT): Adjust. (DECL_CLASS_SCOPE_P): Use TYPE_P. (add_friends): Remove. (hack_decl_function_context): Likewise. * call.c (build_new_function_call): Replace DECL_REAL_CONTEXT with CP_DECL_CONTEXT. (build_over_call): Fix indentation. Use DECL_CONTEXT instead of DECL_CLASS_CONTEXT. * class.c (dfs_build_vcall_offset_vtbl_entries): Likewise. (add_method): Set DECL_VIRTUAL_CONTEXT, not DECL_CLASS_CONTEXT. (strictly_overrides): Use DECL_CONTEXT, not DECL_CLASS_CONTEXT. (build_vtbl_or_vbase_field): Don't set DECL_CLASS_CONTEXT. (build_base_field): Likewise. (finish_struct_1): Likewise. (build_self_reference): Likewise. * decl.c (push_class_binding): Use CP_DECL_CONTEXT, not DECL_REAL_CONTEXT. (pushtag): Use decl_function_context, not hack_decl_function_context. (decls_match): Use CP_DECL_CONTEXT, not DECL_REAL_CONTEXT. (duplicate_decls): Use DECL_VIRTUAL_CONTEXT. (pushdecl): Remove bogus code. (start_decl): Use DECL_CONTEXT rather than DECL_CLASS_CONTEXT. (cp_finish_decl): Use CP_DECL_CONTEXT, not DECL_REAL_CONTEXT. (grokfndecl): Use DECL_CONTEXT, not DECL_CLASS_CONTEXT. Use decl_function_context, nothack_decl_function_context. (grokvardecl): Don't set DECL_CLASS_CONTEXT. (grokdeclarator): Likewise. Use decl_function_context, not hack_decl_function_context. (copy_args_p): Document. Don't use DECL_CLASS_CONTEXT. (start_function): Use DECL_FRIEND_CONTEXT, not DECL_CLASS_CONTEXT. Use decl_function_context, not hack_decl_function_context. (finish_function): Use decl_function_context, not hack_decl_function_context. (maybe_retrofit_in_chrg): Use DECL_CONTEXT, not DECL_CLASS_CONTEXT. (grokclassfn): Set DECL_VIRTUAL_CONTEXT, not DECL_CONTEXT. (finish_static_data_member_decl): Don't set DECL_CLASS_CONTEXT. (grokfield): Likewise. (finish_builtin_type): Likewise. (finish_vtable_vardec): Use decl_function_context, not hack_decl_function_context. (import_export_decl): Use DECL_CONTEXT, not DECL_CLASS_CONTEXT. (start_static_initialization_or_destruction): Likewise. (finish_static_initialization_or_destruction): Likewise. (mark_used): Adjust logic for deciding when to synthesize methods. * dump.c (dequeue_and_dump): Use CP_DECL_CONTEXT, not DECL_REAL_CONTEXT. * error.c (dump_function_decl): Use DECL_CONTEXT, not DECL_CLASS_CONTEXT. * friend.c (is_friend): Likewise. (add_friends): Remove. (do_friend): Use SET_DECL_FRIEND_CONTEXT. * lex.c (begin_definition_of_inclass_inline): Use decl_function_context, not hack_decl_function_context. (process_next_inline): Likewise. (do_identifier): Use CP_DECL_CONTEXT, not DECL_REAL_CONTEXT. * method.c (set_mangled_name_for_decl): Use DECL_CONTEXT, not DECL_CLASSS_CONTEXT. (hack_identifier): Likewise. (synthesize_method): Use decl_function_context, not hack_decl_function_context. * pt.c (template_class_depth_real): Use CP_DECL_CONTEXT, not DECL_REAL_CONTEXT. (is_member_template): Use decl_function_context, not hack_decl_function_context. Use DECL_CONTEXT, not DECL_CLASS_CONTEXT. (build_template_decl): Set DECL_VIRTUAL_CONTEXT, not DECL_CLASS_CONTEXT. (check_default_tmpl_args): Use CP_DECL_CONTEXT, not DECL_REAL_CONTEXT. (push_template_decl_real): Likewise. (instantiate_class_template): Don't call add_friends. (tsubst_default_argument): Use DECL_CONTEXT, not DECL_REAL_CONTEXT. (tsubst_decl): Set DECL_VIRTUAL_CONTEXT, not DECL_CLASS_CONTEXT. Use DECL_CONTEXT, not DECL_CLASS_CONTEXT. (set_meangled_name_for_template_decl): Use DECL_CONTEXT, not DECL_CLASS_CONTEXT. * repo.c (repo_inline_used): Likewise. * search.c (current_scope): Adjust for new _CONTEXT macros. (context_for_name_lookup): Use CP_DECL_CONTEXT, not DECL_REAL_CONTEXT. (friend_accessible_p): Use DECL_CONTEXT, not DECL_CLASS_CONTEXT. (lookup_fnfields_here):Likewise. (check_final_overrider): Likewise. (init_vbase_pointers): Likewise. (virtual_context): Likewise. * semantics.c (finish_member_declaration): Just set DECL_CONTEXT. (expand_body): Use decl_function_context, not hack_decl_function_context. * tree.c (hack_decl_function_context): Remove. * typeck.c (build_x_function_call): Use DECL_CONTEXT, not DECL_CLASS_CONTEXT. * typeck2.c (error_not_base_type): Likewise. From-SVN: r32018
2000-02-17 00:54:23 +01:00
DECL_CONTEXT (decl) = current_class_type;
cp-tree.def (PTRMEM_CST): New tree node. * cp-tree.def (PTRMEM_CST): New tree node. * cp-tree.h (ptrmem_cst): New type. (lang_type): Remove local_typedecls. (dummy): Increase to 12 bits from 11. (CLASSTYPE_LOCAL_TYPEDECLS): Remove. (PTRMEM_CST_CLASS): New macro. (PTRMEM_CST_MEMBER): Likewise. (current_access_specifier): New variable. (current_class_type): Remove duplicate declaration. (finish_struct): Change prototype. (unreverse_member_declarations): New function. (pushdecl_class_level): Change prototype. (grok_enum_decls): Remove. (fixup_anonymous_union): New function. (grok_x_components): Change prototype. (tsubst_chain): Remove. (finish_member_template_decl): Likewise. (check_explicit_specialization): Fix indentation. (finish_class_definition): Change prototype. (finish_member_class_template): Likewise. (finish_member_declaration): New function. (check_multiple_declarators): Likewise. * class.c (class_stack_node_t): New type. (current_class_base): Remove. (current_class_stack): Change type. (current_access_specifier): New variable. (grow_method): Remove. (check_member_decl_is_same_in_complete_scope): Break out from finish_struct. (make_method_vec): New function. (free_method_vec): Likewise. (add_implicitly_declared_members): Break out from finish_struct_1. (free_method_vecs): New variable. (add_method): Rework for direct use from parser. (handle_using_decl): Watch for NULL_TREE while iterating through CLASSTYPE_METHOD_VEC. (finish_struct_methods): Don't build CLASSTYPE_METHOD_VEC here; just do some error-checking. (warn_hidden): Change iteration through CLASSTYPE_METHOD_VEC. (finish_struct_1): Simplify. Use add_implicitly_declared_members. (finish_struct): Change prototype. Simplify; fields and methods are already set up at this point. (init_class_processing): Set up current_class_stack. (pushclass): Save current_access_specifier. (popclass): Restore it. (currently_open_class): Simplify. (build_self_reference): Remove use of CLASSTYPE_LOCAL_TYPEDECLS. * decl.c (saved_scope): Add access_specifier. (maybe_push_to_top_level): Save it. (pop_from_top_level): Restore it. (maybe_process_template_type_declaration): Use finish_member_declaration. (pushtag): Likewise. (pushdecl_class_level): Don't return a value. (fixup_anonymous_union): Break out from grok_x_components. (shadow_tag): Use it. (xref_tag): Complain about using an elaborated type specifier to reference a template type parameter or typedef name. (xref_basetypes): Don't set CLASSTYPE_LOCAL_TYPEDECLS. (current_local_enum): Remove. (build_enumerator): Call finish_member_declaration. (grok_enum_decls): Remove. * decl2.c (grok_x_components): Simplify. (check_classfn): Change iteration through CLASSTYPE_METHOD_VEC. (grokfield): Don't set CLASSTYPE_LOCAL_TYPEDECLS. (merge_functions): Add to comment. (arg_assoc_type): Prototype. (arg_assoc): Pass as many arguments as there are parameters. * error.c (dump_expr): Handle PTRMEM_CST. Improve handling of OFFSET_REF. * expr.c (cpls_expand_expr): Remove dead code. Handle PTRMEM_CST. * friend.c (do_friend): Lookup friends when in nested classes. Change comments. * init.c (build_offset_ref): Do lookup even for classes that are only partially defined. (decl_constant_value): Remove dead code. * method.c (build_overload_value): Remove hack where by TYPE was not a TYPE. Handle PTRMEM_CST. (build_template_parm_names): Don't pass a PARM_DECL where a TYPE should go. * parse.y (components, notype_components, component_decl, component_decl_1, component_declarator, component_declarator0): Now all are itype rather than ttype. Rework to add members to classes on the fly. (typesqpecqual_reserved): Use check_multiple_declarators. (structsp): Update class to finish_class_definition. (do_xref_defn): Unsplit into named_class_head. (access_specifier): Set current_access_specifier. * pt.c (set_current_access_from_decl): New function. (finish_member_template_decl): Don't take the parameters. (comp_template_args): Make more robust. (lookup_template_class): Don't use current_local_enum. (for_each_template_parm): Handle PTRMEM_CST. (instantiate_class_template): Use set_current_access_from_decl, finish_member_declaration and unreverse_member_declarations. Set lineno/input_filename before generating implicit member functions. (type_unification_real): Don't assume back-unification happens only for the last argument. (regenerate_decl_from_template): Call pushclass a bit earlier. (tsubst_chain): Remove. (tsubst_enum): Use set_current_access_from_decl. (set_mangled_name_for_template_decl): Fix indentation. * search.c (lookup_fnfields_1): Change iteration through CLASSTYPE_METHOD_VEC. (dfs_pushdecls): Likewise. (dfs_compress_decls): Likewise. (add_conversions): Likewise. * semantics.c (finish_class_definition): Don't take components. Change call to finish_struct. (finish_member_declaration): New function. (finish_member_class_template): Don't take template parameters. Change call to grok_x_components. Call finish_member_template_decl. (check_multiple_declarators): New function. * sig.c (append_signature_fields): Work from the TYPE_METHODS, not a passed in fieldlist. * tree.c (search_tree): Handle PTRMEM_CST. (mapcar): Likewise. * typeck.c (unary_complex_lvalue): Build PTRMEM_CSTs, not INTEGER_CSTs, for pointer-to-data members. From-SVN: r22869
1998-10-06 16:20:30 +02:00
/* [dcl.link]
A C language linkage is ignored for the names of class members
and the member function type of class member functions. */
if (DECL_LANG_SPECIFIC (decl) && DECL_LANGUAGE (decl) == lang_c)
SET_DECL_LANGUAGE (decl, lang_cplusplus);
cp-tree.def (PTRMEM_CST): New tree node. * cp-tree.def (PTRMEM_CST): New tree node. * cp-tree.h (ptrmem_cst): New type. (lang_type): Remove local_typedecls. (dummy): Increase to 12 bits from 11. (CLASSTYPE_LOCAL_TYPEDECLS): Remove. (PTRMEM_CST_CLASS): New macro. (PTRMEM_CST_MEMBER): Likewise. (current_access_specifier): New variable. (current_class_type): Remove duplicate declaration. (finish_struct): Change prototype. (unreverse_member_declarations): New function. (pushdecl_class_level): Change prototype. (grok_enum_decls): Remove. (fixup_anonymous_union): New function. (grok_x_components): Change prototype. (tsubst_chain): Remove. (finish_member_template_decl): Likewise. (check_explicit_specialization): Fix indentation. (finish_class_definition): Change prototype. (finish_member_class_template): Likewise. (finish_member_declaration): New function. (check_multiple_declarators): Likewise. * class.c (class_stack_node_t): New type. (current_class_base): Remove. (current_class_stack): Change type. (current_access_specifier): New variable. (grow_method): Remove. (check_member_decl_is_same_in_complete_scope): Break out from finish_struct. (make_method_vec): New function. (free_method_vec): Likewise. (add_implicitly_declared_members): Break out from finish_struct_1. (free_method_vecs): New variable. (add_method): Rework for direct use from parser. (handle_using_decl): Watch for NULL_TREE while iterating through CLASSTYPE_METHOD_VEC. (finish_struct_methods): Don't build CLASSTYPE_METHOD_VEC here; just do some error-checking. (warn_hidden): Change iteration through CLASSTYPE_METHOD_VEC. (finish_struct_1): Simplify. Use add_implicitly_declared_members. (finish_struct): Change prototype. Simplify; fields and methods are already set up at this point. (init_class_processing): Set up current_class_stack. (pushclass): Save current_access_specifier. (popclass): Restore it. (currently_open_class): Simplify. (build_self_reference): Remove use of CLASSTYPE_LOCAL_TYPEDECLS. * decl.c (saved_scope): Add access_specifier. (maybe_push_to_top_level): Save it. (pop_from_top_level): Restore it. (maybe_process_template_type_declaration): Use finish_member_declaration. (pushtag): Likewise. (pushdecl_class_level): Don't return a value. (fixup_anonymous_union): Break out from grok_x_components. (shadow_tag): Use it. (xref_tag): Complain about using an elaborated type specifier to reference a template type parameter or typedef name. (xref_basetypes): Don't set CLASSTYPE_LOCAL_TYPEDECLS. (current_local_enum): Remove. (build_enumerator): Call finish_member_declaration. (grok_enum_decls): Remove. * decl2.c (grok_x_components): Simplify. (check_classfn): Change iteration through CLASSTYPE_METHOD_VEC. (grokfield): Don't set CLASSTYPE_LOCAL_TYPEDECLS. (merge_functions): Add to comment. (arg_assoc_type): Prototype. (arg_assoc): Pass as many arguments as there are parameters. * error.c (dump_expr): Handle PTRMEM_CST. Improve handling of OFFSET_REF. * expr.c (cpls_expand_expr): Remove dead code. Handle PTRMEM_CST. * friend.c (do_friend): Lookup friends when in nested classes. Change comments. * init.c (build_offset_ref): Do lookup even for classes that are only partially defined. (decl_constant_value): Remove dead code. * method.c (build_overload_value): Remove hack where by TYPE was not a TYPE. Handle PTRMEM_CST. (build_template_parm_names): Don't pass a PARM_DECL where a TYPE should go. * parse.y (components, notype_components, component_decl, component_decl_1, component_declarator, component_declarator0): Now all are itype rather than ttype. Rework to add members to classes on the fly. (typesqpecqual_reserved): Use check_multiple_declarators. (structsp): Update class to finish_class_definition. (do_xref_defn): Unsplit into named_class_head. (access_specifier): Set current_access_specifier. * pt.c (set_current_access_from_decl): New function. (finish_member_template_decl): Don't take the parameters. (comp_template_args): Make more robust. (lookup_template_class): Don't use current_local_enum. (for_each_template_parm): Handle PTRMEM_CST. (instantiate_class_template): Use set_current_access_from_decl, finish_member_declaration and unreverse_member_declarations. Set lineno/input_filename before generating implicit member functions. (type_unification_real): Don't assume back-unification happens only for the last argument. (regenerate_decl_from_template): Call pushclass a bit earlier. (tsubst_chain): Remove. (tsubst_enum): Use set_current_access_from_decl. (set_mangled_name_for_template_decl): Fix indentation. * search.c (lookup_fnfields_1): Change iteration through CLASSTYPE_METHOD_VEC. (dfs_pushdecls): Likewise. (dfs_compress_decls): Likewise. (add_conversions): Likewise. * semantics.c (finish_class_definition): Don't take components. Change call to finish_struct. (finish_member_declaration): New function. (finish_member_class_template): Don't take template parameters. Change call to grok_x_components. Call finish_member_template_decl. (check_multiple_declarators): New function. * sig.c (append_signature_fields): Work from the TYPE_METHODS, not a passed in fieldlist. * tree.c (search_tree): Handle PTRMEM_CST. (mapcar): Likewise. * typeck.c (unary_complex_lvalue): Build PTRMEM_CSTs, not INTEGER_CSTs, for pointer-to-data members. From-SVN: r22869
1998-10-06 16:20:30 +02:00
/* Put functions on the TYPE_METHODS list and everything else on the
TYPE_FIELDS list. Note that these are built up in reverse order.
We reverse them (to obtain declaration order) in finish_struct. */
if (TREE_CODE (decl) == FUNCTION_DECL
|| DECL_FUNCTION_TEMPLATE_P (decl))
{
/* We also need to add this function to the
CLASSTYPE_METHOD_VEC. */
add_method (current_class_type, decl, /*error_p=*/0);
cp-tree.def (PTRMEM_CST): New tree node. * cp-tree.def (PTRMEM_CST): New tree node. * cp-tree.h (ptrmem_cst): New type. (lang_type): Remove local_typedecls. (dummy): Increase to 12 bits from 11. (CLASSTYPE_LOCAL_TYPEDECLS): Remove. (PTRMEM_CST_CLASS): New macro. (PTRMEM_CST_MEMBER): Likewise. (current_access_specifier): New variable. (current_class_type): Remove duplicate declaration. (finish_struct): Change prototype. (unreverse_member_declarations): New function. (pushdecl_class_level): Change prototype. (grok_enum_decls): Remove. (fixup_anonymous_union): New function. (grok_x_components): Change prototype. (tsubst_chain): Remove. (finish_member_template_decl): Likewise. (check_explicit_specialization): Fix indentation. (finish_class_definition): Change prototype. (finish_member_class_template): Likewise. (finish_member_declaration): New function. (check_multiple_declarators): Likewise. * class.c (class_stack_node_t): New type. (current_class_base): Remove. (current_class_stack): Change type. (current_access_specifier): New variable. (grow_method): Remove. (check_member_decl_is_same_in_complete_scope): Break out from finish_struct. (make_method_vec): New function. (free_method_vec): Likewise. (add_implicitly_declared_members): Break out from finish_struct_1. (free_method_vecs): New variable. (add_method): Rework for direct use from parser. (handle_using_decl): Watch for NULL_TREE while iterating through CLASSTYPE_METHOD_VEC. (finish_struct_methods): Don't build CLASSTYPE_METHOD_VEC here; just do some error-checking. (warn_hidden): Change iteration through CLASSTYPE_METHOD_VEC. (finish_struct_1): Simplify. Use add_implicitly_declared_members. (finish_struct): Change prototype. Simplify; fields and methods are already set up at this point. (init_class_processing): Set up current_class_stack. (pushclass): Save current_access_specifier. (popclass): Restore it. (currently_open_class): Simplify. (build_self_reference): Remove use of CLASSTYPE_LOCAL_TYPEDECLS. * decl.c (saved_scope): Add access_specifier. (maybe_push_to_top_level): Save it. (pop_from_top_level): Restore it. (maybe_process_template_type_declaration): Use finish_member_declaration. (pushtag): Likewise. (pushdecl_class_level): Don't return a value. (fixup_anonymous_union): Break out from grok_x_components. (shadow_tag): Use it. (xref_tag): Complain about using an elaborated type specifier to reference a template type parameter or typedef name. (xref_basetypes): Don't set CLASSTYPE_LOCAL_TYPEDECLS. (current_local_enum): Remove. (build_enumerator): Call finish_member_declaration. (grok_enum_decls): Remove. * decl2.c (grok_x_components): Simplify. (check_classfn): Change iteration through CLASSTYPE_METHOD_VEC. (grokfield): Don't set CLASSTYPE_LOCAL_TYPEDECLS. (merge_functions): Add to comment. (arg_assoc_type): Prototype. (arg_assoc): Pass as many arguments as there are parameters. * error.c (dump_expr): Handle PTRMEM_CST. Improve handling of OFFSET_REF. * expr.c (cpls_expand_expr): Remove dead code. Handle PTRMEM_CST. * friend.c (do_friend): Lookup friends when in nested classes. Change comments. * init.c (build_offset_ref): Do lookup even for classes that are only partially defined. (decl_constant_value): Remove dead code. * method.c (build_overload_value): Remove hack where by TYPE was not a TYPE. Handle PTRMEM_CST. (build_template_parm_names): Don't pass a PARM_DECL where a TYPE should go. * parse.y (components, notype_components, component_decl, component_decl_1, component_declarator, component_declarator0): Now all are itype rather than ttype. Rework to add members to classes on the fly. (typesqpecqual_reserved): Use check_multiple_declarators. (structsp): Update class to finish_class_definition. (do_xref_defn): Unsplit into named_class_head. (access_specifier): Set current_access_specifier. * pt.c (set_current_access_from_decl): New function. (finish_member_template_decl): Don't take the parameters. (comp_template_args): Make more robust. (lookup_template_class): Don't use current_local_enum. (for_each_template_parm): Handle PTRMEM_CST. (instantiate_class_template): Use set_current_access_from_decl, finish_member_declaration and unreverse_member_declarations. Set lineno/input_filename before generating implicit member functions. (type_unification_real): Don't assume back-unification happens only for the last argument. (regenerate_decl_from_template): Call pushclass a bit earlier. (tsubst_chain): Remove. (tsubst_enum): Use set_current_access_from_decl. (set_mangled_name_for_template_decl): Fix indentation. * search.c (lookup_fnfields_1): Change iteration through CLASSTYPE_METHOD_VEC. (dfs_pushdecls): Likewise. (dfs_compress_decls): Likewise. (add_conversions): Likewise. * semantics.c (finish_class_definition): Don't take components. Change call to finish_struct. (finish_member_declaration): New function. (finish_member_class_template): Don't take template parameters. Change call to grok_x_components. Call finish_member_template_decl. (check_multiple_declarators): New function. * sig.c (append_signature_fields): Work from the TYPE_METHODS, not a passed in fieldlist. * tree.c (search_tree): Handle PTRMEM_CST. (mapcar): Likewise. * typeck.c (unary_complex_lvalue): Build PTRMEM_CSTs, not INTEGER_CSTs, for pointer-to-data members. From-SVN: r22869
1998-10-06 16:20:30 +02:00
TREE_CHAIN (decl) = TYPE_METHODS (current_class_type);
TYPE_METHODS (current_class_type) = decl;
maybe_add_class_template_decl_list (current_class_type, decl,
/*friend_p=*/0);
cp-tree.def (PTRMEM_CST): New tree node. * cp-tree.def (PTRMEM_CST): New tree node. * cp-tree.h (ptrmem_cst): New type. (lang_type): Remove local_typedecls. (dummy): Increase to 12 bits from 11. (CLASSTYPE_LOCAL_TYPEDECLS): Remove. (PTRMEM_CST_CLASS): New macro. (PTRMEM_CST_MEMBER): Likewise. (current_access_specifier): New variable. (current_class_type): Remove duplicate declaration. (finish_struct): Change prototype. (unreverse_member_declarations): New function. (pushdecl_class_level): Change prototype. (grok_enum_decls): Remove. (fixup_anonymous_union): New function. (grok_x_components): Change prototype. (tsubst_chain): Remove. (finish_member_template_decl): Likewise. (check_explicit_specialization): Fix indentation. (finish_class_definition): Change prototype. (finish_member_class_template): Likewise. (finish_member_declaration): New function. (check_multiple_declarators): Likewise. * class.c (class_stack_node_t): New type. (current_class_base): Remove. (current_class_stack): Change type. (current_access_specifier): New variable. (grow_method): Remove. (check_member_decl_is_same_in_complete_scope): Break out from finish_struct. (make_method_vec): New function. (free_method_vec): Likewise. (add_implicitly_declared_members): Break out from finish_struct_1. (free_method_vecs): New variable. (add_method): Rework for direct use from parser. (handle_using_decl): Watch for NULL_TREE while iterating through CLASSTYPE_METHOD_VEC. (finish_struct_methods): Don't build CLASSTYPE_METHOD_VEC here; just do some error-checking. (warn_hidden): Change iteration through CLASSTYPE_METHOD_VEC. (finish_struct_1): Simplify. Use add_implicitly_declared_members. (finish_struct): Change prototype. Simplify; fields and methods are already set up at this point. (init_class_processing): Set up current_class_stack. (pushclass): Save current_access_specifier. (popclass): Restore it. (currently_open_class): Simplify. (build_self_reference): Remove use of CLASSTYPE_LOCAL_TYPEDECLS. * decl.c (saved_scope): Add access_specifier. (maybe_push_to_top_level): Save it. (pop_from_top_level): Restore it. (maybe_process_template_type_declaration): Use finish_member_declaration. (pushtag): Likewise. (pushdecl_class_level): Don't return a value. (fixup_anonymous_union): Break out from grok_x_components. (shadow_tag): Use it. (xref_tag): Complain about using an elaborated type specifier to reference a template type parameter or typedef name. (xref_basetypes): Don't set CLASSTYPE_LOCAL_TYPEDECLS. (current_local_enum): Remove. (build_enumerator): Call finish_member_declaration. (grok_enum_decls): Remove. * decl2.c (grok_x_components): Simplify. (check_classfn): Change iteration through CLASSTYPE_METHOD_VEC. (grokfield): Don't set CLASSTYPE_LOCAL_TYPEDECLS. (merge_functions): Add to comment. (arg_assoc_type): Prototype. (arg_assoc): Pass as many arguments as there are parameters. * error.c (dump_expr): Handle PTRMEM_CST. Improve handling of OFFSET_REF. * expr.c (cpls_expand_expr): Remove dead code. Handle PTRMEM_CST. * friend.c (do_friend): Lookup friends when in nested classes. Change comments. * init.c (build_offset_ref): Do lookup even for classes that are only partially defined. (decl_constant_value): Remove dead code. * method.c (build_overload_value): Remove hack where by TYPE was not a TYPE. Handle PTRMEM_CST. (build_template_parm_names): Don't pass a PARM_DECL where a TYPE should go. * parse.y (components, notype_components, component_decl, component_decl_1, component_declarator, component_declarator0): Now all are itype rather than ttype. Rework to add members to classes on the fly. (typesqpecqual_reserved): Use check_multiple_declarators. (structsp): Update class to finish_class_definition. (do_xref_defn): Unsplit into named_class_head. (access_specifier): Set current_access_specifier. * pt.c (set_current_access_from_decl): New function. (finish_member_template_decl): Don't take the parameters. (comp_template_args): Make more robust. (lookup_template_class): Don't use current_local_enum. (for_each_template_parm): Handle PTRMEM_CST. (instantiate_class_template): Use set_current_access_from_decl, finish_member_declaration and unreverse_member_declarations. Set lineno/input_filename before generating implicit member functions. (type_unification_real): Don't assume back-unification happens only for the last argument. (regenerate_decl_from_template): Call pushclass a bit earlier. (tsubst_chain): Remove. (tsubst_enum): Use set_current_access_from_decl. (set_mangled_name_for_template_decl): Fix indentation. * search.c (lookup_fnfields_1): Change iteration through CLASSTYPE_METHOD_VEC. (dfs_pushdecls): Likewise. (dfs_compress_decls): Likewise. (add_conversions): Likewise. * semantics.c (finish_class_definition): Don't take components. Change call to finish_struct. (finish_member_declaration): New function. (finish_member_class_template): Don't take template parameters. Change call to grok_x_components. Call finish_member_template_decl. (check_multiple_declarators): New function. * sig.c (append_signature_fields): Work from the TYPE_METHODS, not a passed in fieldlist. * tree.c (search_tree): Handle PTRMEM_CST. (mapcar): Likewise. * typeck.c (unary_complex_lvalue): Build PTRMEM_CSTs, not INTEGER_CSTs, for pointer-to-data members. From-SVN: r22869
1998-10-06 16:20:30 +02:00
}
/* Enter the DECL into the scope of the class. */
else if ((TREE_CODE (decl) == USING_DECL && TREE_TYPE (decl))
|| pushdecl_class_level (decl))
cp-tree.def (PTRMEM_CST): New tree node. * cp-tree.def (PTRMEM_CST): New tree node. * cp-tree.h (ptrmem_cst): New type. (lang_type): Remove local_typedecls. (dummy): Increase to 12 bits from 11. (CLASSTYPE_LOCAL_TYPEDECLS): Remove. (PTRMEM_CST_CLASS): New macro. (PTRMEM_CST_MEMBER): Likewise. (current_access_specifier): New variable. (current_class_type): Remove duplicate declaration. (finish_struct): Change prototype. (unreverse_member_declarations): New function. (pushdecl_class_level): Change prototype. (grok_enum_decls): Remove. (fixup_anonymous_union): New function. (grok_x_components): Change prototype. (tsubst_chain): Remove. (finish_member_template_decl): Likewise. (check_explicit_specialization): Fix indentation. (finish_class_definition): Change prototype. (finish_member_class_template): Likewise. (finish_member_declaration): New function. (check_multiple_declarators): Likewise. * class.c (class_stack_node_t): New type. (current_class_base): Remove. (current_class_stack): Change type. (current_access_specifier): New variable. (grow_method): Remove. (check_member_decl_is_same_in_complete_scope): Break out from finish_struct. (make_method_vec): New function. (free_method_vec): Likewise. (add_implicitly_declared_members): Break out from finish_struct_1. (free_method_vecs): New variable. (add_method): Rework for direct use from parser. (handle_using_decl): Watch for NULL_TREE while iterating through CLASSTYPE_METHOD_VEC. (finish_struct_methods): Don't build CLASSTYPE_METHOD_VEC here; just do some error-checking. (warn_hidden): Change iteration through CLASSTYPE_METHOD_VEC. (finish_struct_1): Simplify. Use add_implicitly_declared_members. (finish_struct): Change prototype. Simplify; fields and methods are already set up at this point. (init_class_processing): Set up current_class_stack. (pushclass): Save current_access_specifier. (popclass): Restore it. (currently_open_class): Simplify. (build_self_reference): Remove use of CLASSTYPE_LOCAL_TYPEDECLS. * decl.c (saved_scope): Add access_specifier. (maybe_push_to_top_level): Save it. (pop_from_top_level): Restore it. (maybe_process_template_type_declaration): Use finish_member_declaration. (pushtag): Likewise. (pushdecl_class_level): Don't return a value. (fixup_anonymous_union): Break out from grok_x_components. (shadow_tag): Use it. (xref_tag): Complain about using an elaborated type specifier to reference a template type parameter or typedef name. (xref_basetypes): Don't set CLASSTYPE_LOCAL_TYPEDECLS. (current_local_enum): Remove. (build_enumerator): Call finish_member_declaration. (grok_enum_decls): Remove. * decl2.c (grok_x_components): Simplify. (check_classfn): Change iteration through CLASSTYPE_METHOD_VEC. (grokfield): Don't set CLASSTYPE_LOCAL_TYPEDECLS. (merge_functions): Add to comment. (arg_assoc_type): Prototype. (arg_assoc): Pass as many arguments as there are parameters. * error.c (dump_expr): Handle PTRMEM_CST. Improve handling of OFFSET_REF. * expr.c (cpls_expand_expr): Remove dead code. Handle PTRMEM_CST. * friend.c (do_friend): Lookup friends when in nested classes. Change comments. * init.c (build_offset_ref): Do lookup even for classes that are only partially defined. (decl_constant_value): Remove dead code. * method.c (build_overload_value): Remove hack where by TYPE was not a TYPE. Handle PTRMEM_CST. (build_template_parm_names): Don't pass a PARM_DECL where a TYPE should go. * parse.y (components, notype_components, component_decl, component_decl_1, component_declarator, component_declarator0): Now all are itype rather than ttype. Rework to add members to classes on the fly. (typesqpecqual_reserved): Use check_multiple_declarators. (structsp): Update class to finish_class_definition. (do_xref_defn): Unsplit into named_class_head. (access_specifier): Set current_access_specifier. * pt.c (set_current_access_from_decl): New function. (finish_member_template_decl): Don't take the parameters. (comp_template_args): Make more robust. (lookup_template_class): Don't use current_local_enum. (for_each_template_parm): Handle PTRMEM_CST. (instantiate_class_template): Use set_current_access_from_decl, finish_member_declaration and unreverse_member_declarations. Set lineno/input_filename before generating implicit member functions. (type_unification_real): Don't assume back-unification happens only for the last argument. (regenerate_decl_from_template): Call pushclass a bit earlier. (tsubst_chain): Remove. (tsubst_enum): Use set_current_access_from_decl. (set_mangled_name_for_template_decl): Fix indentation. * search.c (lookup_fnfields_1): Change iteration through CLASSTYPE_METHOD_VEC. (dfs_pushdecls): Likewise. (dfs_compress_decls): Likewise. (add_conversions): Likewise. * semantics.c (finish_class_definition): Don't take components. Change call to finish_struct. (finish_member_declaration): New function. (finish_member_class_template): Don't take template parameters. Change call to grok_x_components. Call finish_member_template_decl. (check_multiple_declarators): New function. * sig.c (append_signature_fields): Work from the TYPE_METHODS, not a passed in fieldlist. * tree.c (search_tree): Handle PTRMEM_CST. (mapcar): Likewise. * typeck.c (unary_complex_lvalue): Build PTRMEM_CSTs, not INTEGER_CSTs, for pointer-to-data members. From-SVN: r22869
1998-10-06 16:20:30 +02:00
{
/* All TYPE_DECLs go at the end of TYPE_FIELDS. Ordinary fields
go at the beginning. The reason is that lookup_field_1
searches the list in order, and we want a field name to
override a type name so that the "struct stat hack" will
work. In particular:
struct S { enum E { }; int E } s;
s.E = 3;
is valid. In addition, the FIELD_DECLs must be maintained in
cp-tree.def (PTRMEM_CST): New tree node. * cp-tree.def (PTRMEM_CST): New tree node. * cp-tree.h (ptrmem_cst): New type. (lang_type): Remove local_typedecls. (dummy): Increase to 12 bits from 11. (CLASSTYPE_LOCAL_TYPEDECLS): Remove. (PTRMEM_CST_CLASS): New macro. (PTRMEM_CST_MEMBER): Likewise. (current_access_specifier): New variable. (current_class_type): Remove duplicate declaration. (finish_struct): Change prototype. (unreverse_member_declarations): New function. (pushdecl_class_level): Change prototype. (grok_enum_decls): Remove. (fixup_anonymous_union): New function. (grok_x_components): Change prototype. (tsubst_chain): Remove. (finish_member_template_decl): Likewise. (check_explicit_specialization): Fix indentation. (finish_class_definition): Change prototype. (finish_member_class_template): Likewise. (finish_member_declaration): New function. (check_multiple_declarators): Likewise. * class.c (class_stack_node_t): New type. (current_class_base): Remove. (current_class_stack): Change type. (current_access_specifier): New variable. (grow_method): Remove. (check_member_decl_is_same_in_complete_scope): Break out from finish_struct. (make_method_vec): New function. (free_method_vec): Likewise. (add_implicitly_declared_members): Break out from finish_struct_1. (free_method_vecs): New variable. (add_method): Rework for direct use from parser. (handle_using_decl): Watch for NULL_TREE while iterating through CLASSTYPE_METHOD_VEC. (finish_struct_methods): Don't build CLASSTYPE_METHOD_VEC here; just do some error-checking. (warn_hidden): Change iteration through CLASSTYPE_METHOD_VEC. (finish_struct_1): Simplify. Use add_implicitly_declared_members. (finish_struct): Change prototype. Simplify; fields and methods are already set up at this point. (init_class_processing): Set up current_class_stack. (pushclass): Save current_access_specifier. (popclass): Restore it. (currently_open_class): Simplify. (build_self_reference): Remove use of CLASSTYPE_LOCAL_TYPEDECLS. * decl.c (saved_scope): Add access_specifier. (maybe_push_to_top_level): Save it. (pop_from_top_level): Restore it. (maybe_process_template_type_declaration): Use finish_member_declaration. (pushtag): Likewise. (pushdecl_class_level): Don't return a value. (fixup_anonymous_union): Break out from grok_x_components. (shadow_tag): Use it. (xref_tag): Complain about using an elaborated type specifier to reference a template type parameter or typedef name. (xref_basetypes): Don't set CLASSTYPE_LOCAL_TYPEDECLS. (current_local_enum): Remove. (build_enumerator): Call finish_member_declaration. (grok_enum_decls): Remove. * decl2.c (grok_x_components): Simplify. (check_classfn): Change iteration through CLASSTYPE_METHOD_VEC. (grokfield): Don't set CLASSTYPE_LOCAL_TYPEDECLS. (merge_functions): Add to comment. (arg_assoc_type): Prototype. (arg_assoc): Pass as many arguments as there are parameters. * error.c (dump_expr): Handle PTRMEM_CST. Improve handling of OFFSET_REF. * expr.c (cpls_expand_expr): Remove dead code. Handle PTRMEM_CST. * friend.c (do_friend): Lookup friends when in nested classes. Change comments. * init.c (build_offset_ref): Do lookup even for classes that are only partially defined. (decl_constant_value): Remove dead code. * method.c (build_overload_value): Remove hack where by TYPE was not a TYPE. Handle PTRMEM_CST. (build_template_parm_names): Don't pass a PARM_DECL where a TYPE should go. * parse.y (components, notype_components, component_decl, component_decl_1, component_declarator, component_declarator0): Now all are itype rather than ttype. Rework to add members to classes on the fly. (typesqpecqual_reserved): Use check_multiple_declarators. (structsp): Update class to finish_class_definition. (do_xref_defn): Unsplit into named_class_head. (access_specifier): Set current_access_specifier. * pt.c (set_current_access_from_decl): New function. (finish_member_template_decl): Don't take the parameters. (comp_template_args): Make more robust. (lookup_template_class): Don't use current_local_enum. (for_each_template_parm): Handle PTRMEM_CST. (instantiate_class_template): Use set_current_access_from_decl, finish_member_declaration and unreverse_member_declarations. Set lineno/input_filename before generating implicit member functions. (type_unification_real): Don't assume back-unification happens only for the last argument. (regenerate_decl_from_template): Call pushclass a bit earlier. (tsubst_chain): Remove. (tsubst_enum): Use set_current_access_from_decl. (set_mangled_name_for_template_decl): Fix indentation. * search.c (lookup_fnfields_1): Change iteration through CLASSTYPE_METHOD_VEC. (dfs_pushdecls): Likewise. (dfs_compress_decls): Likewise. (add_conversions): Likewise. * semantics.c (finish_class_definition): Don't take components. Change call to finish_struct. (finish_member_declaration): New function. (finish_member_class_template): Don't take template parameters. Change call to grok_x_components. Call finish_member_template_decl. (check_multiple_declarators): New function. * sig.c (append_signature_fields): Work from the TYPE_METHODS, not a passed in fieldlist. * tree.c (search_tree): Handle PTRMEM_CST. (mapcar): Likewise. * typeck.c (unary_complex_lvalue): Build PTRMEM_CSTs, not INTEGER_CSTs, for pointer-to-data members. From-SVN: r22869
1998-10-06 16:20:30 +02:00
declaration order so that class layout works as expected.
However, we don't need that order until class layout, so we
save a little time by putting FIELD_DECLs on in reverse order
here, and then reversing them in finish_struct_1. (We could
also keep a pointer to the correct insertion points in the
list.) */
if (TREE_CODE (decl) == TYPE_DECL)
TYPE_FIELDS (current_class_type)
= chainon (TYPE_FIELDS (current_class_type), decl);
else
{
TREE_CHAIN (decl) = TYPE_FIELDS (current_class_type);
TYPE_FIELDS (current_class_type) = decl;
}
tinfo.h (__class_type_info): Fix illegal declaration. 1999-04-02 Mark Mitchell <mark@codesourcery.com> * tinfo.h (__class_type_info): Fix illegal declaration. * cp-tree.def (TEMPLATE_ID_EXPR): Update comment. * cp-tree.h (INHERITED_VALUE_BINDING_P): New macro. (IDENTIFIER_CLASS_VALUE): Improve documentation. (is_properly_derived_from): Declare. (invalidate_class_lookup_cache): Likewise. (maybe_maybe_note_name_used_in_class): Likewise. (note_name_declared_in_class): Likewise. (push_using_decl): Remove duplicate declaration. (id_in_current_class): Remove declaration. (push_class_binding): Change prototype. (clear_identitifer_class_values): Declare. * call.c (is_properly_derived_from): Make it global. (build_new_function_call): Be careful about updating candidates. (build_new_method_call): Handle COMPONENT_REFs. Don't crash when asked to make illegal calls. * class.c: Include splay-tree.h. (class_stack_node): Add names_used slot. (check_member_decl_is_same_in_complete_scope): Remove. (add_method): Fix comment. Push the declaration into class scope. (finish_struct_1): When popping the class, pop the bindings too. Remove check for data member/function member conflict. (finish_struct): Remove calls to check_member_decl_is_same_in_complete_scope. Change calls to popclass. (pushclass): Clear names_used in the class stack entry. Use invalidate_class_lookup_cache to remove cached entries, rather than magic values with popclass. Clear IDENTIFIER_CLASS_VALUE before entering a new class. Remove dead code. Don't mess with current_function_decl when pushing declarations. (invalidate_class_lookup_cache): New function, split out from ... (popclass): Here. Clean up names_used on our way out. (instantiate_type): Adjust. (build_self_reference): Don't push the declaration here. (maybe_note_name_used_in_class): New function. (note_name_declared_in_class): Likewise. * decl.c (add_binding): Change prototype. (find_class_binding_level): New function. (innermost_nonclass_level): Likewise. (current_binding_level): Update documentation. (inner_binding_level): Remove. Replace with current_binding_level throughout. (push_binding_level): Remove special handling of class_binding_level. (pop_binding_level): Likewise. Use find_class_binding_level. (suspend_binding_level): Likewise. (global_bindings_p): Use innermost_nonclass_level. (toplevel_bindings_p): Likewise. (namespace_bindings_p): Likewise. (pseudo_global_level_p): Likewise. (push_binding): Clear INHERITED_VALUE_BINDING_P. (add_binding): Check for illegal multiple declarations. Return a value indicating whether or not the new binding was legal. (push_local_binding): Skip over class binding levels. Check return value from add_binding. (push_class_binding): Set INHERITED_VALUE_BINDING_P. Call note_name_declared_in_class. (pushlevel_class): Remove "fake out the rest of the compiler" code. (poplevel_class): Reset IDENTIFIER_CLASS_VALUEs. (clear_identifier_class_values): New function. (pop_from_top_level): Use it. (pop_everything): Tweak. (maybe_process_template_type_declaration): Don't push the declaration for the template here. (pushtag): Don't push tag declarations into class scope here. (pushdecl): Apply DeMorgan's law for readability. (pushdecl_class_level): Remove special-case code for TYPE_BEING_DEFINED. Handle OVERLOADs and anonymous unions. (push_class_level_bindng): Deal with inherited bindings. (lookup_name_real): Remove special-case code for TYPE_BEING_DEFINED, and some implicit typename magic. (grokdeclarator): Handle COMPONENT_REF for a template function. (build_enumerator): Don't call pushdecl_class_level here. (id_in_current_class): Remove. * decl2.c (grokfield): Don't call pushdecl_class_level or check_template_shadow. * errfn.c (cp_file_of): Don't declare. (cp_line_of): Likewise. * error.c (dump_decl): Handle an OVERLOAD. (cp_file_of): Likewise. (cp_line_of): Likewise. * init.c (build_member_call): Handle a COMPONENT_REF. * lex.c (do_identifier): Call maybe_note_name_used_in_class, not pushdecl_class_level. * method.c (hack_identifier): Build COMPONENT_REFs for references to member templates as well as member functions. Remove dead code. * parse.y (left_curly): Remove. (nonnested_type): Call maybe_note_name_used_in_class, not pushdecl_class_level. * parse.c: Regenerated. (nested_name_specifier_1): Likewise. * pt.c (check_explicit_specialization): Adjust, for robustness. (check_template_shadow): Handle OVERLOADs. (build_template_decl): Set DECL_CONSTRUCTOR_P on the TEMPLATE_DECL, if appropriate. * search.c (envelope_add_decl): Remove. (dfs_pushdecls): Likewise. (dfs_compress_decls): Likewise. (dfs_push_decls): New function. (dfs_push_type_decls): Likewise. (setup_class_bindings): Likewise. (template_self_reference_p): Likewise. (lookup_field_r): Use it. (looup_member): Remove old comment. Deal with ambiguity. (push_class_decls): Use dfs_push_decls and dfs_push_type_decls, and remove envelope processing. * semantics.c (begin_class_definition): Let pushclass push declarations for base classes. (finish_member_declaration): Push declarations into class scope. * typeck.c (build_component_ref): Just put an OVERLOAD into the COMPONENT_REF, not a TREE_LIST of an OVERLOAD. (build_x_function_call): Deal with OVERLOAD. Handle template-ids. * Makefile.in (class.o): Depend on splay-tree.h. From-SVN: r26133
1999-04-02 17:36:57 +02:00
maybe_add_class_template_decl_list (current_class_type, decl,
/*friend_p=*/0);
cp-tree.def (PTRMEM_CST): New tree node. * cp-tree.def (PTRMEM_CST): New tree node. * cp-tree.h (ptrmem_cst): New type. (lang_type): Remove local_typedecls. (dummy): Increase to 12 bits from 11. (CLASSTYPE_LOCAL_TYPEDECLS): Remove. (PTRMEM_CST_CLASS): New macro. (PTRMEM_CST_MEMBER): Likewise. (current_access_specifier): New variable. (current_class_type): Remove duplicate declaration. (finish_struct): Change prototype. (unreverse_member_declarations): New function. (pushdecl_class_level): Change prototype. (grok_enum_decls): Remove. (fixup_anonymous_union): New function. (grok_x_components): Change prototype. (tsubst_chain): Remove. (finish_member_template_decl): Likewise. (check_explicit_specialization): Fix indentation. (finish_class_definition): Change prototype. (finish_member_class_template): Likewise. (finish_member_declaration): New function. (check_multiple_declarators): Likewise. * class.c (class_stack_node_t): New type. (current_class_base): Remove. (current_class_stack): Change type. (current_access_specifier): New variable. (grow_method): Remove. (check_member_decl_is_same_in_complete_scope): Break out from finish_struct. (make_method_vec): New function. (free_method_vec): Likewise. (add_implicitly_declared_members): Break out from finish_struct_1. (free_method_vecs): New variable. (add_method): Rework for direct use from parser. (handle_using_decl): Watch for NULL_TREE while iterating through CLASSTYPE_METHOD_VEC. (finish_struct_methods): Don't build CLASSTYPE_METHOD_VEC here; just do some error-checking. (warn_hidden): Change iteration through CLASSTYPE_METHOD_VEC. (finish_struct_1): Simplify. Use add_implicitly_declared_members. (finish_struct): Change prototype. Simplify; fields and methods are already set up at this point. (init_class_processing): Set up current_class_stack. (pushclass): Save current_access_specifier. (popclass): Restore it. (currently_open_class): Simplify. (build_self_reference): Remove use of CLASSTYPE_LOCAL_TYPEDECLS. * decl.c (saved_scope): Add access_specifier. (maybe_push_to_top_level): Save it. (pop_from_top_level): Restore it. (maybe_process_template_type_declaration): Use finish_member_declaration. (pushtag): Likewise. (pushdecl_class_level): Don't return a value. (fixup_anonymous_union): Break out from grok_x_components. (shadow_tag): Use it. (xref_tag): Complain about using an elaborated type specifier to reference a template type parameter or typedef name. (xref_basetypes): Don't set CLASSTYPE_LOCAL_TYPEDECLS. (current_local_enum): Remove. (build_enumerator): Call finish_member_declaration. (grok_enum_decls): Remove. * decl2.c (grok_x_components): Simplify. (check_classfn): Change iteration through CLASSTYPE_METHOD_VEC. (grokfield): Don't set CLASSTYPE_LOCAL_TYPEDECLS. (merge_functions): Add to comment. (arg_assoc_type): Prototype. (arg_assoc): Pass as many arguments as there are parameters. * error.c (dump_expr): Handle PTRMEM_CST. Improve handling of OFFSET_REF. * expr.c (cpls_expand_expr): Remove dead code. Handle PTRMEM_CST. * friend.c (do_friend): Lookup friends when in nested classes. Change comments. * init.c (build_offset_ref): Do lookup even for classes that are only partially defined. (decl_constant_value): Remove dead code. * method.c (build_overload_value): Remove hack where by TYPE was not a TYPE. Handle PTRMEM_CST. (build_template_parm_names): Don't pass a PARM_DECL where a TYPE should go. * parse.y (components, notype_components, component_decl, component_decl_1, component_declarator, component_declarator0): Now all are itype rather than ttype. Rework to add members to classes on the fly. (typesqpecqual_reserved): Use check_multiple_declarators. (structsp): Update class to finish_class_definition. (do_xref_defn): Unsplit into named_class_head. (access_specifier): Set current_access_specifier. * pt.c (set_current_access_from_decl): New function. (finish_member_template_decl): Don't take the parameters. (comp_template_args): Make more robust. (lookup_template_class): Don't use current_local_enum. (for_each_template_parm): Handle PTRMEM_CST. (instantiate_class_template): Use set_current_access_from_decl, finish_member_declaration and unreverse_member_declarations. Set lineno/input_filename before generating implicit member functions. (type_unification_real): Don't assume back-unification happens only for the last argument. (regenerate_decl_from_template): Call pushclass a bit earlier. (tsubst_chain): Remove. (tsubst_enum): Use set_current_access_from_decl. (set_mangled_name_for_template_decl): Fix indentation. * search.c (lookup_fnfields_1): Change iteration through CLASSTYPE_METHOD_VEC. (dfs_pushdecls): Likewise. (dfs_compress_decls): Likewise. (add_conversions): Likewise. * semantics.c (finish_class_definition): Don't take components. Change call to finish_struct. (finish_member_declaration): New function. (finish_member_class_template): Don't take template parameters. Change call to grok_x_components. Call finish_member_template_decl. (check_multiple_declarators): New function. * sig.c (append_signature_fields): Work from the TYPE_METHODS, not a passed in fieldlist. * tree.c (search_tree): Handle PTRMEM_CST. (mapcar): Likewise. * typeck.c (unary_complex_lvalue): Build PTRMEM_CSTs, not INTEGER_CSTs, for pointer-to-data members. From-SVN: r22869
1998-10-06 16:20:30 +02:00
}
}
/* Finish processing the declaration of a member class template
TYPES whose template parameters are given by PARMS. */
tree
finish_member_class_template (tree types)
{
cp-tree.h (TI_USES_TEMPLATE_PARMS): Remove. * cp-tree.h (TI_USES_TEMPLATE_PARMS): Remove. (build_template_decl_overload): Remove. (set_mangled_name_for_decl): New function. (innermost_args): Remove is_spec parameter. (most_specialized, most_specialized_class): Remove declarations. (lookup_template_class): Add entering_scope parameter. (maybe_process_partial_specialization): New function. (finish_template_decl): Likewise. (finish_template_type): Likewise. * class.c (finish_struct): Clean up processing of member template specializations. * decl.c (pushtag): Fix formatting. (lookup_tag): Improve handling of pseudo-global levels. (make_typename_type): Adjust call to lookup_template_class. (shadow_tag): Use maybe_process_partial_specialization. (xref_tag): Improve handling of member friends. (start_function): Call push_nested_class before push_template_decl. Don't call push_template_decl for specializations. * decl2.c (grok_x_components): Don't call xref_tag for template instantiations. Handle UNION_TYPEs like RECORD_TYPEs. (grokclassfn): Use set_mangled_name_for_decl. (arg_assoc_class): Adjust call to innermost_args. (mark_used): Don't call instantiate_decl for a TEMPLATE_DECL. * error.c (dump_function_name): Improve printing of template function names. * friend.c (is_friend): Don't compare types of decls to determine friendship, unless flag_guiding_decls. (make_friend_class): Partial specializations cannot be friends. (do_friend): Use set_mangled_name_for_decl. Call push_template_decl_real instead of push_template_decl. * method.c (build_decl_overload_real): Remove prototype. Give it external linkage. (build_overload_identififer): Adjust call to innermost_args. (build_template_decl_overload): Remove. (set_mangled_name_for_decl): New function. * parse.y (.finish_template_type): New non-terminal. (template_def): Use finish_template_decl. Use template_extdef instead of extdef. (template_extdef, template_datadef): New non-terminals, containing only those rules for things which can be templates. (datadef): Tidy. (template_type, self_template_type): Use .finish_template_type. (named_class_head): Use maybe_process_partial_specialization. * pt.c (mangle_class_name_for_template): Remove context parameter. (get_class_bindings): Remove outer_args parameter. (complete_template_args): Remove. (add_outermost_template_args): New function. (register_specialization): Return the specialization. (unregister_specialization): New function. (tsubst_template_parms): Likewise. (most_specialized, most_specialized_class): Prototype here as static. (original_template): Rename to most_general_template. (tsubst_template_parms): New function. (set_mangled_name_for_template_decl): Likewise. (TMPL_ARGS_DEPTH): New macro. (TMPL_ARGS_HAVE_MULTIPLE_LEVELS): Adjust. (TMPL_ARGS_LEVEL): New macro. (SET_TMPL_ARGS_LEVEL): Likewise. (TMPL_ARG): Likewise. (SET_TMPL_ARG): Likewise. (TMPL_ARGS_DEPTH): Likewise. (finish_member_template_decl): Use finish_template_decl. (maybe_process_partial_specialization): New function, split out from tsubst. (inline_needs_template_parms): Use TMPL_PARMS_DEPTH. (maybe_begin_member_template_processing): Use new macros. (is_member_template): Likewise. (is_member_template_class): Likewise. (add_to_template_args): Likewise. Deal with multiple levels of args. (maybe_process_partial_specialization): New function. (retrieve_specialization): Add consistency check. (determine_specialization): Return full argument list. (check_explicit_specialization): Tweak friend handling. Use full argument lists. Simplify. (current_template_args): Use new macros. (push_template_decl_real): Change ill-named mainargs to specargs. Check that a partial specialization actually specializes at least one parameter. Improve friend handling. Modify for full template arguments. (classtype_mangled_name): Don't mangle the names of specializations. (lookup_template_class): Add entering_scope parameter. Use it to avoid finding a template type when an instantiation is required. Simplify. Use full template arguments. (tsubst_friend_function): Use unregister_specialization. Use new macros. Use full template arguments. (tsubst_friend_class): Substitute, using tsubst_template_parms, into the template parameters before passing them to redeclare_class_template. (instantiate_class_template): Simplify. Use full template arguments. Adjust calls to get_class_bindings. Use SET_IDENTIFIER_TYPE_VALUE where needed. Improve friend handling. (innermost_args): Use new macros. (tsubst_aggr_type): New function, split out from tsubst. (tsubst): Use tsubst_aggr_type, tsubst_template_parms, new calling conventions for lookup_tmeplate_class. Refine handling of partial instantiations. Remove calls to complete_template_args. Simplify. Add consistency checks. Use set_mangled_name_for_decl and set_mangled_name_for_template_decl. (tsubst_copy): Use tsubst_aggr_type. (instantiate_template): Use full template arguments. (more_specialized): Improve formatting. (more_specialized_class): Adjust calls to get_class_bindings. (get_bindings_real): Don't call complete_template_args. (most_specialized): Don't overwrite input; create a new list. (most_specialized_class): Use most_general_template. (regenerate_decl_from_template): Use unregister_specialization. Use full template arguments. (instantiate_decl): Use full template arguments. (set_mangled_name_for_template_decl): New function. * semantics.c (begin_class_definition): Use maybe_process_partial_specialization. (finish_member_class_template): New function. (finish_template_decl): Likewise. (finish_template_type): Likewise. (typeck.c): Don't crash after issuing a compiler_error. * Makefile.in (CONFLICTS): Adjust; we removed a s/r conflict. From-SVN: r21433
1998-07-28 03:03:16 +02:00
tree t;
/* If there are declared, but undefined, partial specializations
mixed in with the typespecs they will not yet have passed through
maybe_process_partial_specialization, so we do that here. */
for (t = types; t != NULL_TREE; t = TREE_CHAIN (t))
if (IS_AGGR_TYPE_CODE (TREE_CODE (TREE_VALUE (t))))
maybe_process_partial_specialization (TREE_VALUE (t));
cp-tree.def (PTRMEM_CST): New tree node. * cp-tree.def (PTRMEM_CST): New tree node. * cp-tree.h (ptrmem_cst): New type. (lang_type): Remove local_typedecls. (dummy): Increase to 12 bits from 11. (CLASSTYPE_LOCAL_TYPEDECLS): Remove. (PTRMEM_CST_CLASS): New macro. (PTRMEM_CST_MEMBER): Likewise. (current_access_specifier): New variable. (current_class_type): Remove duplicate declaration. (finish_struct): Change prototype. (unreverse_member_declarations): New function. (pushdecl_class_level): Change prototype. (grok_enum_decls): Remove. (fixup_anonymous_union): New function. (grok_x_components): Change prototype. (tsubst_chain): Remove. (finish_member_template_decl): Likewise. (check_explicit_specialization): Fix indentation. (finish_class_definition): Change prototype. (finish_member_class_template): Likewise. (finish_member_declaration): New function. (check_multiple_declarators): Likewise. * class.c (class_stack_node_t): New type. (current_class_base): Remove. (current_class_stack): Change type. (current_access_specifier): New variable. (grow_method): Remove. (check_member_decl_is_same_in_complete_scope): Break out from finish_struct. (make_method_vec): New function. (free_method_vec): Likewise. (add_implicitly_declared_members): Break out from finish_struct_1. (free_method_vecs): New variable. (add_method): Rework for direct use from parser. (handle_using_decl): Watch for NULL_TREE while iterating through CLASSTYPE_METHOD_VEC. (finish_struct_methods): Don't build CLASSTYPE_METHOD_VEC here; just do some error-checking. (warn_hidden): Change iteration through CLASSTYPE_METHOD_VEC. (finish_struct_1): Simplify. Use add_implicitly_declared_members. (finish_struct): Change prototype. Simplify; fields and methods are already set up at this point. (init_class_processing): Set up current_class_stack. (pushclass): Save current_access_specifier. (popclass): Restore it. (currently_open_class): Simplify. (build_self_reference): Remove use of CLASSTYPE_LOCAL_TYPEDECLS. * decl.c (saved_scope): Add access_specifier. (maybe_push_to_top_level): Save it. (pop_from_top_level): Restore it. (maybe_process_template_type_declaration): Use finish_member_declaration. (pushtag): Likewise. (pushdecl_class_level): Don't return a value. (fixup_anonymous_union): Break out from grok_x_components. (shadow_tag): Use it. (xref_tag): Complain about using an elaborated type specifier to reference a template type parameter or typedef name. (xref_basetypes): Don't set CLASSTYPE_LOCAL_TYPEDECLS. (current_local_enum): Remove. (build_enumerator): Call finish_member_declaration. (grok_enum_decls): Remove. * decl2.c (grok_x_components): Simplify. (check_classfn): Change iteration through CLASSTYPE_METHOD_VEC. (grokfield): Don't set CLASSTYPE_LOCAL_TYPEDECLS. (merge_functions): Add to comment. (arg_assoc_type): Prototype. (arg_assoc): Pass as many arguments as there are parameters. * error.c (dump_expr): Handle PTRMEM_CST. Improve handling of OFFSET_REF. * expr.c (cpls_expand_expr): Remove dead code. Handle PTRMEM_CST. * friend.c (do_friend): Lookup friends when in nested classes. Change comments. * init.c (build_offset_ref): Do lookup even for classes that are only partially defined. (decl_constant_value): Remove dead code. * method.c (build_overload_value): Remove hack where by TYPE was not a TYPE. Handle PTRMEM_CST. (build_template_parm_names): Don't pass a PARM_DECL where a TYPE should go. * parse.y (components, notype_components, component_decl, component_decl_1, component_declarator, component_declarator0): Now all are itype rather than ttype. Rework to add members to classes on the fly. (typesqpecqual_reserved): Use check_multiple_declarators. (structsp): Update class to finish_class_definition. (do_xref_defn): Unsplit into named_class_head. (access_specifier): Set current_access_specifier. * pt.c (set_current_access_from_decl): New function. (finish_member_template_decl): Don't take the parameters. (comp_template_args): Make more robust. (lookup_template_class): Don't use current_local_enum. (for_each_template_parm): Handle PTRMEM_CST. (instantiate_class_template): Use set_current_access_from_decl, finish_member_declaration and unreverse_member_declarations. Set lineno/input_filename before generating implicit member functions. (type_unification_real): Don't assume back-unification happens only for the last argument. (regenerate_decl_from_template): Call pushclass a bit earlier. (tsubst_chain): Remove. (tsubst_enum): Use set_current_access_from_decl. (set_mangled_name_for_template_decl): Fix indentation. * search.c (lookup_fnfields_1): Change iteration through CLASSTYPE_METHOD_VEC. (dfs_pushdecls): Likewise. (dfs_compress_decls): Likewise. (add_conversions): Likewise. * semantics.c (finish_class_definition): Don't take components. Change call to finish_struct. (finish_member_declaration): New function. (finish_member_class_template): Don't take template parameters. Change call to grok_x_components. Call finish_member_template_decl. (check_multiple_declarators): New function. * sig.c (append_signature_fields): Work from the TYPE_METHODS, not a passed in fieldlist. * tree.c (search_tree): Handle PTRMEM_CST. (mapcar): Likewise. * typeck.c (unary_complex_lvalue): Build PTRMEM_CSTs, not INTEGER_CSTs, for pointer-to-data members. From-SVN: r22869
1998-10-06 16:20:30 +02:00
grok_x_components (types);
if (TYPE_CONTEXT (TREE_VALUE (types)) != current_class_type)
/* The component was in fact a friend declaration. We avoid
finish_member_template_decl performing certain checks by
unsetting TYPES. */
types = NULL_TREE;
cp-tree.def (PTRMEM_CST): New tree node. * cp-tree.def (PTRMEM_CST): New tree node. * cp-tree.h (ptrmem_cst): New type. (lang_type): Remove local_typedecls. (dummy): Increase to 12 bits from 11. (CLASSTYPE_LOCAL_TYPEDECLS): Remove. (PTRMEM_CST_CLASS): New macro. (PTRMEM_CST_MEMBER): Likewise. (current_access_specifier): New variable. (current_class_type): Remove duplicate declaration. (finish_struct): Change prototype. (unreverse_member_declarations): New function. (pushdecl_class_level): Change prototype. (grok_enum_decls): Remove. (fixup_anonymous_union): New function. (grok_x_components): Change prototype. (tsubst_chain): Remove. (finish_member_template_decl): Likewise. (check_explicit_specialization): Fix indentation. (finish_class_definition): Change prototype. (finish_member_class_template): Likewise. (finish_member_declaration): New function. (check_multiple_declarators): Likewise. * class.c (class_stack_node_t): New type. (current_class_base): Remove. (current_class_stack): Change type. (current_access_specifier): New variable. (grow_method): Remove. (check_member_decl_is_same_in_complete_scope): Break out from finish_struct. (make_method_vec): New function. (free_method_vec): Likewise. (add_implicitly_declared_members): Break out from finish_struct_1. (free_method_vecs): New variable. (add_method): Rework for direct use from parser. (handle_using_decl): Watch for NULL_TREE while iterating through CLASSTYPE_METHOD_VEC. (finish_struct_methods): Don't build CLASSTYPE_METHOD_VEC here; just do some error-checking. (warn_hidden): Change iteration through CLASSTYPE_METHOD_VEC. (finish_struct_1): Simplify. Use add_implicitly_declared_members. (finish_struct): Change prototype. Simplify; fields and methods are already set up at this point. (init_class_processing): Set up current_class_stack. (pushclass): Save current_access_specifier. (popclass): Restore it. (currently_open_class): Simplify. (build_self_reference): Remove use of CLASSTYPE_LOCAL_TYPEDECLS. * decl.c (saved_scope): Add access_specifier. (maybe_push_to_top_level): Save it. (pop_from_top_level): Restore it. (maybe_process_template_type_declaration): Use finish_member_declaration. (pushtag): Likewise. (pushdecl_class_level): Don't return a value. (fixup_anonymous_union): Break out from grok_x_components. (shadow_tag): Use it. (xref_tag): Complain about using an elaborated type specifier to reference a template type parameter or typedef name. (xref_basetypes): Don't set CLASSTYPE_LOCAL_TYPEDECLS. (current_local_enum): Remove. (build_enumerator): Call finish_member_declaration. (grok_enum_decls): Remove. * decl2.c (grok_x_components): Simplify. (check_classfn): Change iteration through CLASSTYPE_METHOD_VEC. (grokfield): Don't set CLASSTYPE_LOCAL_TYPEDECLS. (merge_functions): Add to comment. (arg_assoc_type): Prototype. (arg_assoc): Pass as many arguments as there are parameters. * error.c (dump_expr): Handle PTRMEM_CST. Improve handling of OFFSET_REF. * expr.c (cpls_expand_expr): Remove dead code. Handle PTRMEM_CST. * friend.c (do_friend): Lookup friends when in nested classes. Change comments. * init.c (build_offset_ref): Do lookup even for classes that are only partially defined. (decl_constant_value): Remove dead code. * method.c (build_overload_value): Remove hack where by TYPE was not a TYPE. Handle PTRMEM_CST. (build_template_parm_names): Don't pass a PARM_DECL where a TYPE should go. * parse.y (components, notype_components, component_decl, component_decl_1, component_declarator, component_declarator0): Now all are itype rather than ttype. Rework to add members to classes on the fly. (typesqpecqual_reserved): Use check_multiple_declarators. (structsp): Update class to finish_class_definition. (do_xref_defn): Unsplit into named_class_head. (access_specifier): Set current_access_specifier. * pt.c (set_current_access_from_decl): New function. (finish_member_template_decl): Don't take the parameters. (comp_template_args): Make more robust. (lookup_template_class): Don't use current_local_enum. (for_each_template_parm): Handle PTRMEM_CST. (instantiate_class_template): Use set_current_access_from_decl, finish_member_declaration and unreverse_member_declarations. Set lineno/input_filename before generating implicit member functions. (type_unification_real): Don't assume back-unification happens only for the last argument. (regenerate_decl_from_template): Call pushclass a bit earlier. (tsubst_chain): Remove. (tsubst_enum): Use set_current_access_from_decl. (set_mangled_name_for_template_decl): Fix indentation. * search.c (lookup_fnfields_1): Change iteration through CLASSTYPE_METHOD_VEC. (dfs_pushdecls): Likewise. (dfs_compress_decls): Likewise. (add_conversions): Likewise. * semantics.c (finish_class_definition): Don't take components. Change call to finish_struct. (finish_member_declaration): New function. (finish_member_class_template): Don't take template parameters. Change call to grok_x_components. Call finish_member_template_decl. (check_multiple_declarators): New function. * sig.c (append_signature_fields): Work from the TYPE_METHODS, not a passed in fieldlist. * tree.c (search_tree): Handle PTRMEM_CST. (mapcar): Likewise. * typeck.c (unary_complex_lvalue): Build PTRMEM_CSTs, not INTEGER_CSTs, for pointer-to-data members. From-SVN: r22869
1998-10-06 16:20:30 +02:00
finish_member_template_decl (types);
/* As with other component type declarations, we do
not store the new DECL on the list of
component_decls. */
return NULL_TREE;
}
cp-tree.h (TI_USES_TEMPLATE_PARMS): Remove. * cp-tree.h (TI_USES_TEMPLATE_PARMS): Remove. (build_template_decl_overload): Remove. (set_mangled_name_for_decl): New function. (innermost_args): Remove is_spec parameter. (most_specialized, most_specialized_class): Remove declarations. (lookup_template_class): Add entering_scope parameter. (maybe_process_partial_specialization): New function. (finish_template_decl): Likewise. (finish_template_type): Likewise. * class.c (finish_struct): Clean up processing of member template specializations. * decl.c (pushtag): Fix formatting. (lookup_tag): Improve handling of pseudo-global levels. (make_typename_type): Adjust call to lookup_template_class. (shadow_tag): Use maybe_process_partial_specialization. (xref_tag): Improve handling of member friends. (start_function): Call push_nested_class before push_template_decl. Don't call push_template_decl for specializations. * decl2.c (grok_x_components): Don't call xref_tag for template instantiations. Handle UNION_TYPEs like RECORD_TYPEs. (grokclassfn): Use set_mangled_name_for_decl. (arg_assoc_class): Adjust call to innermost_args. (mark_used): Don't call instantiate_decl for a TEMPLATE_DECL. * error.c (dump_function_name): Improve printing of template function names. * friend.c (is_friend): Don't compare types of decls to determine friendship, unless flag_guiding_decls. (make_friend_class): Partial specializations cannot be friends. (do_friend): Use set_mangled_name_for_decl. Call push_template_decl_real instead of push_template_decl. * method.c (build_decl_overload_real): Remove prototype. Give it external linkage. (build_overload_identififer): Adjust call to innermost_args. (build_template_decl_overload): Remove. (set_mangled_name_for_decl): New function. * parse.y (.finish_template_type): New non-terminal. (template_def): Use finish_template_decl. Use template_extdef instead of extdef. (template_extdef, template_datadef): New non-terminals, containing only those rules for things which can be templates. (datadef): Tidy. (template_type, self_template_type): Use .finish_template_type. (named_class_head): Use maybe_process_partial_specialization. * pt.c (mangle_class_name_for_template): Remove context parameter. (get_class_bindings): Remove outer_args parameter. (complete_template_args): Remove. (add_outermost_template_args): New function. (register_specialization): Return the specialization. (unregister_specialization): New function. (tsubst_template_parms): Likewise. (most_specialized, most_specialized_class): Prototype here as static. (original_template): Rename to most_general_template. (tsubst_template_parms): New function. (set_mangled_name_for_template_decl): Likewise. (TMPL_ARGS_DEPTH): New macro. (TMPL_ARGS_HAVE_MULTIPLE_LEVELS): Adjust. (TMPL_ARGS_LEVEL): New macro. (SET_TMPL_ARGS_LEVEL): Likewise. (TMPL_ARG): Likewise. (SET_TMPL_ARG): Likewise. (TMPL_ARGS_DEPTH): Likewise. (finish_member_template_decl): Use finish_template_decl. (maybe_process_partial_specialization): New function, split out from tsubst. (inline_needs_template_parms): Use TMPL_PARMS_DEPTH. (maybe_begin_member_template_processing): Use new macros. (is_member_template): Likewise. (is_member_template_class): Likewise. (add_to_template_args): Likewise. Deal with multiple levels of args. (maybe_process_partial_specialization): New function. (retrieve_specialization): Add consistency check. (determine_specialization): Return full argument list. (check_explicit_specialization): Tweak friend handling. Use full argument lists. Simplify. (current_template_args): Use new macros. (push_template_decl_real): Change ill-named mainargs to specargs. Check that a partial specialization actually specializes at least one parameter. Improve friend handling. Modify for full template arguments. (classtype_mangled_name): Don't mangle the names of specializations. (lookup_template_class): Add entering_scope parameter. Use it to avoid finding a template type when an instantiation is required. Simplify. Use full template arguments. (tsubst_friend_function): Use unregister_specialization. Use new macros. Use full template arguments. (tsubst_friend_class): Substitute, using tsubst_template_parms, into the template parameters before passing them to redeclare_class_template. (instantiate_class_template): Simplify. Use full template arguments. Adjust calls to get_class_bindings. Use SET_IDENTIFIER_TYPE_VALUE where needed. Improve friend handling. (innermost_args): Use new macros. (tsubst_aggr_type): New function, split out from tsubst. (tsubst): Use tsubst_aggr_type, tsubst_template_parms, new calling conventions for lookup_tmeplate_class. Refine handling of partial instantiations. Remove calls to complete_template_args. Simplify. Add consistency checks. Use set_mangled_name_for_decl and set_mangled_name_for_template_decl. (tsubst_copy): Use tsubst_aggr_type. (instantiate_template): Use full template arguments. (more_specialized): Improve formatting. (more_specialized_class): Adjust calls to get_class_bindings. (get_bindings_real): Don't call complete_template_args. (most_specialized): Don't overwrite input; create a new list. (most_specialized_class): Use most_general_template. (regenerate_decl_from_template): Use unregister_specialization. Use full template arguments. (instantiate_decl): Use full template arguments. (set_mangled_name_for_template_decl): New function. * semantics.c (begin_class_definition): Use maybe_process_partial_specialization. (finish_member_class_template): New function. (finish_template_decl): Likewise. (finish_template_type): Likewise. (typeck.c): Don't crash after issuing a compiler_error. * Makefile.in (CONFLICTS): Adjust; we removed a s/r conflict. From-SVN: r21433
1998-07-28 03:03:16 +02:00
/* Finish processing a complete template declaration. The PARMS are
cp-tree.h (TI_USES_TEMPLATE_PARMS): Remove. * cp-tree.h (TI_USES_TEMPLATE_PARMS): Remove. (build_template_decl_overload): Remove. (set_mangled_name_for_decl): New function. (innermost_args): Remove is_spec parameter. (most_specialized, most_specialized_class): Remove declarations. (lookup_template_class): Add entering_scope parameter. (maybe_process_partial_specialization): New function. (finish_template_decl): Likewise. (finish_template_type): Likewise. * class.c (finish_struct): Clean up processing of member template specializations. * decl.c (pushtag): Fix formatting. (lookup_tag): Improve handling of pseudo-global levels. (make_typename_type): Adjust call to lookup_template_class. (shadow_tag): Use maybe_process_partial_specialization. (xref_tag): Improve handling of member friends. (start_function): Call push_nested_class before push_template_decl. Don't call push_template_decl for specializations. * decl2.c (grok_x_components): Don't call xref_tag for template instantiations. Handle UNION_TYPEs like RECORD_TYPEs. (grokclassfn): Use set_mangled_name_for_decl. (arg_assoc_class): Adjust call to innermost_args. (mark_used): Don't call instantiate_decl for a TEMPLATE_DECL. * error.c (dump_function_name): Improve printing of template function names. * friend.c (is_friend): Don't compare types of decls to determine friendship, unless flag_guiding_decls. (make_friend_class): Partial specializations cannot be friends. (do_friend): Use set_mangled_name_for_decl. Call push_template_decl_real instead of push_template_decl. * method.c (build_decl_overload_real): Remove prototype. Give it external linkage. (build_overload_identififer): Adjust call to innermost_args. (build_template_decl_overload): Remove. (set_mangled_name_for_decl): New function. * parse.y (.finish_template_type): New non-terminal. (template_def): Use finish_template_decl. Use template_extdef instead of extdef. (template_extdef, template_datadef): New non-terminals, containing only those rules for things which can be templates. (datadef): Tidy. (template_type, self_template_type): Use .finish_template_type. (named_class_head): Use maybe_process_partial_specialization. * pt.c (mangle_class_name_for_template): Remove context parameter. (get_class_bindings): Remove outer_args parameter. (complete_template_args): Remove. (add_outermost_template_args): New function. (register_specialization): Return the specialization. (unregister_specialization): New function. (tsubst_template_parms): Likewise. (most_specialized, most_specialized_class): Prototype here as static. (original_template): Rename to most_general_template. (tsubst_template_parms): New function. (set_mangled_name_for_template_decl): Likewise. (TMPL_ARGS_DEPTH): New macro. (TMPL_ARGS_HAVE_MULTIPLE_LEVELS): Adjust. (TMPL_ARGS_LEVEL): New macro. (SET_TMPL_ARGS_LEVEL): Likewise. (TMPL_ARG): Likewise. (SET_TMPL_ARG): Likewise. (TMPL_ARGS_DEPTH): Likewise. (finish_member_template_decl): Use finish_template_decl. (maybe_process_partial_specialization): New function, split out from tsubst. (inline_needs_template_parms): Use TMPL_PARMS_DEPTH. (maybe_begin_member_template_processing): Use new macros. (is_member_template): Likewise. (is_member_template_class): Likewise. (add_to_template_args): Likewise. Deal with multiple levels of args. (maybe_process_partial_specialization): New function. (retrieve_specialization): Add consistency check. (determine_specialization): Return full argument list. (check_explicit_specialization): Tweak friend handling. Use full argument lists. Simplify. (current_template_args): Use new macros. (push_template_decl_real): Change ill-named mainargs to specargs. Check that a partial specialization actually specializes at least one parameter. Improve friend handling. Modify for full template arguments. (classtype_mangled_name): Don't mangle the names of specializations. (lookup_template_class): Add entering_scope parameter. Use it to avoid finding a template type when an instantiation is required. Simplify. Use full template arguments. (tsubst_friend_function): Use unregister_specialization. Use new macros. Use full template arguments. (tsubst_friend_class): Substitute, using tsubst_template_parms, into the template parameters before passing them to redeclare_class_template. (instantiate_class_template): Simplify. Use full template arguments. Adjust calls to get_class_bindings. Use SET_IDENTIFIER_TYPE_VALUE where needed. Improve friend handling. (innermost_args): Use new macros. (tsubst_aggr_type): New function, split out from tsubst. (tsubst): Use tsubst_aggr_type, tsubst_template_parms, new calling conventions for lookup_tmeplate_class. Refine handling of partial instantiations. Remove calls to complete_template_args. Simplify. Add consistency checks. Use set_mangled_name_for_decl and set_mangled_name_for_template_decl. (tsubst_copy): Use tsubst_aggr_type. (instantiate_template): Use full template arguments. (more_specialized): Improve formatting. (more_specialized_class): Adjust calls to get_class_bindings. (get_bindings_real): Don't call complete_template_args. (most_specialized): Don't overwrite input; create a new list. (most_specialized_class): Use most_general_template. (regenerate_decl_from_template): Use unregister_specialization. Use full template arguments. (instantiate_decl): Use full template arguments. (set_mangled_name_for_template_decl): New function. * semantics.c (begin_class_definition): Use maybe_process_partial_specialization. (finish_member_class_template): New function. (finish_template_decl): Likewise. (finish_template_type): Likewise. (typeck.c): Don't crash after issuing a compiler_error. * Makefile.in (CONFLICTS): Adjust; we removed a s/r conflict. From-SVN: r21433
1998-07-28 03:03:16 +02:00
the template parameters. */
void
finish_template_decl (tree parms)
cp-tree.h (TI_USES_TEMPLATE_PARMS): Remove. * cp-tree.h (TI_USES_TEMPLATE_PARMS): Remove. (build_template_decl_overload): Remove. (set_mangled_name_for_decl): New function. (innermost_args): Remove is_spec parameter. (most_specialized, most_specialized_class): Remove declarations. (lookup_template_class): Add entering_scope parameter. (maybe_process_partial_specialization): New function. (finish_template_decl): Likewise. (finish_template_type): Likewise. * class.c (finish_struct): Clean up processing of member template specializations. * decl.c (pushtag): Fix formatting. (lookup_tag): Improve handling of pseudo-global levels. (make_typename_type): Adjust call to lookup_template_class. (shadow_tag): Use maybe_process_partial_specialization. (xref_tag): Improve handling of member friends. (start_function): Call push_nested_class before push_template_decl. Don't call push_template_decl for specializations. * decl2.c (grok_x_components): Don't call xref_tag for template instantiations. Handle UNION_TYPEs like RECORD_TYPEs. (grokclassfn): Use set_mangled_name_for_decl. (arg_assoc_class): Adjust call to innermost_args. (mark_used): Don't call instantiate_decl for a TEMPLATE_DECL. * error.c (dump_function_name): Improve printing of template function names. * friend.c (is_friend): Don't compare types of decls to determine friendship, unless flag_guiding_decls. (make_friend_class): Partial specializations cannot be friends. (do_friend): Use set_mangled_name_for_decl. Call push_template_decl_real instead of push_template_decl. * method.c (build_decl_overload_real): Remove prototype. Give it external linkage. (build_overload_identififer): Adjust call to innermost_args. (build_template_decl_overload): Remove. (set_mangled_name_for_decl): New function. * parse.y (.finish_template_type): New non-terminal. (template_def): Use finish_template_decl. Use template_extdef instead of extdef. (template_extdef, template_datadef): New non-terminals, containing only those rules for things which can be templates. (datadef): Tidy. (template_type, self_template_type): Use .finish_template_type. (named_class_head): Use maybe_process_partial_specialization. * pt.c (mangle_class_name_for_template): Remove context parameter. (get_class_bindings): Remove outer_args parameter. (complete_template_args): Remove. (add_outermost_template_args): New function. (register_specialization): Return the specialization. (unregister_specialization): New function. (tsubst_template_parms): Likewise. (most_specialized, most_specialized_class): Prototype here as static. (original_template): Rename to most_general_template. (tsubst_template_parms): New function. (set_mangled_name_for_template_decl): Likewise. (TMPL_ARGS_DEPTH): New macro. (TMPL_ARGS_HAVE_MULTIPLE_LEVELS): Adjust. (TMPL_ARGS_LEVEL): New macro. (SET_TMPL_ARGS_LEVEL): Likewise. (TMPL_ARG): Likewise. (SET_TMPL_ARG): Likewise. (TMPL_ARGS_DEPTH): Likewise. (finish_member_template_decl): Use finish_template_decl. (maybe_process_partial_specialization): New function, split out from tsubst. (inline_needs_template_parms): Use TMPL_PARMS_DEPTH. (maybe_begin_member_template_processing): Use new macros. (is_member_template): Likewise. (is_member_template_class): Likewise. (add_to_template_args): Likewise. Deal with multiple levels of args. (maybe_process_partial_specialization): New function. (retrieve_specialization): Add consistency check. (determine_specialization): Return full argument list. (check_explicit_specialization): Tweak friend handling. Use full argument lists. Simplify. (current_template_args): Use new macros. (push_template_decl_real): Change ill-named mainargs to specargs. Check that a partial specialization actually specializes at least one parameter. Improve friend handling. Modify for full template arguments. (classtype_mangled_name): Don't mangle the names of specializations. (lookup_template_class): Add entering_scope parameter. Use it to avoid finding a template type when an instantiation is required. Simplify. Use full template arguments. (tsubst_friend_function): Use unregister_specialization. Use new macros. Use full template arguments. (tsubst_friend_class): Substitute, using tsubst_template_parms, into the template parameters before passing them to redeclare_class_template. (instantiate_class_template): Simplify. Use full template arguments. Adjust calls to get_class_bindings. Use SET_IDENTIFIER_TYPE_VALUE where needed. Improve friend handling. (innermost_args): Use new macros. (tsubst_aggr_type): New function, split out from tsubst. (tsubst): Use tsubst_aggr_type, tsubst_template_parms, new calling conventions for lookup_tmeplate_class. Refine handling of partial instantiations. Remove calls to complete_template_args. Simplify. Add consistency checks. Use set_mangled_name_for_decl and set_mangled_name_for_template_decl. (tsubst_copy): Use tsubst_aggr_type. (instantiate_template): Use full template arguments. (more_specialized): Improve formatting. (more_specialized_class): Adjust calls to get_class_bindings. (get_bindings_real): Don't call complete_template_args. (most_specialized): Don't overwrite input; create a new list. (most_specialized_class): Use most_general_template. (regenerate_decl_from_template): Use unregister_specialization. Use full template arguments. (instantiate_decl): Use full template arguments. (set_mangled_name_for_template_decl): New function. * semantics.c (begin_class_definition): Use maybe_process_partial_specialization. (finish_member_class_template): New function. (finish_template_decl): Likewise. (finish_template_type): Likewise. (typeck.c): Don't crash after issuing a compiler_error. * Makefile.in (CONFLICTS): Adjust; we removed a s/r conflict. From-SVN: r21433
1998-07-28 03:03:16 +02:00
{
if (parms)
end_template_decl ();
else
end_specialization ();
}
/* Finish processing a template-id (which names a type) of the form
cp-tree.h (TI_USES_TEMPLATE_PARMS): Remove. * cp-tree.h (TI_USES_TEMPLATE_PARMS): Remove. (build_template_decl_overload): Remove. (set_mangled_name_for_decl): New function. (innermost_args): Remove is_spec parameter. (most_specialized, most_specialized_class): Remove declarations. (lookup_template_class): Add entering_scope parameter. (maybe_process_partial_specialization): New function. (finish_template_decl): Likewise. (finish_template_type): Likewise. * class.c (finish_struct): Clean up processing of member template specializations. * decl.c (pushtag): Fix formatting. (lookup_tag): Improve handling of pseudo-global levels. (make_typename_type): Adjust call to lookup_template_class. (shadow_tag): Use maybe_process_partial_specialization. (xref_tag): Improve handling of member friends. (start_function): Call push_nested_class before push_template_decl. Don't call push_template_decl for specializations. * decl2.c (grok_x_components): Don't call xref_tag for template instantiations. Handle UNION_TYPEs like RECORD_TYPEs. (grokclassfn): Use set_mangled_name_for_decl. (arg_assoc_class): Adjust call to innermost_args. (mark_used): Don't call instantiate_decl for a TEMPLATE_DECL. * error.c (dump_function_name): Improve printing of template function names. * friend.c (is_friend): Don't compare types of decls to determine friendship, unless flag_guiding_decls. (make_friend_class): Partial specializations cannot be friends. (do_friend): Use set_mangled_name_for_decl. Call push_template_decl_real instead of push_template_decl. * method.c (build_decl_overload_real): Remove prototype. Give it external linkage. (build_overload_identififer): Adjust call to innermost_args. (build_template_decl_overload): Remove. (set_mangled_name_for_decl): New function. * parse.y (.finish_template_type): New non-terminal. (template_def): Use finish_template_decl. Use template_extdef instead of extdef. (template_extdef, template_datadef): New non-terminals, containing only those rules for things which can be templates. (datadef): Tidy. (template_type, self_template_type): Use .finish_template_type. (named_class_head): Use maybe_process_partial_specialization. * pt.c (mangle_class_name_for_template): Remove context parameter. (get_class_bindings): Remove outer_args parameter. (complete_template_args): Remove. (add_outermost_template_args): New function. (register_specialization): Return the specialization. (unregister_specialization): New function. (tsubst_template_parms): Likewise. (most_specialized, most_specialized_class): Prototype here as static. (original_template): Rename to most_general_template. (tsubst_template_parms): New function. (set_mangled_name_for_template_decl): Likewise. (TMPL_ARGS_DEPTH): New macro. (TMPL_ARGS_HAVE_MULTIPLE_LEVELS): Adjust. (TMPL_ARGS_LEVEL): New macro. (SET_TMPL_ARGS_LEVEL): Likewise. (TMPL_ARG): Likewise. (SET_TMPL_ARG): Likewise. (TMPL_ARGS_DEPTH): Likewise. (finish_member_template_decl): Use finish_template_decl. (maybe_process_partial_specialization): New function, split out from tsubst. (inline_needs_template_parms): Use TMPL_PARMS_DEPTH. (maybe_begin_member_template_processing): Use new macros. (is_member_template): Likewise. (is_member_template_class): Likewise. (add_to_template_args): Likewise. Deal with multiple levels of args. (maybe_process_partial_specialization): New function. (retrieve_specialization): Add consistency check. (determine_specialization): Return full argument list. (check_explicit_specialization): Tweak friend handling. Use full argument lists. Simplify. (current_template_args): Use new macros. (push_template_decl_real): Change ill-named mainargs to specargs. Check that a partial specialization actually specializes at least one parameter. Improve friend handling. Modify for full template arguments. (classtype_mangled_name): Don't mangle the names of specializations. (lookup_template_class): Add entering_scope parameter. Use it to avoid finding a template type when an instantiation is required. Simplify. Use full template arguments. (tsubst_friend_function): Use unregister_specialization. Use new macros. Use full template arguments. (tsubst_friend_class): Substitute, using tsubst_template_parms, into the template parameters before passing them to redeclare_class_template. (instantiate_class_template): Simplify. Use full template arguments. Adjust calls to get_class_bindings. Use SET_IDENTIFIER_TYPE_VALUE where needed. Improve friend handling. (innermost_args): Use new macros. (tsubst_aggr_type): New function, split out from tsubst. (tsubst): Use tsubst_aggr_type, tsubst_template_parms, new calling conventions for lookup_tmeplate_class. Refine handling of partial instantiations. Remove calls to complete_template_args. Simplify. Add consistency checks. Use set_mangled_name_for_decl and set_mangled_name_for_template_decl. (tsubst_copy): Use tsubst_aggr_type. (instantiate_template): Use full template arguments. (more_specialized): Improve formatting. (more_specialized_class): Adjust calls to get_class_bindings. (get_bindings_real): Don't call complete_template_args. (most_specialized): Don't overwrite input; create a new list. (most_specialized_class): Use most_general_template. (regenerate_decl_from_template): Use unregister_specialization. Use full template arguments. (instantiate_decl): Use full template arguments. (set_mangled_name_for_template_decl): New function. * semantics.c (begin_class_definition): Use maybe_process_partial_specialization. (finish_member_class_template): New function. (finish_template_decl): Likewise. (finish_template_type): Likewise. (typeck.c): Don't crash after issuing a compiler_error. * Makefile.in (CONFLICTS): Adjust; we removed a s/r conflict. From-SVN: r21433
1998-07-28 03:03:16 +02:00
NAME < ARGS >. Return the TYPE_DECL for the type named by the
template-id. If ENTERING_SCOPE is nonzero we are about to enter
cp-tree.h (TI_USES_TEMPLATE_PARMS): Remove. * cp-tree.h (TI_USES_TEMPLATE_PARMS): Remove. (build_template_decl_overload): Remove. (set_mangled_name_for_decl): New function. (innermost_args): Remove is_spec parameter. (most_specialized, most_specialized_class): Remove declarations. (lookup_template_class): Add entering_scope parameter. (maybe_process_partial_specialization): New function. (finish_template_decl): Likewise. (finish_template_type): Likewise. * class.c (finish_struct): Clean up processing of member template specializations. * decl.c (pushtag): Fix formatting. (lookup_tag): Improve handling of pseudo-global levels. (make_typename_type): Adjust call to lookup_template_class. (shadow_tag): Use maybe_process_partial_specialization. (xref_tag): Improve handling of member friends. (start_function): Call push_nested_class before push_template_decl. Don't call push_template_decl for specializations. * decl2.c (grok_x_components): Don't call xref_tag for template instantiations. Handle UNION_TYPEs like RECORD_TYPEs. (grokclassfn): Use set_mangled_name_for_decl. (arg_assoc_class): Adjust call to innermost_args. (mark_used): Don't call instantiate_decl for a TEMPLATE_DECL. * error.c (dump_function_name): Improve printing of template function names. * friend.c (is_friend): Don't compare types of decls to determine friendship, unless flag_guiding_decls. (make_friend_class): Partial specializations cannot be friends. (do_friend): Use set_mangled_name_for_decl. Call push_template_decl_real instead of push_template_decl. * method.c (build_decl_overload_real): Remove prototype. Give it external linkage. (build_overload_identififer): Adjust call to innermost_args. (build_template_decl_overload): Remove. (set_mangled_name_for_decl): New function. * parse.y (.finish_template_type): New non-terminal. (template_def): Use finish_template_decl. Use template_extdef instead of extdef. (template_extdef, template_datadef): New non-terminals, containing only those rules for things which can be templates. (datadef): Tidy. (template_type, self_template_type): Use .finish_template_type. (named_class_head): Use maybe_process_partial_specialization. * pt.c (mangle_class_name_for_template): Remove context parameter. (get_class_bindings): Remove outer_args parameter. (complete_template_args): Remove. (add_outermost_template_args): New function. (register_specialization): Return the specialization. (unregister_specialization): New function. (tsubst_template_parms): Likewise. (most_specialized, most_specialized_class): Prototype here as static. (original_template): Rename to most_general_template. (tsubst_template_parms): New function. (set_mangled_name_for_template_decl): Likewise. (TMPL_ARGS_DEPTH): New macro. (TMPL_ARGS_HAVE_MULTIPLE_LEVELS): Adjust. (TMPL_ARGS_LEVEL): New macro. (SET_TMPL_ARGS_LEVEL): Likewise. (TMPL_ARG): Likewise. (SET_TMPL_ARG): Likewise. (TMPL_ARGS_DEPTH): Likewise. (finish_member_template_decl): Use finish_template_decl. (maybe_process_partial_specialization): New function, split out from tsubst. (inline_needs_template_parms): Use TMPL_PARMS_DEPTH. (maybe_begin_member_template_processing): Use new macros. (is_member_template): Likewise. (is_member_template_class): Likewise. (add_to_template_args): Likewise. Deal with multiple levels of args. (maybe_process_partial_specialization): New function. (retrieve_specialization): Add consistency check. (determine_specialization): Return full argument list. (check_explicit_specialization): Tweak friend handling. Use full argument lists. Simplify. (current_template_args): Use new macros. (push_template_decl_real): Change ill-named mainargs to specargs. Check that a partial specialization actually specializes at least one parameter. Improve friend handling. Modify for full template arguments. (classtype_mangled_name): Don't mangle the names of specializations. (lookup_template_class): Add entering_scope parameter. Use it to avoid finding a template type when an instantiation is required. Simplify. Use full template arguments. (tsubst_friend_function): Use unregister_specialization. Use new macros. Use full template arguments. (tsubst_friend_class): Substitute, using tsubst_template_parms, into the template parameters before passing them to redeclare_class_template. (instantiate_class_template): Simplify. Use full template arguments. Adjust calls to get_class_bindings. Use SET_IDENTIFIER_TYPE_VALUE where needed. Improve friend handling. (innermost_args): Use new macros. (tsubst_aggr_type): New function, split out from tsubst. (tsubst): Use tsubst_aggr_type, tsubst_template_parms, new calling conventions for lookup_tmeplate_class. Refine handling of partial instantiations. Remove calls to complete_template_args. Simplify. Add consistency checks. Use set_mangled_name_for_decl and set_mangled_name_for_template_decl. (tsubst_copy): Use tsubst_aggr_type. (instantiate_template): Use full template arguments. (more_specialized): Improve formatting. (more_specialized_class): Adjust calls to get_class_bindings. (get_bindings_real): Don't call complete_template_args. (most_specialized): Don't overwrite input; create a new list. (most_specialized_class): Use most_general_template. (regenerate_decl_from_template): Use unregister_specialization. Use full template arguments. (instantiate_decl): Use full template arguments. (set_mangled_name_for_template_decl): New function. * semantics.c (begin_class_definition): Use maybe_process_partial_specialization. (finish_member_class_template): New function. (finish_template_decl): Likewise. (finish_template_type): Likewise. (typeck.c): Don't crash after issuing a compiler_error. * Makefile.in (CONFLICTS): Adjust; we removed a s/r conflict. From-SVN: r21433
1998-07-28 03:03:16 +02:00
the scope of template-id indicated. */
tree
finish_template_type (tree name, tree args, int entering_scope)
cp-tree.h (TI_USES_TEMPLATE_PARMS): Remove. * cp-tree.h (TI_USES_TEMPLATE_PARMS): Remove. (build_template_decl_overload): Remove. (set_mangled_name_for_decl): New function. (innermost_args): Remove is_spec parameter. (most_specialized, most_specialized_class): Remove declarations. (lookup_template_class): Add entering_scope parameter. (maybe_process_partial_specialization): New function. (finish_template_decl): Likewise. (finish_template_type): Likewise. * class.c (finish_struct): Clean up processing of member template specializations. * decl.c (pushtag): Fix formatting. (lookup_tag): Improve handling of pseudo-global levels. (make_typename_type): Adjust call to lookup_template_class. (shadow_tag): Use maybe_process_partial_specialization. (xref_tag): Improve handling of member friends. (start_function): Call push_nested_class before push_template_decl. Don't call push_template_decl for specializations. * decl2.c (grok_x_components): Don't call xref_tag for template instantiations. Handle UNION_TYPEs like RECORD_TYPEs. (grokclassfn): Use set_mangled_name_for_decl. (arg_assoc_class): Adjust call to innermost_args. (mark_used): Don't call instantiate_decl for a TEMPLATE_DECL. * error.c (dump_function_name): Improve printing of template function names. * friend.c (is_friend): Don't compare types of decls to determine friendship, unless flag_guiding_decls. (make_friend_class): Partial specializations cannot be friends. (do_friend): Use set_mangled_name_for_decl. Call push_template_decl_real instead of push_template_decl. * method.c (build_decl_overload_real): Remove prototype. Give it external linkage. (build_overload_identififer): Adjust call to innermost_args. (build_template_decl_overload): Remove. (set_mangled_name_for_decl): New function. * parse.y (.finish_template_type): New non-terminal. (template_def): Use finish_template_decl. Use template_extdef instead of extdef. (template_extdef, template_datadef): New non-terminals, containing only those rules for things which can be templates. (datadef): Tidy. (template_type, self_template_type): Use .finish_template_type. (named_class_head): Use maybe_process_partial_specialization. * pt.c (mangle_class_name_for_template): Remove context parameter. (get_class_bindings): Remove outer_args parameter. (complete_template_args): Remove. (add_outermost_template_args): New function. (register_specialization): Return the specialization. (unregister_specialization): New function. (tsubst_template_parms): Likewise. (most_specialized, most_specialized_class): Prototype here as static. (original_template): Rename to most_general_template. (tsubst_template_parms): New function. (set_mangled_name_for_template_decl): Likewise. (TMPL_ARGS_DEPTH): New macro. (TMPL_ARGS_HAVE_MULTIPLE_LEVELS): Adjust. (TMPL_ARGS_LEVEL): New macro. (SET_TMPL_ARGS_LEVEL): Likewise. (TMPL_ARG): Likewise. (SET_TMPL_ARG): Likewise. (TMPL_ARGS_DEPTH): Likewise. (finish_member_template_decl): Use finish_template_decl. (maybe_process_partial_specialization): New function, split out from tsubst. (inline_needs_template_parms): Use TMPL_PARMS_DEPTH. (maybe_begin_member_template_processing): Use new macros. (is_member_template): Likewise. (is_member_template_class): Likewise. (add_to_template_args): Likewise. Deal with multiple levels of args. (maybe_process_partial_specialization): New function. (retrieve_specialization): Add consistency check. (determine_specialization): Return full argument list. (check_explicit_specialization): Tweak friend handling. Use full argument lists. Simplify. (current_template_args): Use new macros. (push_template_decl_real): Change ill-named mainargs to specargs. Check that a partial specialization actually specializes at least one parameter. Improve friend handling. Modify for full template arguments. (classtype_mangled_name): Don't mangle the names of specializations. (lookup_template_class): Add entering_scope parameter. Use it to avoid finding a template type when an instantiation is required. Simplify. Use full template arguments. (tsubst_friend_function): Use unregister_specialization. Use new macros. Use full template arguments. (tsubst_friend_class): Substitute, using tsubst_template_parms, into the template parameters before passing them to redeclare_class_template. (instantiate_class_template): Simplify. Use full template arguments. Adjust calls to get_class_bindings. Use SET_IDENTIFIER_TYPE_VALUE where needed. Improve friend handling. (innermost_args): Use new macros. (tsubst_aggr_type): New function, split out from tsubst. (tsubst): Use tsubst_aggr_type, tsubst_template_parms, new calling conventions for lookup_tmeplate_class. Refine handling of partial instantiations. Remove calls to complete_template_args. Simplify. Add consistency checks. Use set_mangled_name_for_decl and set_mangled_name_for_template_decl. (tsubst_copy): Use tsubst_aggr_type. (instantiate_template): Use full template arguments. (more_specialized): Improve formatting. (more_specialized_class): Adjust calls to get_class_bindings. (get_bindings_real): Don't call complete_template_args. (most_specialized): Don't overwrite input; create a new list. (most_specialized_class): Use most_general_template. (regenerate_decl_from_template): Use unregister_specialization. Use full template arguments. (instantiate_decl): Use full template arguments. (set_mangled_name_for_template_decl): New function. * semantics.c (begin_class_definition): Use maybe_process_partial_specialization. (finish_member_class_template): New function. (finish_template_decl): Likewise. (finish_template_type): Likewise. (typeck.c): Don't crash after issuing a compiler_error. * Makefile.in (CONFLICTS): Adjust; we removed a s/r conflict. From-SVN: r21433
1998-07-28 03:03:16 +02:00
{
tree decl;
decl = lookup_template_class (name, args,
NULL_TREE, NULL_TREE, entering_scope,
tf_error | tf_warning | tf_user);
cp-tree.h (TI_USES_TEMPLATE_PARMS): Remove. * cp-tree.h (TI_USES_TEMPLATE_PARMS): Remove. (build_template_decl_overload): Remove. (set_mangled_name_for_decl): New function. (innermost_args): Remove is_spec parameter. (most_specialized, most_specialized_class): Remove declarations. (lookup_template_class): Add entering_scope parameter. (maybe_process_partial_specialization): New function. (finish_template_decl): Likewise. (finish_template_type): Likewise. * class.c (finish_struct): Clean up processing of member template specializations. * decl.c (pushtag): Fix formatting. (lookup_tag): Improve handling of pseudo-global levels. (make_typename_type): Adjust call to lookup_template_class. (shadow_tag): Use maybe_process_partial_specialization. (xref_tag): Improve handling of member friends. (start_function): Call push_nested_class before push_template_decl. Don't call push_template_decl for specializations. * decl2.c (grok_x_components): Don't call xref_tag for template instantiations. Handle UNION_TYPEs like RECORD_TYPEs. (grokclassfn): Use set_mangled_name_for_decl. (arg_assoc_class): Adjust call to innermost_args. (mark_used): Don't call instantiate_decl for a TEMPLATE_DECL. * error.c (dump_function_name): Improve printing of template function names. * friend.c (is_friend): Don't compare types of decls to determine friendship, unless flag_guiding_decls. (make_friend_class): Partial specializations cannot be friends. (do_friend): Use set_mangled_name_for_decl. Call push_template_decl_real instead of push_template_decl. * method.c (build_decl_overload_real): Remove prototype. Give it external linkage. (build_overload_identififer): Adjust call to innermost_args. (build_template_decl_overload): Remove. (set_mangled_name_for_decl): New function. * parse.y (.finish_template_type): New non-terminal. (template_def): Use finish_template_decl. Use template_extdef instead of extdef. (template_extdef, template_datadef): New non-terminals, containing only those rules for things which can be templates. (datadef): Tidy. (template_type, self_template_type): Use .finish_template_type. (named_class_head): Use maybe_process_partial_specialization. * pt.c (mangle_class_name_for_template): Remove context parameter. (get_class_bindings): Remove outer_args parameter. (complete_template_args): Remove. (add_outermost_template_args): New function. (register_specialization): Return the specialization. (unregister_specialization): New function. (tsubst_template_parms): Likewise. (most_specialized, most_specialized_class): Prototype here as static. (original_template): Rename to most_general_template. (tsubst_template_parms): New function. (set_mangled_name_for_template_decl): Likewise. (TMPL_ARGS_DEPTH): New macro. (TMPL_ARGS_HAVE_MULTIPLE_LEVELS): Adjust. (TMPL_ARGS_LEVEL): New macro. (SET_TMPL_ARGS_LEVEL): Likewise. (TMPL_ARG): Likewise. (SET_TMPL_ARG): Likewise. (TMPL_ARGS_DEPTH): Likewise. (finish_member_template_decl): Use finish_template_decl. (maybe_process_partial_specialization): New function, split out from tsubst. (inline_needs_template_parms): Use TMPL_PARMS_DEPTH. (maybe_begin_member_template_processing): Use new macros. (is_member_template): Likewise. (is_member_template_class): Likewise. (add_to_template_args): Likewise. Deal with multiple levels of args. (maybe_process_partial_specialization): New function. (retrieve_specialization): Add consistency check. (determine_specialization): Return full argument list. (check_explicit_specialization): Tweak friend handling. Use full argument lists. Simplify. (current_template_args): Use new macros. (push_template_decl_real): Change ill-named mainargs to specargs. Check that a partial specialization actually specializes at least one parameter. Improve friend handling. Modify for full template arguments. (classtype_mangled_name): Don't mangle the names of specializations. (lookup_template_class): Add entering_scope parameter. Use it to avoid finding a template type when an instantiation is required. Simplify. Use full template arguments. (tsubst_friend_function): Use unregister_specialization. Use new macros. Use full template arguments. (tsubst_friend_class): Substitute, using tsubst_template_parms, into the template parameters before passing them to redeclare_class_template. (instantiate_class_template): Simplify. Use full template arguments. Adjust calls to get_class_bindings. Use SET_IDENTIFIER_TYPE_VALUE where needed. Improve friend handling. (innermost_args): Use new macros. (tsubst_aggr_type): New function, split out from tsubst. (tsubst): Use tsubst_aggr_type, tsubst_template_parms, new calling conventions for lookup_tmeplate_class. Refine handling of partial instantiations. Remove calls to complete_template_args. Simplify. Add consistency checks. Use set_mangled_name_for_decl and set_mangled_name_for_template_decl. (tsubst_copy): Use tsubst_aggr_type. (instantiate_template): Use full template arguments. (more_specialized): Improve formatting. (more_specialized_class): Adjust calls to get_class_bindings. (get_bindings_real): Don't call complete_template_args. (most_specialized): Don't overwrite input; create a new list. (most_specialized_class): Use most_general_template. (regenerate_decl_from_template): Use unregister_specialization. Use full template arguments. (instantiate_decl): Use full template arguments. (set_mangled_name_for_template_decl): New function. * semantics.c (begin_class_definition): Use maybe_process_partial_specialization. (finish_member_class_template): New function. (finish_template_decl): Likewise. (finish_template_type): Likewise. (typeck.c): Don't crash after issuing a compiler_error. * Makefile.in (CONFLICTS): Adjust; we removed a s/r conflict. From-SVN: r21433
1998-07-28 03:03:16 +02:00
if (decl != error_mark_node)
decl = TYPE_STUB_DECL (decl);
return decl;
}
/* Finish processing a BASE_CLASS with the indicated ACCESS_SPECIFIER.
Return a TREE_LIST containing the ACCESS_SPECIFIER and the
BASE_CLASS, or NULL_TREE if an error occurred. The
ACCESS_SPECIFIER is one of
access_{default,public,protected_private}[_virtual]_node.*/
tree
Change base class access representation. * tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED, TREE_VIA_PRIVATE): Remove. (BINFO_BASEACCESSES): New binfo elt. (BINFO_BASEACCESS): New accessor. (BINFO_ELTS): Increase. (TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New. (access_public_node, access_protected_node, access_private_node): New global nodes. * tree.c (build_common_tree_nodes_2): Initialize access nodes. * dbxout.c (dbxout_type): Adjust. * dwarf2out.c (gen_inheritance_die): Add access parameter. (gen_member_die): Adjust. * dwarfout.c (output_inheritance_die): ARG is array of two trees. (output_type): Adjust. * tree-dump.c (dequeue_and_dump): Adjust binfo dumping. Change base class access representation. Share virtual base binfos. * cp/call.c (build_special_member_call): Remove binfo_for_vbase call. * cp/class.c (build_base_path): Likewise. (build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use. (build_secondary_vtable): Remove FOR_TYPE arg. Adjust. (make_new_vtable): Adjust. (force_canonical_binfo_r): Delete. (force_canonical_binfo): Delete. (mark_primary_virtual_base): Delete. (dfs_unshared_virtual_bases): Delete. (mark_primary_bases): Adjust. (maybe_warn_about_overly_private_class): Adjust. (dfs_base_derived_from): Delete. (base_derived_from): Follow the inheritance chain. (struct find_final_overrider_data): Add vpath member. (dfs_find_final_overrider): Adjust. (dfs_find_final_overrider_q, dfs_find_final_overrider_post): New. (find_final_overrider): Adjust. (update_vtable_entry_for_fn): Adjust. (modify_all_vtables): Adjust. (walk_subobject_offsets): Adjust. (layout_nonempty_base_or_field): Adjust. (layout_empty_base): Remove last parameter. Adjust. (build_base_field): Adjust. (build_base_fields): Adjust. (propagate_binfo_offsets): Remove last parameter. Adjust. (dfs_set_offset_for_unshared_vbases): Delete. (layout_virtual_bases): Adjust. (finish_struct_1): Adjust. (init_class_processing): Don't init access nodes. (dfs_get_primary_binfo): Delete. (get_primary_binfo): Adjust. (dump_class_hierarchy_r): Remove most derived arg, add IGO parameter. Adjust. (dump_class_hierarchy): Adjust. (finish_vtbls): Adjust. (get_original_base): Delete. (build_vtt_inits): Adjust. (dfs_build_secondary_vptr_vtt_inits): Adjust. (dfs_ctor_vtable_bases_queue_p): Adjust. (build_ctor_vtbl_group): Adjust. (dfs_accumulate_vtbl_inits): Adjust. (build_vtbl_initializer): Adjust. (build_vbase_offset_vtbl_entries): Adjust. (add_vcall_offset_vtbl_entries_1): Adjust. * cp/cp-tree.h (CPTI_ACCESS_*): Remove. (access_*_node): Remove. (CANONICAL_BINFO): Delete. (BINFO_UNSHARED_MARKED): Remove. (BINFO_MARKED): Set LANG_FLAG_0 directly. (SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete. (BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly. (SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED): Delete. (BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly. (SET_BINFO_NEW_VTABLE_MARKED): Adjust. (SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED): Delete. (BINFO_DEPENDENT_BASE_P): New. (dfs_walk, dfs_walk_real): Queue function takes derived binfo and index. (markedp, unmarkedp): Adjust. (dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p, dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp, find_vbase_instance, binfo_for_vbase): Delete. (copied_binfo, original_binfo): Declare. (finish_base_specifier): Add virtual_p arg. (unshare_base_binfos): Delete. (copy_base_binfos): Declare. (reverse_path): Delete. * cp/decl.c (xref_basetypes): Access and virtuality passed differently. Don't copy direct base binfos here. Call copy_base_binfos. * cp/init.c (dfs_initialize_vtbl_ptrs): Adjust. (initialize_vtbl_ptrs): Adjust. (expand_member_init): Adjust. * cp/parser.c (cp_parser_base_specifier): Adjust. * cp/pt.c (instantiate_class_template): Adjust. (get_template_base_recursive): Adjust. * cp/rtti.c (get_pseudo_ti_init): Adjust. (get_pseudo_ti_desc): Adjust. * cp/tree.c (unshare_base_binfos): Rename to ... (copy_base_binfos): ... here, reimplement. (make_binfo): Set BINFO_DEPENDENT_BASE_P. (reverse_path): Remove. * cp/typeck.c (get_delta_difference): Adjust error messages. * cp/semantics.c (finish_base_specifier): Add virtual arg, adjust. * cp/search.c (lookup_base_r): Adjust. (dynamic_cast_base_recurse): Adjust. (canonical_binfo): Remove. (dfs_canonical_queue): Remove. (dfs_assert_unmarked_p): Remove. (assert_canonical_unmarked): Remove. (shared_marked_p, shared_unmarked_p): Remove. (BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE. (dfs_access_in_type): Adjust. (access_in_type): Adjust. (dfs_accessible_queue_p): Adjust. (dfs_accessible_p): Adjust. (is_subobject_of_p_1, is_subobject_of_p): Remove. (struct lookup_field_info): Remove from_dep_base_p field. (lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P. (lookup_field_r): Remove dependent base code. (lookup_member): Likewise. (dfs_walk, dfs_walk_real): Add access arg to queue fn. (dfs_unmarked_real_bases_queue_p): Remove. (dfs_marked_real_bases_queue_p): Remove. (dfs_skip_vbases): Remove. (dfs_get_pure_virtuals): Adjust. (markedp, unmarkedp): Adjust. (marked_vtable_pathp, unmarked_vtable_pathp): Remove. (marked_pushdecls_p, unmarked_pushdecls_p): Adjust. (dfs_unmark): Adjust. (dfs_get_vbase_types):Remove. (dfs_build_inheritance_graph_order): Remove. (get_vbase_types): Remove (dfs_find_vbase_instance): Remove. (find_vbase_instance): Remove. (dfs_debug_unmarkedp): Adjust. (dependent_base_p): Remove. (dfs_push_type_decls): Adjust. (dfs_push_decls): Adjust. (dfs_no_overlap_yet): Adjust. (copied_binfo): New function. (original_binfo): New function. (binfo_for_vbase): Remove. Change base class access representation. * java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC. (add_interface_do): Likewise. From-SVN: r63172
2003-02-20 18:51:46 +01:00
finish_base_specifier (tree base, tree access, bool virtual_p)
{
tree result;
Change base class access representation. * tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED, TREE_VIA_PRIVATE): Remove. (BINFO_BASEACCESSES): New binfo elt. (BINFO_BASEACCESS): New accessor. (BINFO_ELTS): Increase. (TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New. (access_public_node, access_protected_node, access_private_node): New global nodes. * tree.c (build_common_tree_nodes_2): Initialize access nodes. * dbxout.c (dbxout_type): Adjust. * dwarf2out.c (gen_inheritance_die): Add access parameter. (gen_member_die): Adjust. * dwarfout.c (output_inheritance_die): ARG is array of two trees. (output_type): Adjust. * tree-dump.c (dequeue_and_dump): Adjust binfo dumping. Change base class access representation. Share virtual base binfos. * cp/call.c (build_special_member_call): Remove binfo_for_vbase call. * cp/class.c (build_base_path): Likewise. (build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use. (build_secondary_vtable): Remove FOR_TYPE arg. Adjust. (make_new_vtable): Adjust. (force_canonical_binfo_r): Delete. (force_canonical_binfo): Delete. (mark_primary_virtual_base): Delete. (dfs_unshared_virtual_bases): Delete. (mark_primary_bases): Adjust. (maybe_warn_about_overly_private_class): Adjust. (dfs_base_derived_from): Delete. (base_derived_from): Follow the inheritance chain. (struct find_final_overrider_data): Add vpath member. (dfs_find_final_overrider): Adjust. (dfs_find_final_overrider_q, dfs_find_final_overrider_post): New. (find_final_overrider): Adjust. (update_vtable_entry_for_fn): Adjust. (modify_all_vtables): Adjust. (walk_subobject_offsets): Adjust. (layout_nonempty_base_or_field): Adjust. (layout_empty_base): Remove last parameter. Adjust. (build_base_field): Adjust. (build_base_fields): Adjust. (propagate_binfo_offsets): Remove last parameter. Adjust. (dfs_set_offset_for_unshared_vbases): Delete. (layout_virtual_bases): Adjust. (finish_struct_1): Adjust. (init_class_processing): Don't init access nodes. (dfs_get_primary_binfo): Delete. (get_primary_binfo): Adjust. (dump_class_hierarchy_r): Remove most derived arg, add IGO parameter. Adjust. (dump_class_hierarchy): Adjust. (finish_vtbls): Adjust. (get_original_base): Delete. (build_vtt_inits): Adjust. (dfs_build_secondary_vptr_vtt_inits): Adjust. (dfs_ctor_vtable_bases_queue_p): Adjust. (build_ctor_vtbl_group): Adjust. (dfs_accumulate_vtbl_inits): Adjust. (build_vtbl_initializer): Adjust. (build_vbase_offset_vtbl_entries): Adjust. (add_vcall_offset_vtbl_entries_1): Adjust. * cp/cp-tree.h (CPTI_ACCESS_*): Remove. (access_*_node): Remove. (CANONICAL_BINFO): Delete. (BINFO_UNSHARED_MARKED): Remove. (BINFO_MARKED): Set LANG_FLAG_0 directly. (SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete. (BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly. (SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED): Delete. (BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly. (SET_BINFO_NEW_VTABLE_MARKED): Adjust. (SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED): Delete. (BINFO_DEPENDENT_BASE_P): New. (dfs_walk, dfs_walk_real): Queue function takes derived binfo and index. (markedp, unmarkedp): Adjust. (dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p, dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp, find_vbase_instance, binfo_for_vbase): Delete. (copied_binfo, original_binfo): Declare. (finish_base_specifier): Add virtual_p arg. (unshare_base_binfos): Delete. (copy_base_binfos): Declare. (reverse_path): Delete. * cp/decl.c (xref_basetypes): Access and virtuality passed differently. Don't copy direct base binfos here. Call copy_base_binfos. * cp/init.c (dfs_initialize_vtbl_ptrs): Adjust. (initialize_vtbl_ptrs): Adjust. (expand_member_init): Adjust. * cp/parser.c (cp_parser_base_specifier): Adjust. * cp/pt.c (instantiate_class_template): Adjust. (get_template_base_recursive): Adjust. * cp/rtti.c (get_pseudo_ti_init): Adjust. (get_pseudo_ti_desc): Adjust. * cp/tree.c (unshare_base_binfos): Rename to ... (copy_base_binfos): ... here, reimplement. (make_binfo): Set BINFO_DEPENDENT_BASE_P. (reverse_path): Remove. * cp/typeck.c (get_delta_difference): Adjust error messages. * cp/semantics.c (finish_base_specifier): Add virtual arg, adjust. * cp/search.c (lookup_base_r): Adjust. (dynamic_cast_base_recurse): Adjust. (canonical_binfo): Remove. (dfs_canonical_queue): Remove. (dfs_assert_unmarked_p): Remove. (assert_canonical_unmarked): Remove. (shared_marked_p, shared_unmarked_p): Remove. (BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE. (dfs_access_in_type): Adjust. (access_in_type): Adjust. (dfs_accessible_queue_p): Adjust. (dfs_accessible_p): Adjust. (is_subobject_of_p_1, is_subobject_of_p): Remove. (struct lookup_field_info): Remove from_dep_base_p field. (lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P. (lookup_field_r): Remove dependent base code. (lookup_member): Likewise. (dfs_walk, dfs_walk_real): Add access arg to queue fn. (dfs_unmarked_real_bases_queue_p): Remove. (dfs_marked_real_bases_queue_p): Remove. (dfs_skip_vbases): Remove. (dfs_get_pure_virtuals): Adjust. (markedp, unmarkedp): Adjust. (marked_vtable_pathp, unmarked_vtable_pathp): Remove. (marked_pushdecls_p, unmarked_pushdecls_p): Adjust. (dfs_unmark): Adjust. (dfs_get_vbase_types):Remove. (dfs_build_inheritance_graph_order): Remove. (get_vbase_types): Remove (dfs_find_vbase_instance): Remove. (find_vbase_instance): Remove. (dfs_debug_unmarkedp): Adjust. (dependent_base_p): Remove. (dfs_push_type_decls): Adjust. (dfs_push_decls): Adjust. (dfs_no_overlap_yet): Adjust. (copied_binfo): New function. (original_binfo): New function. (binfo_for_vbase): Remove. Change base class access representation. * java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC. (add_interface_do): Likewise. From-SVN: r63172
2003-02-20 18:51:46 +01:00
if (base == error_mark_node)
{
error ("invalid base-class specification");
result = NULL_TREE;
}
Change base class access representation. * tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED, TREE_VIA_PRIVATE): Remove. (BINFO_BASEACCESSES): New binfo elt. (BINFO_BASEACCESS): New accessor. (BINFO_ELTS): Increase. (TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New. (access_public_node, access_protected_node, access_private_node): New global nodes. * tree.c (build_common_tree_nodes_2): Initialize access nodes. * dbxout.c (dbxout_type): Adjust. * dwarf2out.c (gen_inheritance_die): Add access parameter. (gen_member_die): Adjust. * dwarfout.c (output_inheritance_die): ARG is array of two trees. (output_type): Adjust. * tree-dump.c (dequeue_and_dump): Adjust binfo dumping. Change base class access representation. Share virtual base binfos. * cp/call.c (build_special_member_call): Remove binfo_for_vbase call. * cp/class.c (build_base_path): Likewise. (build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use. (build_secondary_vtable): Remove FOR_TYPE arg. Adjust. (make_new_vtable): Adjust. (force_canonical_binfo_r): Delete. (force_canonical_binfo): Delete. (mark_primary_virtual_base): Delete. (dfs_unshared_virtual_bases): Delete. (mark_primary_bases): Adjust. (maybe_warn_about_overly_private_class): Adjust. (dfs_base_derived_from): Delete. (base_derived_from): Follow the inheritance chain. (struct find_final_overrider_data): Add vpath member. (dfs_find_final_overrider): Adjust. (dfs_find_final_overrider_q, dfs_find_final_overrider_post): New. (find_final_overrider): Adjust. (update_vtable_entry_for_fn): Adjust. (modify_all_vtables): Adjust. (walk_subobject_offsets): Adjust. (layout_nonempty_base_or_field): Adjust. (layout_empty_base): Remove last parameter. Adjust. (build_base_field): Adjust. (build_base_fields): Adjust. (propagate_binfo_offsets): Remove last parameter. Adjust. (dfs_set_offset_for_unshared_vbases): Delete. (layout_virtual_bases): Adjust. (finish_struct_1): Adjust. (init_class_processing): Don't init access nodes. (dfs_get_primary_binfo): Delete. (get_primary_binfo): Adjust. (dump_class_hierarchy_r): Remove most derived arg, add IGO parameter. Adjust. (dump_class_hierarchy): Adjust. (finish_vtbls): Adjust. (get_original_base): Delete. (build_vtt_inits): Adjust. (dfs_build_secondary_vptr_vtt_inits): Adjust. (dfs_ctor_vtable_bases_queue_p): Adjust. (build_ctor_vtbl_group): Adjust. (dfs_accumulate_vtbl_inits): Adjust. (build_vtbl_initializer): Adjust. (build_vbase_offset_vtbl_entries): Adjust. (add_vcall_offset_vtbl_entries_1): Adjust. * cp/cp-tree.h (CPTI_ACCESS_*): Remove. (access_*_node): Remove. (CANONICAL_BINFO): Delete. (BINFO_UNSHARED_MARKED): Remove. (BINFO_MARKED): Set LANG_FLAG_0 directly. (SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete. (BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly. (SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED): Delete. (BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly. (SET_BINFO_NEW_VTABLE_MARKED): Adjust. (SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED): Delete. (BINFO_DEPENDENT_BASE_P): New. (dfs_walk, dfs_walk_real): Queue function takes derived binfo and index. (markedp, unmarkedp): Adjust. (dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p, dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp, find_vbase_instance, binfo_for_vbase): Delete. (copied_binfo, original_binfo): Declare. (finish_base_specifier): Add virtual_p arg. (unshare_base_binfos): Delete. (copy_base_binfos): Declare. (reverse_path): Delete. * cp/decl.c (xref_basetypes): Access and virtuality passed differently. Don't copy direct base binfos here. Call copy_base_binfos. * cp/init.c (dfs_initialize_vtbl_ptrs): Adjust. (initialize_vtbl_ptrs): Adjust. (expand_member_init): Adjust. * cp/parser.c (cp_parser_base_specifier): Adjust. * cp/pt.c (instantiate_class_template): Adjust. (get_template_base_recursive): Adjust. * cp/rtti.c (get_pseudo_ti_init): Adjust. (get_pseudo_ti_desc): Adjust. * cp/tree.c (unshare_base_binfos): Rename to ... (copy_base_binfos): ... here, reimplement. (make_binfo): Set BINFO_DEPENDENT_BASE_P. (reverse_path): Remove. * cp/typeck.c (get_delta_difference): Adjust error messages. * cp/semantics.c (finish_base_specifier): Add virtual arg, adjust. * cp/search.c (lookup_base_r): Adjust. (dynamic_cast_base_recurse): Adjust. (canonical_binfo): Remove. (dfs_canonical_queue): Remove. (dfs_assert_unmarked_p): Remove. (assert_canonical_unmarked): Remove. (shared_marked_p, shared_unmarked_p): Remove. (BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE. (dfs_access_in_type): Adjust. (access_in_type): Adjust. (dfs_accessible_queue_p): Adjust. (dfs_accessible_p): Adjust. (is_subobject_of_p_1, is_subobject_of_p): Remove. (struct lookup_field_info): Remove from_dep_base_p field. (lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P. (lookup_field_r): Remove dependent base code. (lookup_member): Likewise. (dfs_walk, dfs_walk_real): Add access arg to queue fn. (dfs_unmarked_real_bases_queue_p): Remove. (dfs_marked_real_bases_queue_p): Remove. (dfs_skip_vbases): Remove. (dfs_get_pure_virtuals): Adjust. (markedp, unmarkedp): Adjust. (marked_vtable_pathp, unmarked_vtable_pathp): Remove. (marked_pushdecls_p, unmarked_pushdecls_p): Adjust. (dfs_unmark): Adjust. (dfs_get_vbase_types):Remove. (dfs_build_inheritance_graph_order): Remove. (get_vbase_types): Remove (dfs_find_vbase_instance): Remove. (find_vbase_instance): Remove. (dfs_debug_unmarkedp): Adjust. (dependent_base_p): Remove. (dfs_push_type_decls): Adjust. (dfs_push_decls): Adjust. (dfs_no_overlap_yet): Adjust. (copied_binfo): New function. (original_binfo): New function. (binfo_for_vbase): Remove. Change base class access representation. * java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC. (add_interface_do): Likewise. From-SVN: r63172
2003-02-20 18:51:46 +01:00
else if (! is_aggr_type (base, 1))
result = NULL_TREE;
else
{
Change base class access representation. * tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED, TREE_VIA_PRIVATE): Remove. (BINFO_BASEACCESSES): New binfo elt. (BINFO_BASEACCESS): New accessor. (BINFO_ELTS): Increase. (TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New. (access_public_node, access_protected_node, access_private_node): New global nodes. * tree.c (build_common_tree_nodes_2): Initialize access nodes. * dbxout.c (dbxout_type): Adjust. * dwarf2out.c (gen_inheritance_die): Add access parameter. (gen_member_die): Adjust. * dwarfout.c (output_inheritance_die): ARG is array of two trees. (output_type): Adjust. * tree-dump.c (dequeue_and_dump): Adjust binfo dumping. Change base class access representation. Share virtual base binfos. * cp/call.c (build_special_member_call): Remove binfo_for_vbase call. * cp/class.c (build_base_path): Likewise. (build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use. (build_secondary_vtable): Remove FOR_TYPE arg. Adjust. (make_new_vtable): Adjust. (force_canonical_binfo_r): Delete. (force_canonical_binfo): Delete. (mark_primary_virtual_base): Delete. (dfs_unshared_virtual_bases): Delete. (mark_primary_bases): Adjust. (maybe_warn_about_overly_private_class): Adjust. (dfs_base_derived_from): Delete. (base_derived_from): Follow the inheritance chain. (struct find_final_overrider_data): Add vpath member. (dfs_find_final_overrider): Adjust. (dfs_find_final_overrider_q, dfs_find_final_overrider_post): New. (find_final_overrider): Adjust. (update_vtable_entry_for_fn): Adjust. (modify_all_vtables): Adjust. (walk_subobject_offsets): Adjust. (layout_nonempty_base_or_field): Adjust. (layout_empty_base): Remove last parameter. Adjust. (build_base_field): Adjust. (build_base_fields): Adjust. (propagate_binfo_offsets): Remove last parameter. Adjust. (dfs_set_offset_for_unshared_vbases): Delete. (layout_virtual_bases): Adjust. (finish_struct_1): Adjust. (init_class_processing): Don't init access nodes. (dfs_get_primary_binfo): Delete. (get_primary_binfo): Adjust. (dump_class_hierarchy_r): Remove most derived arg, add IGO parameter. Adjust. (dump_class_hierarchy): Adjust. (finish_vtbls): Adjust. (get_original_base): Delete. (build_vtt_inits): Adjust. (dfs_build_secondary_vptr_vtt_inits): Adjust. (dfs_ctor_vtable_bases_queue_p): Adjust. (build_ctor_vtbl_group): Adjust. (dfs_accumulate_vtbl_inits): Adjust. (build_vtbl_initializer): Adjust. (build_vbase_offset_vtbl_entries): Adjust. (add_vcall_offset_vtbl_entries_1): Adjust. * cp/cp-tree.h (CPTI_ACCESS_*): Remove. (access_*_node): Remove. (CANONICAL_BINFO): Delete. (BINFO_UNSHARED_MARKED): Remove. (BINFO_MARKED): Set LANG_FLAG_0 directly. (SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete. (BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly. (SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED): Delete. (BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly. (SET_BINFO_NEW_VTABLE_MARKED): Adjust. (SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED): Delete. (BINFO_DEPENDENT_BASE_P): New. (dfs_walk, dfs_walk_real): Queue function takes derived binfo and index. (markedp, unmarkedp): Adjust. (dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p, dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp, find_vbase_instance, binfo_for_vbase): Delete. (copied_binfo, original_binfo): Declare. (finish_base_specifier): Add virtual_p arg. (unshare_base_binfos): Delete. (copy_base_binfos): Declare. (reverse_path): Delete. * cp/decl.c (xref_basetypes): Access and virtuality passed differently. Don't copy direct base binfos here. Call copy_base_binfos. * cp/init.c (dfs_initialize_vtbl_ptrs): Adjust. (initialize_vtbl_ptrs): Adjust. (expand_member_init): Adjust. * cp/parser.c (cp_parser_base_specifier): Adjust. * cp/pt.c (instantiate_class_template): Adjust. (get_template_base_recursive): Adjust. * cp/rtti.c (get_pseudo_ti_init): Adjust. (get_pseudo_ti_desc): Adjust. * cp/tree.c (unshare_base_binfos): Rename to ... (copy_base_binfos): ... here, reimplement. (make_binfo): Set BINFO_DEPENDENT_BASE_P. (reverse_path): Remove. * cp/typeck.c (get_delta_difference): Adjust error messages. * cp/semantics.c (finish_base_specifier): Add virtual arg, adjust. * cp/search.c (lookup_base_r): Adjust. (dynamic_cast_base_recurse): Adjust. (canonical_binfo): Remove. (dfs_canonical_queue): Remove. (dfs_assert_unmarked_p): Remove. (assert_canonical_unmarked): Remove. (shared_marked_p, shared_unmarked_p): Remove. (BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE. (dfs_access_in_type): Adjust. (access_in_type): Adjust. (dfs_accessible_queue_p): Adjust. (dfs_accessible_p): Adjust. (is_subobject_of_p_1, is_subobject_of_p): Remove. (struct lookup_field_info): Remove from_dep_base_p field. (lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P. (lookup_field_r): Remove dependent base code. (lookup_member): Likewise. (dfs_walk, dfs_walk_real): Add access arg to queue fn. (dfs_unmarked_real_bases_queue_p): Remove. (dfs_marked_real_bases_queue_p): Remove. (dfs_skip_vbases): Remove. (dfs_get_pure_virtuals): Adjust. (markedp, unmarkedp): Adjust. (marked_vtable_pathp, unmarked_vtable_pathp): Remove. (marked_pushdecls_p, unmarked_pushdecls_p): Adjust. (dfs_unmark): Adjust. (dfs_get_vbase_types):Remove. (dfs_build_inheritance_graph_order): Remove. (get_vbase_types): Remove (dfs_find_vbase_instance): Remove. (find_vbase_instance): Remove. (dfs_debug_unmarkedp): Adjust. (dependent_base_p): Remove. (dfs_push_type_decls): Adjust. (dfs_push_decls): Adjust. (dfs_no_overlap_yet): Adjust. (copied_binfo): New function. (original_binfo): New function. (binfo_for_vbase): Remove. Change base class access representation. * java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC. (add_interface_do): Likewise. From-SVN: r63172
2003-02-20 18:51:46 +01:00
if (cp_type_quals (base) != 0)
{
Change base class access representation. * tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED, TREE_VIA_PRIVATE): Remove. (BINFO_BASEACCESSES): New binfo elt. (BINFO_BASEACCESS): New accessor. (BINFO_ELTS): Increase. (TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New. (access_public_node, access_protected_node, access_private_node): New global nodes. * tree.c (build_common_tree_nodes_2): Initialize access nodes. * dbxout.c (dbxout_type): Adjust. * dwarf2out.c (gen_inheritance_die): Add access parameter. (gen_member_die): Adjust. * dwarfout.c (output_inheritance_die): ARG is array of two trees. (output_type): Adjust. * tree-dump.c (dequeue_and_dump): Adjust binfo dumping. Change base class access representation. Share virtual base binfos. * cp/call.c (build_special_member_call): Remove binfo_for_vbase call. * cp/class.c (build_base_path): Likewise. (build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use. (build_secondary_vtable): Remove FOR_TYPE arg. Adjust. (make_new_vtable): Adjust. (force_canonical_binfo_r): Delete. (force_canonical_binfo): Delete. (mark_primary_virtual_base): Delete. (dfs_unshared_virtual_bases): Delete. (mark_primary_bases): Adjust. (maybe_warn_about_overly_private_class): Adjust. (dfs_base_derived_from): Delete. (base_derived_from): Follow the inheritance chain. (struct find_final_overrider_data): Add vpath member. (dfs_find_final_overrider): Adjust. (dfs_find_final_overrider_q, dfs_find_final_overrider_post): New. (find_final_overrider): Adjust. (update_vtable_entry_for_fn): Adjust. (modify_all_vtables): Adjust. (walk_subobject_offsets): Adjust. (layout_nonempty_base_or_field): Adjust. (layout_empty_base): Remove last parameter. Adjust. (build_base_field): Adjust. (build_base_fields): Adjust. (propagate_binfo_offsets): Remove last parameter. Adjust. (dfs_set_offset_for_unshared_vbases): Delete. (layout_virtual_bases): Adjust. (finish_struct_1): Adjust. (init_class_processing): Don't init access nodes. (dfs_get_primary_binfo): Delete. (get_primary_binfo): Adjust. (dump_class_hierarchy_r): Remove most derived arg, add IGO parameter. Adjust. (dump_class_hierarchy): Adjust. (finish_vtbls): Adjust. (get_original_base): Delete. (build_vtt_inits): Adjust. (dfs_build_secondary_vptr_vtt_inits): Adjust. (dfs_ctor_vtable_bases_queue_p): Adjust. (build_ctor_vtbl_group): Adjust. (dfs_accumulate_vtbl_inits): Adjust. (build_vtbl_initializer): Adjust. (build_vbase_offset_vtbl_entries): Adjust. (add_vcall_offset_vtbl_entries_1): Adjust. * cp/cp-tree.h (CPTI_ACCESS_*): Remove. (access_*_node): Remove. (CANONICAL_BINFO): Delete. (BINFO_UNSHARED_MARKED): Remove. (BINFO_MARKED): Set LANG_FLAG_0 directly. (SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete. (BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly. (SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED): Delete. (BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly. (SET_BINFO_NEW_VTABLE_MARKED): Adjust. (SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED): Delete. (BINFO_DEPENDENT_BASE_P): New. (dfs_walk, dfs_walk_real): Queue function takes derived binfo and index. (markedp, unmarkedp): Adjust. (dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p, dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp, find_vbase_instance, binfo_for_vbase): Delete. (copied_binfo, original_binfo): Declare. (finish_base_specifier): Add virtual_p arg. (unshare_base_binfos): Delete. (copy_base_binfos): Declare. (reverse_path): Delete. * cp/decl.c (xref_basetypes): Access and virtuality passed differently. Don't copy direct base binfos here. Call copy_base_binfos. * cp/init.c (dfs_initialize_vtbl_ptrs): Adjust. (initialize_vtbl_ptrs): Adjust. (expand_member_init): Adjust. * cp/parser.c (cp_parser_base_specifier): Adjust. * cp/pt.c (instantiate_class_template): Adjust. (get_template_base_recursive): Adjust. * cp/rtti.c (get_pseudo_ti_init): Adjust. (get_pseudo_ti_desc): Adjust. * cp/tree.c (unshare_base_binfos): Rename to ... (copy_base_binfos): ... here, reimplement. (make_binfo): Set BINFO_DEPENDENT_BASE_P. (reverse_path): Remove. * cp/typeck.c (get_delta_difference): Adjust error messages. * cp/semantics.c (finish_base_specifier): Add virtual arg, adjust. * cp/search.c (lookup_base_r): Adjust. (dynamic_cast_base_recurse): Adjust. (canonical_binfo): Remove. (dfs_canonical_queue): Remove. (dfs_assert_unmarked_p): Remove. (assert_canonical_unmarked): Remove. (shared_marked_p, shared_unmarked_p): Remove. (BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE. (dfs_access_in_type): Adjust. (access_in_type): Adjust. (dfs_accessible_queue_p): Adjust. (dfs_accessible_p): Adjust. (is_subobject_of_p_1, is_subobject_of_p): Remove. (struct lookup_field_info): Remove from_dep_base_p field. (lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P. (lookup_field_r): Remove dependent base code. (lookup_member): Likewise. (dfs_walk, dfs_walk_real): Add access arg to queue fn. (dfs_unmarked_real_bases_queue_p): Remove. (dfs_marked_real_bases_queue_p): Remove. (dfs_skip_vbases): Remove. (dfs_get_pure_virtuals): Adjust. (markedp, unmarkedp): Adjust. (marked_vtable_pathp, unmarked_vtable_pathp): Remove. (marked_pushdecls_p, unmarked_pushdecls_p): Adjust. (dfs_unmark): Adjust. (dfs_get_vbase_types):Remove. (dfs_build_inheritance_graph_order): Remove. (get_vbase_types): Remove (dfs_find_vbase_instance): Remove. (find_vbase_instance): Remove. (dfs_debug_unmarkedp): Adjust. (dependent_base_p): Remove. (dfs_push_type_decls): Adjust. (dfs_push_decls): Adjust. (dfs_no_overlap_yet): Adjust. (copied_binfo): New function. (original_binfo): New function. (binfo_for_vbase): Remove. Change base class access representation. * java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC. (add_interface_do): Likewise. From-SVN: r63172
2003-02-20 18:51:46 +01:00
error ("base class `%T' has cv qualifiers", base);
base = TYPE_MAIN_VARIANT (base);
}
Change base class access representation. * tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED, TREE_VIA_PRIVATE): Remove. (BINFO_BASEACCESSES): New binfo elt. (BINFO_BASEACCESS): New accessor. (BINFO_ELTS): Increase. (TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New. (access_public_node, access_protected_node, access_private_node): New global nodes. * tree.c (build_common_tree_nodes_2): Initialize access nodes. * dbxout.c (dbxout_type): Adjust. * dwarf2out.c (gen_inheritance_die): Add access parameter. (gen_member_die): Adjust. * dwarfout.c (output_inheritance_die): ARG is array of two trees. (output_type): Adjust. * tree-dump.c (dequeue_and_dump): Adjust binfo dumping. Change base class access representation. Share virtual base binfos. * cp/call.c (build_special_member_call): Remove binfo_for_vbase call. * cp/class.c (build_base_path): Likewise. (build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use. (build_secondary_vtable): Remove FOR_TYPE arg. Adjust. (make_new_vtable): Adjust. (force_canonical_binfo_r): Delete. (force_canonical_binfo): Delete. (mark_primary_virtual_base): Delete. (dfs_unshared_virtual_bases): Delete. (mark_primary_bases): Adjust. (maybe_warn_about_overly_private_class): Adjust. (dfs_base_derived_from): Delete. (base_derived_from): Follow the inheritance chain. (struct find_final_overrider_data): Add vpath member. (dfs_find_final_overrider): Adjust. (dfs_find_final_overrider_q, dfs_find_final_overrider_post): New. (find_final_overrider): Adjust. (update_vtable_entry_for_fn): Adjust. (modify_all_vtables): Adjust. (walk_subobject_offsets): Adjust. (layout_nonempty_base_or_field): Adjust. (layout_empty_base): Remove last parameter. Adjust. (build_base_field): Adjust. (build_base_fields): Adjust. (propagate_binfo_offsets): Remove last parameter. Adjust. (dfs_set_offset_for_unshared_vbases): Delete. (layout_virtual_bases): Adjust. (finish_struct_1): Adjust. (init_class_processing): Don't init access nodes. (dfs_get_primary_binfo): Delete. (get_primary_binfo): Adjust. (dump_class_hierarchy_r): Remove most derived arg, add IGO parameter. Adjust. (dump_class_hierarchy): Adjust. (finish_vtbls): Adjust. (get_original_base): Delete. (build_vtt_inits): Adjust. (dfs_build_secondary_vptr_vtt_inits): Adjust. (dfs_ctor_vtable_bases_queue_p): Adjust. (build_ctor_vtbl_group): Adjust. (dfs_accumulate_vtbl_inits): Adjust. (build_vtbl_initializer): Adjust. (build_vbase_offset_vtbl_entries): Adjust. (add_vcall_offset_vtbl_entries_1): Adjust. * cp/cp-tree.h (CPTI_ACCESS_*): Remove. (access_*_node): Remove. (CANONICAL_BINFO): Delete. (BINFO_UNSHARED_MARKED): Remove. (BINFO_MARKED): Set LANG_FLAG_0 directly. (SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete. (BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly. (SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED): Delete. (BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly. (SET_BINFO_NEW_VTABLE_MARKED): Adjust. (SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED): Delete. (BINFO_DEPENDENT_BASE_P): New. (dfs_walk, dfs_walk_real): Queue function takes derived binfo and index. (markedp, unmarkedp): Adjust. (dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p, dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp, find_vbase_instance, binfo_for_vbase): Delete. (copied_binfo, original_binfo): Declare. (finish_base_specifier): Add virtual_p arg. (unshare_base_binfos): Delete. (copy_base_binfos): Declare. (reverse_path): Delete. * cp/decl.c (xref_basetypes): Access and virtuality passed differently. Don't copy direct base binfos here. Call copy_base_binfos. * cp/init.c (dfs_initialize_vtbl_ptrs): Adjust. (initialize_vtbl_ptrs): Adjust. (expand_member_init): Adjust. * cp/parser.c (cp_parser_base_specifier): Adjust. * cp/pt.c (instantiate_class_template): Adjust. (get_template_base_recursive): Adjust. * cp/rtti.c (get_pseudo_ti_init): Adjust. (get_pseudo_ti_desc): Adjust. * cp/tree.c (unshare_base_binfos): Rename to ... (copy_base_binfos): ... here, reimplement. (make_binfo): Set BINFO_DEPENDENT_BASE_P. (reverse_path): Remove. * cp/typeck.c (get_delta_difference): Adjust error messages. * cp/semantics.c (finish_base_specifier): Add virtual arg, adjust. * cp/search.c (lookup_base_r): Adjust. (dynamic_cast_base_recurse): Adjust. (canonical_binfo): Remove. (dfs_canonical_queue): Remove. (dfs_assert_unmarked_p): Remove. (assert_canonical_unmarked): Remove. (shared_marked_p, shared_unmarked_p): Remove. (BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE. (dfs_access_in_type): Adjust. (access_in_type): Adjust. (dfs_accessible_queue_p): Adjust. (dfs_accessible_p): Adjust. (is_subobject_of_p_1, is_subobject_of_p): Remove. (struct lookup_field_info): Remove from_dep_base_p field. (lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P. (lookup_field_r): Remove dependent base code. (lookup_member): Likewise. (dfs_walk, dfs_walk_real): Add access arg to queue fn. (dfs_unmarked_real_bases_queue_p): Remove. (dfs_marked_real_bases_queue_p): Remove. (dfs_skip_vbases): Remove. (dfs_get_pure_virtuals): Adjust. (markedp, unmarkedp): Adjust. (marked_vtable_pathp, unmarked_vtable_pathp): Remove. (marked_pushdecls_p, unmarked_pushdecls_p): Adjust. (dfs_unmark): Adjust. (dfs_get_vbase_types):Remove. (dfs_build_inheritance_graph_order): Remove. (get_vbase_types): Remove (dfs_find_vbase_instance): Remove. (find_vbase_instance): Remove. (dfs_debug_unmarkedp): Adjust. (dependent_base_p): Remove. (dfs_push_type_decls): Adjust. (dfs_push_decls): Adjust. (dfs_no_overlap_yet): Adjust. (copied_binfo): New function. (original_binfo): New function. (binfo_for_vbase): Remove. Change base class access representation. * java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC. (add_interface_do): Likewise. From-SVN: r63172
2003-02-20 18:51:46 +01:00
result = build_tree_list (access, base);
TREE_VIA_VIRTUAL (result) = virtual_p;
}
return result;
}
cp-tree.def (PTRMEM_CST): New tree node. * cp-tree.def (PTRMEM_CST): New tree node. * cp-tree.h (ptrmem_cst): New type. (lang_type): Remove local_typedecls. (dummy): Increase to 12 bits from 11. (CLASSTYPE_LOCAL_TYPEDECLS): Remove. (PTRMEM_CST_CLASS): New macro. (PTRMEM_CST_MEMBER): Likewise. (current_access_specifier): New variable. (current_class_type): Remove duplicate declaration. (finish_struct): Change prototype. (unreverse_member_declarations): New function. (pushdecl_class_level): Change prototype. (grok_enum_decls): Remove. (fixup_anonymous_union): New function. (grok_x_components): Change prototype. (tsubst_chain): Remove. (finish_member_template_decl): Likewise. (check_explicit_specialization): Fix indentation. (finish_class_definition): Change prototype. (finish_member_class_template): Likewise. (finish_member_declaration): New function. (check_multiple_declarators): Likewise. * class.c (class_stack_node_t): New type. (current_class_base): Remove. (current_class_stack): Change type. (current_access_specifier): New variable. (grow_method): Remove. (check_member_decl_is_same_in_complete_scope): Break out from finish_struct. (make_method_vec): New function. (free_method_vec): Likewise. (add_implicitly_declared_members): Break out from finish_struct_1. (free_method_vecs): New variable. (add_method): Rework for direct use from parser. (handle_using_decl): Watch for NULL_TREE while iterating through CLASSTYPE_METHOD_VEC. (finish_struct_methods): Don't build CLASSTYPE_METHOD_VEC here; just do some error-checking. (warn_hidden): Change iteration through CLASSTYPE_METHOD_VEC. (finish_struct_1): Simplify. Use add_implicitly_declared_members. (finish_struct): Change prototype. Simplify; fields and methods are already set up at this point. (init_class_processing): Set up current_class_stack. (pushclass): Save current_access_specifier. (popclass): Restore it. (currently_open_class): Simplify. (build_self_reference): Remove use of CLASSTYPE_LOCAL_TYPEDECLS. * decl.c (saved_scope): Add access_specifier. (maybe_push_to_top_level): Save it. (pop_from_top_level): Restore it. (maybe_process_template_type_declaration): Use finish_member_declaration. (pushtag): Likewise. (pushdecl_class_level): Don't return a value. (fixup_anonymous_union): Break out from grok_x_components. (shadow_tag): Use it. (xref_tag): Complain about using an elaborated type specifier to reference a template type parameter or typedef name. (xref_basetypes): Don't set CLASSTYPE_LOCAL_TYPEDECLS. (current_local_enum): Remove. (build_enumerator): Call finish_member_declaration. (grok_enum_decls): Remove. * decl2.c (grok_x_components): Simplify. (check_classfn): Change iteration through CLASSTYPE_METHOD_VEC. (grokfield): Don't set CLASSTYPE_LOCAL_TYPEDECLS. (merge_functions): Add to comment. (arg_assoc_type): Prototype. (arg_assoc): Pass as many arguments as there are parameters. * error.c (dump_expr): Handle PTRMEM_CST. Improve handling of OFFSET_REF. * expr.c (cpls_expand_expr): Remove dead code. Handle PTRMEM_CST. * friend.c (do_friend): Lookup friends when in nested classes. Change comments. * init.c (build_offset_ref): Do lookup even for classes that are only partially defined. (decl_constant_value): Remove dead code. * method.c (build_overload_value): Remove hack where by TYPE was not a TYPE. Handle PTRMEM_CST. (build_template_parm_names): Don't pass a PARM_DECL where a TYPE should go. * parse.y (components, notype_components, component_decl, component_decl_1, component_declarator, component_declarator0): Now all are itype rather than ttype. Rework to add members to classes on the fly. (typesqpecqual_reserved): Use check_multiple_declarators. (structsp): Update class to finish_class_definition. (do_xref_defn): Unsplit into named_class_head. (access_specifier): Set current_access_specifier. * pt.c (set_current_access_from_decl): New function. (finish_member_template_decl): Don't take the parameters. (comp_template_args): Make more robust. (lookup_template_class): Don't use current_local_enum. (for_each_template_parm): Handle PTRMEM_CST. (instantiate_class_template): Use set_current_access_from_decl, finish_member_declaration and unreverse_member_declarations. Set lineno/input_filename before generating implicit member functions. (type_unification_real): Don't assume back-unification happens only for the last argument. (regenerate_decl_from_template): Call pushclass a bit earlier. (tsubst_chain): Remove. (tsubst_enum): Use set_current_access_from_decl. (set_mangled_name_for_template_decl): Fix indentation. * search.c (lookup_fnfields_1): Change iteration through CLASSTYPE_METHOD_VEC. (dfs_pushdecls): Likewise. (dfs_compress_decls): Likewise. (add_conversions): Likewise. * semantics.c (finish_class_definition): Don't take components. Change call to finish_struct. (finish_member_declaration): New function. (finish_member_class_template): Don't take template parameters. Change call to grok_x_components. Call finish_member_template_decl. (check_multiple_declarators): New function. * sig.c (append_signature_fields): Work from the TYPE_METHODS, not a passed in fieldlist. * tree.c (search_tree): Handle PTRMEM_CST. (mapcar): Likewise. * typeck.c (unary_complex_lvalue): Build PTRMEM_CSTs, not INTEGER_CSTs, for pointer-to-data members. From-SVN: r22869
1998-10-06 16:20:30 +02:00
/* Called when multiple declarators are processed. If that is not
permitted in this context, an error is issued. */
cp-tree.def (PTRMEM_CST): New tree node. * cp-tree.def (PTRMEM_CST): New tree node. * cp-tree.h (ptrmem_cst): New type. (lang_type): Remove local_typedecls. (dummy): Increase to 12 bits from 11. (CLASSTYPE_LOCAL_TYPEDECLS): Remove. (PTRMEM_CST_CLASS): New macro. (PTRMEM_CST_MEMBER): Likewise. (current_access_specifier): New variable. (current_class_type): Remove duplicate declaration. (finish_struct): Change prototype. (unreverse_member_declarations): New function. (pushdecl_class_level): Change prototype. (grok_enum_decls): Remove. (fixup_anonymous_union): New function. (grok_x_components): Change prototype. (tsubst_chain): Remove. (finish_member_template_decl): Likewise. (check_explicit_specialization): Fix indentation. (finish_class_definition): Change prototype. (finish_member_class_template): Likewise. (finish_member_declaration): New function. (check_multiple_declarators): Likewise. * class.c (class_stack_node_t): New type. (current_class_base): Remove. (current_class_stack): Change type. (current_access_specifier): New variable. (grow_method): Remove. (check_member_decl_is_same_in_complete_scope): Break out from finish_struct. (make_method_vec): New function. (free_method_vec): Likewise. (add_implicitly_declared_members): Break out from finish_struct_1. (free_method_vecs): New variable. (add_method): Rework for direct use from parser. (handle_using_decl): Watch for NULL_TREE while iterating through CLASSTYPE_METHOD_VEC. (finish_struct_methods): Don't build CLASSTYPE_METHOD_VEC here; just do some error-checking. (warn_hidden): Change iteration through CLASSTYPE_METHOD_VEC. (finish_struct_1): Simplify. Use add_implicitly_declared_members. (finish_struct): Change prototype. Simplify; fields and methods are already set up at this point. (init_class_processing): Set up current_class_stack. (pushclass): Save current_access_specifier. (popclass): Restore it. (currently_open_class): Simplify. (build_self_reference): Remove use of CLASSTYPE_LOCAL_TYPEDECLS. * decl.c (saved_scope): Add access_specifier. (maybe_push_to_top_level): Save it. (pop_from_top_level): Restore it. (maybe_process_template_type_declaration): Use finish_member_declaration. (pushtag): Likewise. (pushdecl_class_level): Don't return a value. (fixup_anonymous_union): Break out from grok_x_components. (shadow_tag): Use it. (xref_tag): Complain about using an elaborated type specifier to reference a template type parameter or typedef name. (xref_basetypes): Don't set CLASSTYPE_LOCAL_TYPEDECLS. (current_local_enum): Remove. (build_enumerator): Call finish_member_declaration. (grok_enum_decls): Remove. * decl2.c (grok_x_components): Simplify. (check_classfn): Change iteration through CLASSTYPE_METHOD_VEC. (grokfield): Don't set CLASSTYPE_LOCAL_TYPEDECLS. (merge_functions): Add to comment. (arg_assoc_type): Prototype. (arg_assoc): Pass as many arguments as there are parameters. * error.c (dump_expr): Handle PTRMEM_CST. Improve handling of OFFSET_REF. * expr.c (cpls_expand_expr): Remove dead code. Handle PTRMEM_CST. * friend.c (do_friend): Lookup friends when in nested classes. Change comments. * init.c (build_offset_ref): Do lookup even for classes that are only partially defined. (decl_constant_value): Remove dead code. * method.c (build_overload_value): Remove hack where by TYPE was not a TYPE. Handle PTRMEM_CST. (build_template_parm_names): Don't pass a PARM_DECL where a TYPE should go. * parse.y (components, notype_components, component_decl, component_decl_1, component_declarator, component_declarator0): Now all are itype rather than ttype. Rework to add members to classes on the fly. (typesqpecqual_reserved): Use check_multiple_declarators. (structsp): Update class to finish_class_definition. (do_xref_defn): Unsplit into named_class_head. (access_specifier): Set current_access_specifier. * pt.c (set_current_access_from_decl): New function. (finish_member_template_decl): Don't take the parameters. (comp_template_args): Make more robust. (lookup_template_class): Don't use current_local_enum. (for_each_template_parm): Handle PTRMEM_CST. (instantiate_class_template): Use set_current_access_from_decl, finish_member_declaration and unreverse_member_declarations. Set lineno/input_filename before generating implicit member functions. (type_unification_real): Don't assume back-unification happens only for the last argument. (regenerate_decl_from_template): Call pushclass a bit earlier. (tsubst_chain): Remove. (tsubst_enum): Use set_current_access_from_decl. (set_mangled_name_for_template_decl): Fix indentation. * search.c (lookup_fnfields_1): Change iteration through CLASSTYPE_METHOD_VEC. (dfs_pushdecls): Likewise. (dfs_compress_decls): Likewise. (add_conversions): Likewise. * semantics.c (finish_class_definition): Don't take components. Change call to finish_struct. (finish_member_declaration): New function. (finish_member_class_template): Don't take template parameters. Change call to grok_x_components. Call finish_member_template_decl. (check_multiple_declarators): New function. * sig.c (append_signature_fields): Work from the TYPE_METHODS, not a passed in fieldlist. * tree.c (search_tree): Handle PTRMEM_CST. (mapcar): Likewise. * typeck.c (unary_complex_lvalue): Build PTRMEM_CSTs, not INTEGER_CSTs, for pointer-to-data members. From-SVN: r22869
1998-10-06 16:20:30 +02:00
void
check_multiple_declarators (void)
cp-tree.def (PTRMEM_CST): New tree node. * cp-tree.def (PTRMEM_CST): New tree node. * cp-tree.h (ptrmem_cst): New type. (lang_type): Remove local_typedecls. (dummy): Increase to 12 bits from 11. (CLASSTYPE_LOCAL_TYPEDECLS): Remove. (PTRMEM_CST_CLASS): New macro. (PTRMEM_CST_MEMBER): Likewise. (current_access_specifier): New variable. (current_class_type): Remove duplicate declaration. (finish_struct): Change prototype. (unreverse_member_declarations): New function. (pushdecl_class_level): Change prototype. (grok_enum_decls): Remove. (fixup_anonymous_union): New function. (grok_x_components): Change prototype. (tsubst_chain): Remove. (finish_member_template_decl): Likewise. (check_explicit_specialization): Fix indentation. (finish_class_definition): Change prototype. (finish_member_class_template): Likewise. (finish_member_declaration): New function. (check_multiple_declarators): Likewise. * class.c (class_stack_node_t): New type. (current_class_base): Remove. (current_class_stack): Change type. (current_access_specifier): New variable. (grow_method): Remove. (check_member_decl_is_same_in_complete_scope): Break out from finish_struct. (make_method_vec): New function. (free_method_vec): Likewise. (add_implicitly_declared_members): Break out from finish_struct_1. (free_method_vecs): New variable. (add_method): Rework for direct use from parser. (handle_using_decl): Watch for NULL_TREE while iterating through CLASSTYPE_METHOD_VEC. (finish_struct_methods): Don't build CLASSTYPE_METHOD_VEC here; just do some error-checking. (warn_hidden): Change iteration through CLASSTYPE_METHOD_VEC. (finish_struct_1): Simplify. Use add_implicitly_declared_members. (finish_struct): Change prototype. Simplify; fields and methods are already set up at this point. (init_class_processing): Set up current_class_stack. (pushclass): Save current_access_specifier. (popclass): Restore it. (currently_open_class): Simplify. (build_self_reference): Remove use of CLASSTYPE_LOCAL_TYPEDECLS. * decl.c (saved_scope): Add access_specifier. (maybe_push_to_top_level): Save it. (pop_from_top_level): Restore it. (maybe_process_template_type_declaration): Use finish_member_declaration. (pushtag): Likewise. (pushdecl_class_level): Don't return a value. (fixup_anonymous_union): Break out from grok_x_components. (shadow_tag): Use it. (xref_tag): Complain about using an elaborated type specifier to reference a template type parameter or typedef name. (xref_basetypes): Don't set CLASSTYPE_LOCAL_TYPEDECLS. (current_local_enum): Remove. (build_enumerator): Call finish_member_declaration. (grok_enum_decls): Remove. * decl2.c (grok_x_components): Simplify. (check_classfn): Change iteration through CLASSTYPE_METHOD_VEC. (grokfield): Don't set CLASSTYPE_LOCAL_TYPEDECLS. (merge_functions): Add to comment. (arg_assoc_type): Prototype. (arg_assoc): Pass as many arguments as there are parameters. * error.c (dump_expr): Handle PTRMEM_CST. Improve handling of OFFSET_REF. * expr.c (cpls_expand_expr): Remove dead code. Handle PTRMEM_CST. * friend.c (do_friend): Lookup friends when in nested classes. Change comments. * init.c (build_offset_ref): Do lookup even for classes that are only partially defined. (decl_constant_value): Remove dead code. * method.c (build_overload_value): Remove hack where by TYPE was not a TYPE. Handle PTRMEM_CST. (build_template_parm_names): Don't pass a PARM_DECL where a TYPE should go. * parse.y (components, notype_components, component_decl, component_decl_1, component_declarator, component_declarator0): Now all are itype rather than ttype. Rework to add members to classes on the fly. (typesqpecqual_reserved): Use check_multiple_declarators. (structsp): Update class to finish_class_definition. (do_xref_defn): Unsplit into named_class_head. (access_specifier): Set current_access_specifier. * pt.c (set_current_access_from_decl): New function. (finish_member_template_decl): Don't take the parameters. (comp_template_args): Make more robust. (lookup_template_class): Don't use current_local_enum. (for_each_template_parm): Handle PTRMEM_CST. (instantiate_class_template): Use set_current_access_from_decl, finish_member_declaration and unreverse_member_declarations. Set lineno/input_filename before generating implicit member functions. (type_unification_real): Don't assume back-unification happens only for the last argument. (regenerate_decl_from_template): Call pushclass a bit earlier. (tsubst_chain): Remove. (tsubst_enum): Use set_current_access_from_decl. (set_mangled_name_for_template_decl): Fix indentation. * search.c (lookup_fnfields_1): Change iteration through CLASSTYPE_METHOD_VEC. (dfs_pushdecls): Likewise. (dfs_compress_decls): Likewise. (add_conversions): Likewise. * semantics.c (finish_class_definition): Don't take components. Change call to finish_struct. (finish_member_declaration): New function. (finish_member_class_template): Don't take template parameters. Change call to grok_x_components. Call finish_member_template_decl. (check_multiple_declarators): New function. * sig.c (append_signature_fields): Work from the TYPE_METHODS, not a passed in fieldlist. * tree.c (search_tree): Handle PTRMEM_CST. (mapcar): Likewise. * typeck.c (unary_complex_lvalue): Build PTRMEM_CSTs, not INTEGER_CSTs, for pointer-to-data members. From-SVN: r22869
1998-10-06 16:20:30 +02:00
{
/* [temp]
In a template-declaration, explicit specialization, or explicit
instantiation the init-declarator-list in the declaration shall
contain at most one declarator.
We don't just use PROCESSING_TEMPLATE_DECL for the first
condition since that would disallow the perfectly valid code,
cp-tree.def (PTRMEM_CST): New tree node. * cp-tree.def (PTRMEM_CST): New tree node. * cp-tree.h (ptrmem_cst): New type. (lang_type): Remove local_typedecls. (dummy): Increase to 12 bits from 11. (CLASSTYPE_LOCAL_TYPEDECLS): Remove. (PTRMEM_CST_CLASS): New macro. (PTRMEM_CST_MEMBER): Likewise. (current_access_specifier): New variable. (current_class_type): Remove duplicate declaration. (finish_struct): Change prototype. (unreverse_member_declarations): New function. (pushdecl_class_level): Change prototype. (grok_enum_decls): Remove. (fixup_anonymous_union): New function. (grok_x_components): Change prototype. (tsubst_chain): Remove. (finish_member_template_decl): Likewise. (check_explicit_specialization): Fix indentation. (finish_class_definition): Change prototype. (finish_member_class_template): Likewise. (finish_member_declaration): New function. (check_multiple_declarators): Likewise. * class.c (class_stack_node_t): New type. (current_class_base): Remove. (current_class_stack): Change type. (current_access_specifier): New variable. (grow_method): Remove. (check_member_decl_is_same_in_complete_scope): Break out from finish_struct. (make_method_vec): New function. (free_method_vec): Likewise. (add_implicitly_declared_members): Break out from finish_struct_1. (free_method_vecs): New variable. (add_method): Rework for direct use from parser. (handle_using_decl): Watch for NULL_TREE while iterating through CLASSTYPE_METHOD_VEC. (finish_struct_methods): Don't build CLASSTYPE_METHOD_VEC here; just do some error-checking. (warn_hidden): Change iteration through CLASSTYPE_METHOD_VEC. (finish_struct_1): Simplify. Use add_implicitly_declared_members. (finish_struct): Change prototype. Simplify; fields and methods are already set up at this point. (init_class_processing): Set up current_class_stack. (pushclass): Save current_access_specifier. (popclass): Restore it. (currently_open_class): Simplify. (build_self_reference): Remove use of CLASSTYPE_LOCAL_TYPEDECLS. * decl.c (saved_scope): Add access_specifier. (maybe_push_to_top_level): Save it. (pop_from_top_level): Restore it. (maybe_process_template_type_declaration): Use finish_member_declaration. (pushtag): Likewise. (pushdecl_class_level): Don't return a value. (fixup_anonymous_union): Break out from grok_x_components. (shadow_tag): Use it. (xref_tag): Complain about using an elaborated type specifier to reference a template type parameter or typedef name. (xref_basetypes): Don't set CLASSTYPE_LOCAL_TYPEDECLS. (current_local_enum): Remove. (build_enumerator): Call finish_member_declaration. (grok_enum_decls): Remove. * decl2.c (grok_x_components): Simplify. (check_classfn): Change iteration through CLASSTYPE_METHOD_VEC. (grokfield): Don't set CLASSTYPE_LOCAL_TYPEDECLS. (merge_functions): Add to comment. (arg_assoc_type): Prototype. (arg_assoc): Pass as many arguments as there are parameters. * error.c (dump_expr): Handle PTRMEM_CST. Improve handling of OFFSET_REF. * expr.c (cpls_expand_expr): Remove dead code. Handle PTRMEM_CST. * friend.c (do_friend): Lookup friends when in nested classes. Change comments. * init.c (build_offset_ref): Do lookup even for classes that are only partially defined. (decl_constant_value): Remove dead code. * method.c (build_overload_value): Remove hack where by TYPE was not a TYPE. Handle PTRMEM_CST. (build_template_parm_names): Don't pass a PARM_DECL where a TYPE should go. * parse.y (components, notype_components, component_decl, component_decl_1, component_declarator, component_declarator0): Now all are itype rather than ttype. Rework to add members to classes on the fly. (typesqpecqual_reserved): Use check_multiple_declarators. (structsp): Update class to finish_class_definition. (do_xref_defn): Unsplit into named_class_head. (access_specifier): Set current_access_specifier. * pt.c (set_current_access_from_decl): New function. (finish_member_template_decl): Don't take the parameters. (comp_template_args): Make more robust. (lookup_template_class): Don't use current_local_enum. (for_each_template_parm): Handle PTRMEM_CST. (instantiate_class_template): Use set_current_access_from_decl, finish_member_declaration and unreverse_member_declarations. Set lineno/input_filename before generating implicit member functions. (type_unification_real): Don't assume back-unification happens only for the last argument. (regenerate_decl_from_template): Call pushclass a bit earlier. (tsubst_chain): Remove. (tsubst_enum): Use set_current_access_from_decl. (set_mangled_name_for_template_decl): Fix indentation. * search.c (lookup_fnfields_1): Change iteration through CLASSTYPE_METHOD_VEC. (dfs_pushdecls): Likewise. (dfs_compress_decls): Likewise. (add_conversions): Likewise. * semantics.c (finish_class_definition): Don't take components. Change call to finish_struct. (finish_member_declaration): New function. (finish_member_class_template): Don't take template parameters. Change call to grok_x_components. Call finish_member_template_decl. (check_multiple_declarators): New function. * sig.c (append_signature_fields): Work from the TYPE_METHODS, not a passed in fieldlist. * tree.c (search_tree): Handle PTRMEM_CST. (mapcar): Likewise. * typeck.c (unary_complex_lvalue): Build PTRMEM_CSTs, not INTEGER_CSTs, for pointer-to-data members. From-SVN: r22869
1998-10-06 16:20:30 +02:00
like `template <class T> struct S { int i, j; };'. */
if (at_function_scope_p ())
cp-tree.def (PTRMEM_CST): New tree node. * cp-tree.def (PTRMEM_CST): New tree node. * cp-tree.h (ptrmem_cst): New type. (lang_type): Remove local_typedecls. (dummy): Increase to 12 bits from 11. (CLASSTYPE_LOCAL_TYPEDECLS): Remove. (PTRMEM_CST_CLASS): New macro. (PTRMEM_CST_MEMBER): Likewise. (current_access_specifier): New variable. (current_class_type): Remove duplicate declaration. (finish_struct): Change prototype. (unreverse_member_declarations): New function. (pushdecl_class_level): Change prototype. (grok_enum_decls): Remove. (fixup_anonymous_union): New function. (grok_x_components): Change prototype. (tsubst_chain): Remove. (finish_member_template_decl): Likewise. (check_explicit_specialization): Fix indentation. (finish_class_definition): Change prototype. (finish_member_class_template): Likewise. (finish_member_declaration): New function. (check_multiple_declarators): Likewise. * class.c (class_stack_node_t): New type. (current_class_base): Remove. (current_class_stack): Change type. (current_access_specifier): New variable. (grow_method): Remove. (check_member_decl_is_same_in_complete_scope): Break out from finish_struct. (make_method_vec): New function. (free_method_vec): Likewise. (add_implicitly_declared_members): Break out from finish_struct_1. (free_method_vecs): New variable. (add_method): Rework for direct use from parser. (handle_using_decl): Watch for NULL_TREE while iterating through CLASSTYPE_METHOD_VEC. (finish_struct_methods): Don't build CLASSTYPE_METHOD_VEC here; just do some error-checking. (warn_hidden): Change iteration through CLASSTYPE_METHOD_VEC. (finish_struct_1): Simplify. Use add_implicitly_declared_members. (finish_struct): Change prototype. Simplify; fields and methods are already set up at this point. (init_class_processing): Set up current_class_stack. (pushclass): Save current_access_specifier. (popclass): Restore it. (currently_open_class): Simplify. (build_self_reference): Remove use of CLASSTYPE_LOCAL_TYPEDECLS. * decl.c (saved_scope): Add access_specifier. (maybe_push_to_top_level): Save it. (pop_from_top_level): Restore it. (maybe_process_template_type_declaration): Use finish_member_declaration. (pushtag): Likewise. (pushdecl_class_level): Don't return a value. (fixup_anonymous_union): Break out from grok_x_components. (shadow_tag): Use it. (xref_tag): Complain about using an elaborated type specifier to reference a template type parameter or typedef name. (xref_basetypes): Don't set CLASSTYPE_LOCAL_TYPEDECLS. (current_local_enum): Remove. (build_enumerator): Call finish_member_declaration. (grok_enum_decls): Remove. * decl2.c (grok_x_components): Simplify. (check_classfn): Change iteration through CLASSTYPE_METHOD_VEC. (grokfield): Don't set CLASSTYPE_LOCAL_TYPEDECLS. (merge_functions): Add to comment. (arg_assoc_type): Prototype. (arg_assoc): Pass as many arguments as there are parameters. * error.c (dump_expr): Handle PTRMEM_CST. Improve handling of OFFSET_REF. * expr.c (cpls_expand_expr): Remove dead code. Handle PTRMEM_CST. * friend.c (do_friend): Lookup friends when in nested classes. Change comments. * init.c (build_offset_ref): Do lookup even for classes that are only partially defined. (decl_constant_value): Remove dead code. * method.c (build_overload_value): Remove hack where by TYPE was not a TYPE. Handle PTRMEM_CST. (build_template_parm_names): Don't pass a PARM_DECL where a TYPE should go. * parse.y (components, notype_components, component_decl, component_decl_1, component_declarator, component_declarator0): Now all are itype rather than ttype. Rework to add members to classes on the fly. (typesqpecqual_reserved): Use check_multiple_declarators. (structsp): Update class to finish_class_definition. (do_xref_defn): Unsplit into named_class_head. (access_specifier): Set current_access_specifier. * pt.c (set_current_access_from_decl): New function. (finish_member_template_decl): Don't take the parameters. (comp_template_args): Make more robust. (lookup_template_class): Don't use current_local_enum. (for_each_template_parm): Handle PTRMEM_CST. (instantiate_class_template): Use set_current_access_from_decl, finish_member_declaration and unreverse_member_declarations. Set lineno/input_filename before generating implicit member functions. (type_unification_real): Don't assume back-unification happens only for the last argument. (regenerate_decl_from_template): Call pushclass a bit earlier. (tsubst_chain): Remove. (tsubst_enum): Use set_current_access_from_decl. (set_mangled_name_for_template_decl): Fix indentation. * search.c (lookup_fnfields_1): Change iteration through CLASSTYPE_METHOD_VEC. (dfs_pushdecls): Likewise. (dfs_compress_decls): Likewise. (add_conversions): Likewise. * semantics.c (finish_class_definition): Don't take components. Change call to finish_struct. (finish_member_declaration): New function. (finish_member_class_template): Don't take template parameters. Change call to grok_x_components. Call finish_member_template_decl. (check_multiple_declarators): New function. * sig.c (append_signature_fields): Work from the TYPE_METHODS, not a passed in fieldlist. * tree.c (search_tree): Handle PTRMEM_CST. (mapcar): Likewise. * typeck.c (unary_complex_lvalue): Build PTRMEM_CSTs, not INTEGER_CSTs, for pointer-to-data members. From-SVN: r22869
1998-10-06 16:20:30 +02:00
/* It's OK to write `template <class T> void f() { int i, j;}'. */
return;
if (PROCESSING_REAL_TEMPLATE_DECL_P ()
|| processing_explicit_instantiation
|| processing_specialization)
error ("multiple declarators in template declaration");
cp-tree.def (PTRMEM_CST): New tree node. * cp-tree.def (PTRMEM_CST): New tree node. * cp-tree.h (ptrmem_cst): New type. (lang_type): Remove local_typedecls. (dummy): Increase to 12 bits from 11. (CLASSTYPE_LOCAL_TYPEDECLS): Remove. (PTRMEM_CST_CLASS): New macro. (PTRMEM_CST_MEMBER): Likewise. (current_access_specifier): New variable. (current_class_type): Remove duplicate declaration. (finish_struct): Change prototype. (unreverse_member_declarations): New function. (pushdecl_class_level): Change prototype. (grok_enum_decls): Remove. (fixup_anonymous_union): New function. (grok_x_components): Change prototype. (tsubst_chain): Remove. (finish_member_template_decl): Likewise. (check_explicit_specialization): Fix indentation. (finish_class_definition): Change prototype. (finish_member_class_template): Likewise. (finish_member_declaration): New function. (check_multiple_declarators): Likewise. * class.c (class_stack_node_t): New type. (current_class_base): Remove. (current_class_stack): Change type. (current_access_specifier): New variable. (grow_method): Remove. (check_member_decl_is_same_in_complete_scope): Break out from finish_struct. (make_method_vec): New function. (free_method_vec): Likewise. (add_implicitly_declared_members): Break out from finish_struct_1. (free_method_vecs): New variable. (add_method): Rework for direct use from parser. (handle_using_decl): Watch for NULL_TREE while iterating through CLASSTYPE_METHOD_VEC. (finish_struct_methods): Don't build CLASSTYPE_METHOD_VEC here; just do some error-checking. (warn_hidden): Change iteration through CLASSTYPE_METHOD_VEC. (finish_struct_1): Simplify. Use add_implicitly_declared_members. (finish_struct): Change prototype. Simplify; fields and methods are already set up at this point. (init_class_processing): Set up current_class_stack. (pushclass): Save current_access_specifier. (popclass): Restore it. (currently_open_class): Simplify. (build_self_reference): Remove use of CLASSTYPE_LOCAL_TYPEDECLS. * decl.c (saved_scope): Add access_specifier. (maybe_push_to_top_level): Save it. (pop_from_top_level): Restore it. (maybe_process_template_type_declaration): Use finish_member_declaration. (pushtag): Likewise. (pushdecl_class_level): Don't return a value. (fixup_anonymous_union): Break out from grok_x_components. (shadow_tag): Use it. (xref_tag): Complain about using an elaborated type specifier to reference a template type parameter or typedef name. (xref_basetypes): Don't set CLASSTYPE_LOCAL_TYPEDECLS. (current_local_enum): Remove. (build_enumerator): Call finish_member_declaration. (grok_enum_decls): Remove. * decl2.c (grok_x_components): Simplify. (check_classfn): Change iteration through CLASSTYPE_METHOD_VEC. (grokfield): Don't set CLASSTYPE_LOCAL_TYPEDECLS. (merge_functions): Add to comment. (arg_assoc_type): Prototype. (arg_assoc): Pass as many arguments as there are parameters. * error.c (dump_expr): Handle PTRMEM_CST. Improve handling of OFFSET_REF. * expr.c (cpls_expand_expr): Remove dead code. Handle PTRMEM_CST. * friend.c (do_friend): Lookup friends when in nested classes. Change comments. * init.c (build_offset_ref): Do lookup even for classes that are only partially defined. (decl_constant_value): Remove dead code. * method.c (build_overload_value): Remove hack where by TYPE was not a TYPE. Handle PTRMEM_CST. (build_template_parm_names): Don't pass a PARM_DECL where a TYPE should go. * parse.y (components, notype_components, component_decl, component_decl_1, component_declarator, component_declarator0): Now all are itype rather than ttype. Rework to add members to classes on the fly. (typesqpecqual_reserved): Use check_multiple_declarators. (structsp): Update class to finish_class_definition. (do_xref_defn): Unsplit into named_class_head. (access_specifier): Set current_access_specifier. * pt.c (set_current_access_from_decl): New function. (finish_member_template_decl): Don't take the parameters. (comp_template_args): Make more robust. (lookup_template_class): Don't use current_local_enum. (for_each_template_parm): Handle PTRMEM_CST. (instantiate_class_template): Use set_current_access_from_decl, finish_member_declaration and unreverse_member_declarations. Set lineno/input_filename before generating implicit member functions. (type_unification_real): Don't assume back-unification happens only for the last argument. (regenerate_decl_from_template): Call pushclass a bit earlier. (tsubst_chain): Remove. (tsubst_enum): Use set_current_access_from_decl. (set_mangled_name_for_template_decl): Fix indentation. * search.c (lookup_fnfields_1): Change iteration through CLASSTYPE_METHOD_VEC. (dfs_pushdecls): Likewise. (dfs_compress_decls): Likewise. (add_conversions): Likewise. * semantics.c (finish_class_definition): Don't take components. Change call to finish_struct. (finish_member_declaration): New function. (finish_member_class_template): Don't take template parameters. Change call to grok_x_components. Call finish_member_template_decl. (check_multiple_declarators): New function. * sig.c (append_signature_fields): Work from the TYPE_METHODS, not a passed in fieldlist. * tree.c (search_tree): Handle PTRMEM_CST. (mapcar): Likewise. * typeck.c (unary_complex_lvalue): Build PTRMEM_CSTs, not INTEGER_CSTs, for pointer-to-data members. From-SVN: r22869
1998-10-06 16:20:30 +02:00
}
/* Issue a diagnostic that NAME cannot be found in SCOPE. */
void
qualified_name_lookup_error (tree scope, tree name)
{
if (TYPE_P (scope))
{
if (!COMPLETE_TYPE_P (scope))
error ("incomplete type `%T' used in nested name specifier", scope);
else
error ("`%D' is not a member of `%T'", name, scope);
}
else if (scope != global_namespace)
error ("`%D' is not a member of `%D'", name, scope);
else
error ("`::%D' has not been declared", name);
}
re PR c++/11493 (tree check ICE in error.c) * cp-tree.h (cp_id_kind): New type. (unqualified_name_lookup_error): Change prototype. (unqualified_fn_lookup_error): New function. (do_identifier): Remove. (do_scoped_id): Likewise. (tsubst_copy_and_build): Change prototype. (reregister_specialization): New function. (perform_koenig_lookup): Likewise. (finish_id_expression): Likewise. * call.c (build_method_call): Adjust call to unqualified_name_lookup_error. * decl.c (duplicate_decls): Use reregister_specialization. * lex.c (is_global): Remove. (unqualified_name_lookup_error): Return a value. (do_identifier): Remove. (do_scoped_id): Likewise. (identifier_typedecl_value): Remove. (unqualified_fn_lookup_error): New function. * parser.c (cp_parser_id_kind): Remove. (cp_parser_non_constant_id_expression): Remove. (cp_parser_primary_expression): Use finish_id_expression. (cp_parser_class_or_namespace_name): Use cp_id_kind, not cp_parser_id_kind. (cp_parser_postfix_expression): Use perform_koenig_lookup. (cp_parser_template_argument): Use cp_id_kind. (cp_parser_fold_non_dependent_expr): Adjust call to tsubst_copy_and_build. * pt.c (unregister_specialization): Rename to ... (reregister_specialization): This. (tsubst_friend_function): Use it. (maybe_fold_nontype_arg): Adjust call to tsubst_copy_and_build. (tsubst_qualified_id): Likewise. (tsubst_expr): Likewise. (tsubst_copy_and_build): Add function_p parameter. Use finish_id_expression. Introduce RECUR macro. (tsubst_non_call_postfix_expression): New function. (regenerate_decl_from_template): Use reregister_specialization. * semantics.c (perform_koenig_lookup): New function. (finish_id_expression): Likewise. PR c++/11493 PR c++/11495 * g++.dg/parse/template9.C: Likewise. * g++.dg/template/crash4.C: New test. * g++.dg/template/koenig1.C: Likewise. * g++.old-deja/g++.benjamin/tem03.C: Adjust error markers. * g++.old-deja/g++.benjamin/tem06.C: Declare "x". * g++.old-deja/g++.jason/overload33.C: Use this-> when calling functions. * g++.old-deja/g++.jason/template36.C: Likewise. * g++.old-deja/g++.mike/p1989.C: Likewise. * g++.old-deja/g++.pt/lookup2.C: Use -fpermissive when compiling. * g++.old-deja/g++.pt/ttp20.C: Use this->. * g++.old-deja/g++.pt/ttp21.C: Use this->. * g++.old-deja/g++.pt/typename13.C: Use -fpermissive when compiling. * g++.old-deja/g++.pt/union2.C: Use this->. From-SVN: r69316
2003-07-14 05:04:29 +02:00
/* ID_EXPRESSION is a representation of parsed, but unprocessed,
id-expression. (See cp_parser_id_expression for details.) SCOPE,
if non-NULL, is the type or namespace used to explicitly qualify
ID_EXPRESSION. DECL is the entity to which that name has been
resolved.
*CONSTANT_EXPRESSION_P is true if we are presently parsing a
constant-expression. In that case, *NON_CONSTANT_EXPRESSION_P will
be set to true if this expression isn't permitted in a
constant-expression, but it is otherwise not set by this function.
*ALLOW_NON_CONSTANT_EXPRESSION_P is true if we are parsing a
constant-expression, but a non-constant expression is also
permissible.
If an error occurs, and it is the kind of error that might cause
the parser to abort a tentative parse, *ERROR_MSG is filled in. It
is the caller's responsibility to issue the message. *ERROR_MSG
will be a string with static storage duration, so the caller need
not "free" it.
Return an expression for the entity, after issuing appropriate
diagnostics. This function is also responsible for transforming a
reference to a non-static member into a COMPONENT_REF that makes
the use of "this" explicit.
Upon return, *IDK will be filled in appropriately. */
tree
finish_id_expression (tree id_expression,
tree decl,
tree scope,
cp_id_kind *idk,
tree *qualifying_class,
bool constant_expression_p,
bool allow_non_constant_expression_p,
bool *non_constant_expression_p,
const char **error_msg)
{
/* Initialize the output parameters. */
*idk = CP_ID_KIND_NONE;
*error_msg = NULL;
if (id_expression == error_mark_node)
return error_mark_node;
/* If we have a template-id, then no further lookup is
required. If the template-id was for a template-class, we
will sometimes have a TYPE_DECL at this point. */
else if (TREE_CODE (decl) == TEMPLATE_ID_EXPR
|| TREE_CODE (decl) == TYPE_DECL)
re PR c++/11493 (tree check ICE in error.c) * cp-tree.h (cp_id_kind): New type. (unqualified_name_lookup_error): Change prototype. (unqualified_fn_lookup_error): New function. (do_identifier): Remove. (do_scoped_id): Likewise. (tsubst_copy_and_build): Change prototype. (reregister_specialization): New function. (perform_koenig_lookup): Likewise. (finish_id_expression): Likewise. * call.c (build_method_call): Adjust call to unqualified_name_lookup_error. * decl.c (duplicate_decls): Use reregister_specialization. * lex.c (is_global): Remove. (unqualified_name_lookup_error): Return a value. (do_identifier): Remove. (do_scoped_id): Likewise. (identifier_typedecl_value): Remove. (unqualified_fn_lookup_error): New function. * parser.c (cp_parser_id_kind): Remove. (cp_parser_non_constant_id_expression): Remove. (cp_parser_primary_expression): Use finish_id_expression. (cp_parser_class_or_namespace_name): Use cp_id_kind, not cp_parser_id_kind. (cp_parser_postfix_expression): Use perform_koenig_lookup. (cp_parser_template_argument): Use cp_id_kind. (cp_parser_fold_non_dependent_expr): Adjust call to tsubst_copy_and_build. * pt.c (unregister_specialization): Rename to ... (reregister_specialization): This. (tsubst_friend_function): Use it. (maybe_fold_nontype_arg): Adjust call to tsubst_copy_and_build. (tsubst_qualified_id): Likewise. (tsubst_expr): Likewise. (tsubst_copy_and_build): Add function_p parameter. Use finish_id_expression. Introduce RECUR macro. (tsubst_non_call_postfix_expression): New function. (regenerate_decl_from_template): Use reregister_specialization. * semantics.c (perform_koenig_lookup): New function. (finish_id_expression): Likewise. PR c++/11493 PR c++/11495 * g++.dg/parse/template9.C: Likewise. * g++.dg/template/crash4.C: New test. * g++.dg/template/koenig1.C: Likewise. * g++.old-deja/g++.benjamin/tem03.C: Adjust error markers. * g++.old-deja/g++.benjamin/tem06.C: Declare "x". * g++.old-deja/g++.jason/overload33.C: Use this-> when calling functions. * g++.old-deja/g++.jason/template36.C: Likewise. * g++.old-deja/g++.mike/p1989.C: Likewise. * g++.old-deja/g++.pt/lookup2.C: Use -fpermissive when compiling. * g++.old-deja/g++.pt/ttp20.C: Use this->. * g++.old-deja/g++.pt/ttp21.C: Use this->. * g++.old-deja/g++.pt/typename13.C: Use -fpermissive when compiling. * g++.old-deja/g++.pt/union2.C: Use this->. From-SVN: r69316
2003-07-14 05:04:29 +02:00
;
/* Look up the name. */
else
{
if (decl == error_mark_node)
{
/* Name lookup failed. */
if (scope && (!TYPE_P (scope) || !dependent_type_p (scope)))
{
/* Qualified name lookup failed, and the qualifying name
was not a dependent type. That is always an
error. */
qualified_name_lookup_error (scope, id_expression);
re PR c++/11493 (tree check ICE in error.c) * cp-tree.h (cp_id_kind): New type. (unqualified_name_lookup_error): Change prototype. (unqualified_fn_lookup_error): New function. (do_identifier): Remove. (do_scoped_id): Likewise. (tsubst_copy_and_build): Change prototype. (reregister_specialization): New function. (perform_koenig_lookup): Likewise. (finish_id_expression): Likewise. * call.c (build_method_call): Adjust call to unqualified_name_lookup_error. * decl.c (duplicate_decls): Use reregister_specialization. * lex.c (is_global): Remove. (unqualified_name_lookup_error): Return a value. (do_identifier): Remove. (do_scoped_id): Likewise. (identifier_typedecl_value): Remove. (unqualified_fn_lookup_error): New function. * parser.c (cp_parser_id_kind): Remove. (cp_parser_non_constant_id_expression): Remove. (cp_parser_primary_expression): Use finish_id_expression. (cp_parser_class_or_namespace_name): Use cp_id_kind, not cp_parser_id_kind. (cp_parser_postfix_expression): Use perform_koenig_lookup. (cp_parser_template_argument): Use cp_id_kind. (cp_parser_fold_non_dependent_expr): Adjust call to tsubst_copy_and_build. * pt.c (unregister_specialization): Rename to ... (reregister_specialization): This. (tsubst_friend_function): Use it. (maybe_fold_nontype_arg): Adjust call to tsubst_copy_and_build. (tsubst_qualified_id): Likewise. (tsubst_expr): Likewise. (tsubst_copy_and_build): Add function_p parameter. Use finish_id_expression. Introduce RECUR macro. (tsubst_non_call_postfix_expression): New function. (regenerate_decl_from_template): Use reregister_specialization. * semantics.c (perform_koenig_lookup): New function. (finish_id_expression): Likewise. PR c++/11493 PR c++/11495 * g++.dg/parse/template9.C: Likewise. * g++.dg/template/crash4.C: New test. * g++.dg/template/koenig1.C: Likewise. * g++.old-deja/g++.benjamin/tem03.C: Adjust error markers. * g++.old-deja/g++.benjamin/tem06.C: Declare "x". * g++.old-deja/g++.jason/overload33.C: Use this-> when calling functions. * g++.old-deja/g++.jason/template36.C: Likewise. * g++.old-deja/g++.mike/p1989.C: Likewise. * g++.old-deja/g++.pt/lookup2.C: Use -fpermissive when compiling. * g++.old-deja/g++.pt/ttp20.C: Use this->. * g++.old-deja/g++.pt/ttp21.C: Use this->. * g++.old-deja/g++.pt/typename13.C: Use -fpermissive when compiling. * g++.old-deja/g++.pt/union2.C: Use this->. From-SVN: r69316
2003-07-14 05:04:29 +02:00
return error_mark_node;
}
else if (!scope)
{
/* It may be resolved via Koenig lookup. */
*idk = CP_ID_KIND_UNQUALIFIED;
return id_expression;
}
}
/* If DECL is a variable that would be out of scope under
ANSI/ISO rules, but in scope in the ARM, name lookup
will succeed. Issue a diagnostic here. */
else
decl = check_for_out_of_scope_variable (decl);
/* Remember that the name was used in the definition of
the current class so that we can check later to see if
the meaning would have been different after the class
was entirely defined. */
if (!scope && decl != error_mark_node)
maybe_note_name_used_in_class (id_expression, decl);
}
/* If we didn't find anything, or what we found was a type,
then this wasn't really an id-expression. */
if (TREE_CODE (decl) == TEMPLATE_DECL
&& !DECL_FUNCTION_TEMPLATE_P (decl))
{
*error_msg = "missing template arguments";
return error_mark_node;
}
else if (TREE_CODE (decl) == TYPE_DECL
|| TREE_CODE (decl) == NAMESPACE_DECL)
{
*error_msg = "expected primary-expression";
return error_mark_node;
}
/* If the name resolved to a template parameter, there is no
need to look it up again later. Similarly, we resolve
enumeration constants to their underlying values. */
if (TREE_CODE (decl) == CONST_DECL)
{
*idk = CP_ID_KIND_NONE;
if (DECL_TEMPLATE_PARM_P (decl) || !processing_template_decl)
return DECL_INITIAL (decl);
return decl;
}
else
{
bool dependent_p;
/* If the declaration was explicitly qualified indicate
that. The semantics of `A::f(3)' are different than
`f(3)' if `f' is virtual. */
*idk = (scope
? CP_ID_KIND_QUALIFIED
: (TREE_CODE (decl) == TEMPLATE_ID_EXPR
? CP_ID_KIND_TEMPLATE_ID
: CP_ID_KIND_UNQUALIFIED));
/* [temp.dep.expr]
An id-expression is type-dependent if it contains an
identifier that was declared with a dependent type.
The standard is not very specific about an id-expression that
names a set of overloaded functions. What if some of them
have dependent types and some of them do not? Presumably,
such a name should be treated as a dependent name. */
/* Assume the name is not dependent. */
dependent_p = false;
if (!processing_template_decl)
/* No names are dependent outside a template. */
;
/* A template-id where the name of the template was not resolved
is definitely dependent. */
else if (TREE_CODE (decl) == TEMPLATE_ID_EXPR
&& (TREE_CODE (TREE_OPERAND (decl, 0))
== IDENTIFIER_NODE))
dependent_p = true;
/* For anything except an overloaded function, just check its
type. */
else if (!is_overloaded_fn (decl))
dependent_p
= dependent_type_p (TREE_TYPE (decl));
/* For a set of overloaded functions, check each of the
functions. */
else
{
tree fns = decl;
if (BASELINK_P (fns))
fns = BASELINK_FUNCTIONS (fns);
/* For a template-id, check to see if the template
arguments are dependent. */
if (TREE_CODE (fns) == TEMPLATE_ID_EXPR)
{
tree args = TREE_OPERAND (fns, 1);
dependent_p = any_dependent_template_arguments_p (args);
/* The functions are those referred to by the
template-id. */
fns = TREE_OPERAND (fns, 0);
}
/* If there are no dependent template arguments, go through
the overloaded functions. */
re PR c++/11493 (tree check ICE in error.c) * cp-tree.h (cp_id_kind): New type. (unqualified_name_lookup_error): Change prototype. (unqualified_fn_lookup_error): New function. (do_identifier): Remove. (do_scoped_id): Likewise. (tsubst_copy_and_build): Change prototype. (reregister_specialization): New function. (perform_koenig_lookup): Likewise. (finish_id_expression): Likewise. * call.c (build_method_call): Adjust call to unqualified_name_lookup_error. * decl.c (duplicate_decls): Use reregister_specialization. * lex.c (is_global): Remove. (unqualified_name_lookup_error): Return a value. (do_identifier): Remove. (do_scoped_id): Likewise. (identifier_typedecl_value): Remove. (unqualified_fn_lookup_error): New function. * parser.c (cp_parser_id_kind): Remove. (cp_parser_non_constant_id_expression): Remove. (cp_parser_primary_expression): Use finish_id_expression. (cp_parser_class_or_namespace_name): Use cp_id_kind, not cp_parser_id_kind. (cp_parser_postfix_expression): Use perform_koenig_lookup. (cp_parser_template_argument): Use cp_id_kind. (cp_parser_fold_non_dependent_expr): Adjust call to tsubst_copy_and_build. * pt.c (unregister_specialization): Rename to ... (reregister_specialization): This. (tsubst_friend_function): Use it. (maybe_fold_nontype_arg): Adjust call to tsubst_copy_and_build. (tsubst_qualified_id): Likewise. (tsubst_expr): Likewise. (tsubst_copy_and_build): Add function_p parameter. Use finish_id_expression. Introduce RECUR macro. (tsubst_non_call_postfix_expression): New function. (regenerate_decl_from_template): Use reregister_specialization. * semantics.c (perform_koenig_lookup): New function. (finish_id_expression): Likewise. PR c++/11493 PR c++/11495 * g++.dg/parse/template9.C: Likewise. * g++.dg/template/crash4.C: New test. * g++.dg/template/koenig1.C: Likewise. * g++.old-deja/g++.benjamin/tem03.C: Adjust error markers. * g++.old-deja/g++.benjamin/tem06.C: Declare "x". * g++.old-deja/g++.jason/overload33.C: Use this-> when calling functions. * g++.old-deja/g++.jason/template36.C: Likewise. * g++.old-deja/g++.mike/p1989.C: Likewise. * g++.old-deja/g++.pt/lookup2.C: Use -fpermissive when compiling. * g++.old-deja/g++.pt/ttp20.C: Use this->. * g++.old-deja/g++.pt/ttp21.C: Use this->. * g++.old-deja/g++.pt/typename13.C: Use -fpermissive when compiling. * g++.old-deja/g++.pt/union2.C: Use this->. From-SVN: r69316
2003-07-14 05:04:29 +02:00
while (fns && !dependent_p)
{
tree fn = OVL_CURRENT (fns);
/* Member functions of dependent classes are
dependent. */
if (TREE_CODE (fn) == FUNCTION_DECL
&& type_dependent_expression_p (fn))
dependent_p = true;
else if (TREE_CODE (fn) == TEMPLATE_DECL
&& dependent_template_p (fn))
dependent_p = true;
fns = OVL_NEXT (fns);
}
}
/* If the name was dependent on a template parameter, we will
resolve the name at instantiation time. */
if (dependent_p)
{
/* Create a SCOPE_REF for qualified names, if the scope is
dependent. */
if (scope)
{
if (TYPE_P (scope))
*qualifying_class = scope;
/* Since this name was dependent, the expression isn't
constant -- yet. No error is issued because it might
be constant when things are instantiated. */
if (constant_expression_p)
*non_constant_expression_p = true;
if (TYPE_P (scope) && dependent_type_p (scope))
return build_nt (SCOPE_REF, scope, id_expression);
else if (TYPE_P (scope) && DECL_P (decl))
return build (SCOPE_REF, TREE_TYPE (decl), scope,
id_expression);
else
return decl;
}
/* A TEMPLATE_ID already contains all the information we
need. */
if (TREE_CODE (id_expression) == TEMPLATE_ID_EXPR)
return id_expression;
/* Since this name was dependent, the expression isn't
constant -- yet. No error is issued because it might be
constant when things are instantiated. */
if (constant_expression_p)
*non_constant_expression_p = true;
*idk = CP_ID_KIND_UNQUALIFIED_DEPENDENT;
return id_expression;
re PR c++/11493 (tree check ICE in error.c) * cp-tree.h (cp_id_kind): New type. (unqualified_name_lookup_error): Change prototype. (unqualified_fn_lookup_error): New function. (do_identifier): Remove. (do_scoped_id): Likewise. (tsubst_copy_and_build): Change prototype. (reregister_specialization): New function. (perform_koenig_lookup): Likewise. (finish_id_expression): Likewise. * call.c (build_method_call): Adjust call to unqualified_name_lookup_error. * decl.c (duplicate_decls): Use reregister_specialization. * lex.c (is_global): Remove. (unqualified_name_lookup_error): Return a value. (do_identifier): Remove. (do_scoped_id): Likewise. (identifier_typedecl_value): Remove. (unqualified_fn_lookup_error): New function. * parser.c (cp_parser_id_kind): Remove. (cp_parser_non_constant_id_expression): Remove. (cp_parser_primary_expression): Use finish_id_expression. (cp_parser_class_or_namespace_name): Use cp_id_kind, not cp_parser_id_kind. (cp_parser_postfix_expression): Use perform_koenig_lookup. (cp_parser_template_argument): Use cp_id_kind. (cp_parser_fold_non_dependent_expr): Adjust call to tsubst_copy_and_build. * pt.c (unregister_specialization): Rename to ... (reregister_specialization): This. (tsubst_friend_function): Use it. (maybe_fold_nontype_arg): Adjust call to tsubst_copy_and_build. (tsubst_qualified_id): Likewise. (tsubst_expr): Likewise. (tsubst_copy_and_build): Add function_p parameter. Use finish_id_expression. Introduce RECUR macro. (tsubst_non_call_postfix_expression): New function. (regenerate_decl_from_template): Use reregister_specialization. * semantics.c (perform_koenig_lookup): New function. (finish_id_expression): Likewise. PR c++/11493 PR c++/11495 * g++.dg/parse/template9.C: Likewise. * g++.dg/template/crash4.C: New test. * g++.dg/template/koenig1.C: Likewise. * g++.old-deja/g++.benjamin/tem03.C: Adjust error markers. * g++.old-deja/g++.benjamin/tem06.C: Declare "x". * g++.old-deja/g++.jason/overload33.C: Use this-> when calling functions. * g++.old-deja/g++.jason/template36.C: Likewise. * g++.old-deja/g++.mike/p1989.C: Likewise. * g++.old-deja/g++.pt/lookup2.C: Use -fpermissive when compiling. * g++.old-deja/g++.pt/ttp20.C: Use this->. * g++.old-deja/g++.pt/ttp21.C: Use this->. * g++.old-deja/g++.pt/typename13.C: Use -fpermissive when compiling. * g++.old-deja/g++.pt/union2.C: Use this->. From-SVN: r69316
2003-07-14 05:04:29 +02:00
}
/* Only certain kinds of names are allowed in constant
expression. Enumerators have already been handled above. */
if (constant_expression_p)
{
/* Non-type template parameters of integral or enumeration
type are OK. */
if (TREE_CODE (decl) == TEMPLATE_PARM_INDEX
&& INTEGRAL_OR_ENUMERATION_TYPE_P (TREE_TYPE (decl)))
;
/* Const variables or static data members of integral or
enumeration types initialized with constant expressions
re PR c++/11547 (ICE with const temporaries) PR c++/11547 * cp-tree.h (DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P): New macro. (DECL_PRETTY_FUNCTION_P): Use VAR_DECL_CHECK. * decl.c (duplicate_decls): Merge DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P. * parser.c (cp_parser_postfix_expression): Adjust call to cp_parser_initializer_list and cp_parser_parenthesized_expression_list. (cp_parser_parenthesized_expression_list): Add non_constant_p. (cp_parser_new_placement): Adjust call to cp_parser_parenthesized_expression_list. (cp_parser_direct_new_declarator): Likewise. (cp_parser_conditional_expression): Remove. (cp_parser_constant_expression): Parse an assignment-expression, not a conditional-expression. (cp_parser_simple_declaration): Resolve expression/declaration ambiguity more quickly. (cp_parser_mem_initializer): Adjust call to cp_parser_parenthesized_expression_list. (cp_parser_init_declarator): Keep track of whether or not the initializer is a constant-expression. (cp_parser_initializer): Add non_constant_p parameter. (cp_parser_initializer_clause): Likewise. (cp_parser_initializer_list): Likewise. (cp_parser_attribute_list): Adjust call to cp_parser_parenthesized_expression_list. (cp_parser_functional_cast): Likewise. * pt.c (tsubst_decl): Copy DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P. (tsubst_expr): Tweak use of DECL_PRETTY_FUNCTION_P. * semantics.c (finish_id_expression): Use DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P. PR c++/11547 * g++.dg/parse/constant3.C: New test. * g++.dg/parse/crash7.C: Likewise. From-SVN: r69493
2003-07-17 06:31:42 +02:00
are OK. */
re PR c++/11493 (tree check ICE in error.c) * cp-tree.h (cp_id_kind): New type. (unqualified_name_lookup_error): Change prototype. (unqualified_fn_lookup_error): New function. (do_identifier): Remove. (do_scoped_id): Likewise. (tsubst_copy_and_build): Change prototype. (reregister_specialization): New function. (perform_koenig_lookup): Likewise. (finish_id_expression): Likewise. * call.c (build_method_call): Adjust call to unqualified_name_lookup_error. * decl.c (duplicate_decls): Use reregister_specialization. * lex.c (is_global): Remove. (unqualified_name_lookup_error): Return a value. (do_identifier): Remove. (do_scoped_id): Likewise. (identifier_typedecl_value): Remove. (unqualified_fn_lookup_error): New function. * parser.c (cp_parser_id_kind): Remove. (cp_parser_non_constant_id_expression): Remove. (cp_parser_primary_expression): Use finish_id_expression. (cp_parser_class_or_namespace_name): Use cp_id_kind, not cp_parser_id_kind. (cp_parser_postfix_expression): Use perform_koenig_lookup. (cp_parser_template_argument): Use cp_id_kind. (cp_parser_fold_non_dependent_expr): Adjust call to tsubst_copy_and_build. * pt.c (unregister_specialization): Rename to ... (reregister_specialization): This. (tsubst_friend_function): Use it. (maybe_fold_nontype_arg): Adjust call to tsubst_copy_and_build. (tsubst_qualified_id): Likewise. (tsubst_expr): Likewise. (tsubst_copy_and_build): Add function_p parameter. Use finish_id_expression. Introduce RECUR macro. (tsubst_non_call_postfix_expression): New function. (regenerate_decl_from_template): Use reregister_specialization. * semantics.c (perform_koenig_lookup): New function. (finish_id_expression): Likewise. PR c++/11493 PR c++/11495 * g++.dg/parse/template9.C: Likewise. * g++.dg/template/crash4.C: New test. * g++.dg/template/koenig1.C: Likewise. * g++.old-deja/g++.benjamin/tem03.C: Adjust error markers. * g++.old-deja/g++.benjamin/tem06.C: Declare "x". * g++.old-deja/g++.jason/overload33.C: Use this-> when calling functions. * g++.old-deja/g++.jason/template36.C: Likewise. * g++.old-deja/g++.mike/p1989.C: Likewise. * g++.old-deja/g++.pt/lookup2.C: Use -fpermissive when compiling. * g++.old-deja/g++.pt/ttp20.C: Use this->. * g++.old-deja/g++.pt/ttp21.C: Use this->. * g++.old-deja/g++.pt/typename13.C: Use -fpermissive when compiling. * g++.old-deja/g++.pt/union2.C: Use this->. From-SVN: r69316
2003-07-14 05:04:29 +02:00
else if (TREE_CODE (decl) == VAR_DECL
&& CP_TYPE_CONST_P (TREE_TYPE (decl))
&& INTEGRAL_OR_ENUMERATION_TYPE_P (TREE_TYPE (decl))
re PR c++/11547 (ICE with const temporaries) PR c++/11547 * cp-tree.h (DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P): New macro. (DECL_PRETTY_FUNCTION_P): Use VAR_DECL_CHECK. * decl.c (duplicate_decls): Merge DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P. * parser.c (cp_parser_postfix_expression): Adjust call to cp_parser_initializer_list and cp_parser_parenthesized_expression_list. (cp_parser_parenthesized_expression_list): Add non_constant_p. (cp_parser_new_placement): Adjust call to cp_parser_parenthesized_expression_list. (cp_parser_direct_new_declarator): Likewise. (cp_parser_conditional_expression): Remove. (cp_parser_constant_expression): Parse an assignment-expression, not a conditional-expression. (cp_parser_simple_declaration): Resolve expression/declaration ambiguity more quickly. (cp_parser_mem_initializer): Adjust call to cp_parser_parenthesized_expression_list. (cp_parser_init_declarator): Keep track of whether or not the initializer is a constant-expression. (cp_parser_initializer): Add non_constant_p parameter. (cp_parser_initializer_clause): Likewise. (cp_parser_initializer_list): Likewise. (cp_parser_attribute_list): Adjust call to cp_parser_parenthesized_expression_list. (cp_parser_functional_cast): Likewise. * pt.c (tsubst_decl): Copy DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P. (tsubst_expr): Tweak use of DECL_PRETTY_FUNCTION_P. * semantics.c (finish_id_expression): Use DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P. PR c++/11547 * g++.dg/parse/constant3.C: New test. * g++.dg/parse/crash7.C: Likewise. From-SVN: r69493
2003-07-17 06:31:42 +02:00
&& DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (decl))
re PR c++/11493 (tree check ICE in error.c) * cp-tree.h (cp_id_kind): New type. (unqualified_name_lookup_error): Change prototype. (unqualified_fn_lookup_error): New function. (do_identifier): Remove. (do_scoped_id): Likewise. (tsubst_copy_and_build): Change prototype. (reregister_specialization): New function. (perform_koenig_lookup): Likewise. (finish_id_expression): Likewise. * call.c (build_method_call): Adjust call to unqualified_name_lookup_error. * decl.c (duplicate_decls): Use reregister_specialization. * lex.c (is_global): Remove. (unqualified_name_lookup_error): Return a value. (do_identifier): Remove. (do_scoped_id): Likewise. (identifier_typedecl_value): Remove. (unqualified_fn_lookup_error): New function. * parser.c (cp_parser_id_kind): Remove. (cp_parser_non_constant_id_expression): Remove. (cp_parser_primary_expression): Use finish_id_expression. (cp_parser_class_or_namespace_name): Use cp_id_kind, not cp_parser_id_kind. (cp_parser_postfix_expression): Use perform_koenig_lookup. (cp_parser_template_argument): Use cp_id_kind. (cp_parser_fold_non_dependent_expr): Adjust call to tsubst_copy_and_build. * pt.c (unregister_specialization): Rename to ... (reregister_specialization): This. (tsubst_friend_function): Use it. (maybe_fold_nontype_arg): Adjust call to tsubst_copy_and_build. (tsubst_qualified_id): Likewise. (tsubst_expr): Likewise. (tsubst_copy_and_build): Add function_p parameter. Use finish_id_expression. Introduce RECUR macro. (tsubst_non_call_postfix_expression): New function. (regenerate_decl_from_template): Use reregister_specialization. * semantics.c (perform_koenig_lookup): New function. (finish_id_expression): Likewise. PR c++/11493 PR c++/11495 * g++.dg/parse/template9.C: Likewise. * g++.dg/template/crash4.C: New test. * g++.dg/template/koenig1.C: Likewise. * g++.old-deja/g++.benjamin/tem03.C: Adjust error markers. * g++.old-deja/g++.benjamin/tem06.C: Declare "x". * g++.old-deja/g++.jason/overload33.C: Use this-> when calling functions. * g++.old-deja/g++.jason/template36.C: Likewise. * g++.old-deja/g++.mike/p1989.C: Likewise. * g++.old-deja/g++.pt/lookup2.C: Use -fpermissive when compiling. * g++.old-deja/g++.pt/ttp20.C: Use this->. * g++.old-deja/g++.pt/ttp21.C: Use this->. * g++.old-deja/g++.pt/typename13.C: Use -fpermissive when compiling. * g++.old-deja/g++.pt/union2.C: Use this->. From-SVN: r69316
2003-07-14 05:04:29 +02:00
;
else
{
if (!allow_non_constant_expression_p)
{
error ("`%D' cannot appear in a constant-expression", decl);
return error_mark_node;
}
*non_constant_expression_p = true;
}
}
if (TREE_CODE (decl) == NAMESPACE_DECL)
{
error ("use of namespace `%D' as expression", decl);
return error_mark_node;
}
else if (DECL_CLASS_TEMPLATE_P (decl))
{
error ("use of class template `%T' as expression", decl);
return error_mark_node;
}
else if (TREE_CODE (decl) == TREE_LIST)
{
/* Ambiguous reference to base members. */
error ("request for member `%D' is ambiguous in "
"multiple inheritance lattice", id_expression);
print_candidates (decl);
return error_mark_node;
}
/* Mark variable-like entities as used. Functions are similarly
marked either below or after overload resolution. */
if (TREE_CODE (decl) == VAR_DECL
|| TREE_CODE (decl) == PARM_DECL
|| TREE_CODE (decl) == RESULT_DECL)
mark_used (decl);
if (scope)
{
decl = (adjust_result_of_qualified_name_lookup
(decl, scope, current_class_type));
if (TREE_CODE (decl) == FUNCTION_DECL)
mark_used (decl);
if (TREE_CODE (decl) == FIELD_DECL || BASELINK_P (decl))
*qualifying_class = scope;
else if (!processing_template_decl)
decl = convert_from_reference (decl);
else if (TYPE_P (scope))
decl = build (SCOPE_REF, TREE_TYPE (decl), scope, decl);
}
else if (TREE_CODE (decl) == FIELD_DECL)
decl = finish_non_static_data_member (decl, current_class_ref,
/*qualifying_scope=*/NULL_TREE);
else if (is_overloaded_fn (decl))
{
tree first_fn = OVL_CURRENT (decl);
re PR c++/11493 (tree check ICE in error.c) * cp-tree.h (cp_id_kind): New type. (unqualified_name_lookup_error): Change prototype. (unqualified_fn_lookup_error): New function. (do_identifier): Remove. (do_scoped_id): Likewise. (tsubst_copy_and_build): Change prototype. (reregister_specialization): New function. (perform_koenig_lookup): Likewise. (finish_id_expression): Likewise. * call.c (build_method_call): Adjust call to unqualified_name_lookup_error. * decl.c (duplicate_decls): Use reregister_specialization. * lex.c (is_global): Remove. (unqualified_name_lookup_error): Return a value. (do_identifier): Remove. (do_scoped_id): Likewise. (identifier_typedecl_value): Remove. (unqualified_fn_lookup_error): New function. * parser.c (cp_parser_id_kind): Remove. (cp_parser_non_constant_id_expression): Remove. (cp_parser_primary_expression): Use finish_id_expression. (cp_parser_class_or_namespace_name): Use cp_id_kind, not cp_parser_id_kind. (cp_parser_postfix_expression): Use perform_koenig_lookup. (cp_parser_template_argument): Use cp_id_kind. (cp_parser_fold_non_dependent_expr): Adjust call to tsubst_copy_and_build. * pt.c (unregister_specialization): Rename to ... (reregister_specialization): This. (tsubst_friend_function): Use it. (maybe_fold_nontype_arg): Adjust call to tsubst_copy_and_build. (tsubst_qualified_id): Likewise. (tsubst_expr): Likewise. (tsubst_copy_and_build): Add function_p parameter. Use finish_id_expression. Introduce RECUR macro. (tsubst_non_call_postfix_expression): New function. (regenerate_decl_from_template): Use reregister_specialization. * semantics.c (perform_koenig_lookup): New function. (finish_id_expression): Likewise. PR c++/11493 PR c++/11495 * g++.dg/parse/template9.C: Likewise. * g++.dg/template/crash4.C: New test. * g++.dg/template/koenig1.C: Likewise. * g++.old-deja/g++.benjamin/tem03.C: Adjust error markers. * g++.old-deja/g++.benjamin/tem06.C: Declare "x". * g++.old-deja/g++.jason/overload33.C: Use this-> when calling functions. * g++.old-deja/g++.jason/template36.C: Likewise. * g++.old-deja/g++.mike/p1989.C: Likewise. * g++.old-deja/g++.pt/lookup2.C: Use -fpermissive when compiling. * g++.old-deja/g++.pt/ttp20.C: Use this->. * g++.old-deja/g++.pt/ttp21.C: Use this->. * g++.old-deja/g++.pt/typename13.C: Use -fpermissive when compiling. * g++.old-deja/g++.pt/union2.C: Use this->. From-SVN: r69316
2003-07-14 05:04:29 +02:00
if (TREE_CODE (first_fn) == TEMPLATE_DECL)
first_fn = DECL_TEMPLATE_RESULT (first_fn);
if (!really_overloaded_fn (decl))
mark_used (first_fn);
if (TREE_CODE (first_fn) == FUNCTION_DECL
&& DECL_FUNCTION_MEMBER_P (first_fn))
{
/* A set of member functions. */
decl = maybe_dummy_object (DECL_CONTEXT (first_fn), 0);
return finish_class_member_access_expr (decl, id_expression);
}
}
else
{
if (TREE_CODE (decl) == VAR_DECL
|| TREE_CODE (decl) == PARM_DECL
|| TREE_CODE (decl) == RESULT_DECL)
{
tree context = decl_function_context (decl);
if (context != NULL_TREE && context != current_function_decl
&& ! TREE_STATIC (decl))
{
error ("use of %s from containing function",
(TREE_CODE (decl) == VAR_DECL
? "`auto' variable" : "parameter"));
cp_error_at (" `%#D' declared here", decl);
return error_mark_node;
}
}
if (DECL_P (decl) && DECL_NONLOCAL (decl)
&& DECL_CLASS_SCOPE_P (decl)
&& DECL_CONTEXT (decl) != current_class_type)
{
tree path;
path = currently_open_derived_class (DECL_CONTEXT (decl));
perform_or_defer_access_check (TYPE_BINFO (path), decl);
}
if (! processing_template_decl)
decl = convert_from_reference (decl);
}
re PR c++/11493 (tree check ICE in error.c) * cp-tree.h (cp_id_kind): New type. (unqualified_name_lookup_error): Change prototype. (unqualified_fn_lookup_error): New function. (do_identifier): Remove. (do_scoped_id): Likewise. (tsubst_copy_and_build): Change prototype. (reregister_specialization): New function. (perform_koenig_lookup): Likewise. (finish_id_expression): Likewise. * call.c (build_method_call): Adjust call to unqualified_name_lookup_error. * decl.c (duplicate_decls): Use reregister_specialization. * lex.c (is_global): Remove. (unqualified_name_lookup_error): Return a value. (do_identifier): Remove. (do_scoped_id): Likewise. (identifier_typedecl_value): Remove. (unqualified_fn_lookup_error): New function. * parser.c (cp_parser_id_kind): Remove. (cp_parser_non_constant_id_expression): Remove. (cp_parser_primary_expression): Use finish_id_expression. (cp_parser_class_or_namespace_name): Use cp_id_kind, not cp_parser_id_kind. (cp_parser_postfix_expression): Use perform_koenig_lookup. (cp_parser_template_argument): Use cp_id_kind. (cp_parser_fold_non_dependent_expr): Adjust call to tsubst_copy_and_build. * pt.c (unregister_specialization): Rename to ... (reregister_specialization): This. (tsubst_friend_function): Use it. (maybe_fold_nontype_arg): Adjust call to tsubst_copy_and_build. (tsubst_qualified_id): Likewise. (tsubst_expr): Likewise. (tsubst_copy_and_build): Add function_p parameter. Use finish_id_expression. Introduce RECUR macro. (tsubst_non_call_postfix_expression): New function. (regenerate_decl_from_template): Use reregister_specialization. * semantics.c (perform_koenig_lookup): New function. (finish_id_expression): Likewise. PR c++/11493 PR c++/11495 * g++.dg/parse/template9.C: Likewise. * g++.dg/template/crash4.C: New test. * g++.dg/template/koenig1.C: Likewise. * g++.old-deja/g++.benjamin/tem03.C: Adjust error markers. * g++.old-deja/g++.benjamin/tem06.C: Declare "x". * g++.old-deja/g++.jason/overload33.C: Use this-> when calling functions. * g++.old-deja/g++.jason/template36.C: Likewise. * g++.old-deja/g++.mike/p1989.C: Likewise. * g++.old-deja/g++.pt/lookup2.C: Use -fpermissive when compiling. * g++.old-deja/g++.pt/ttp20.C: Use this->. * g++.old-deja/g++.pt/ttp21.C: Use this->. * g++.old-deja/g++.pt/typename13.C: Use -fpermissive when compiling. * g++.old-deja/g++.pt/union2.C: Use this->. From-SVN: r69316
2003-07-14 05:04:29 +02:00
/* Resolve references to variables of anonymous unions
into COMPONENT_REFs. */
if (TREE_CODE (decl) == ALIAS_DECL)
decl = DECL_INITIAL (decl);
}
if (TREE_DEPRECATED (decl))
warn_deprecated_use (decl);
return decl;
}
/* Implement the __typeof keyword: Return the type of EXPR, suitable for
use as a type-specifier. */
tree
finish_typeof (tree expr)
{
tree type;
if (type_dependent_expression_p (expr))
{
type = make_aggr_type (TYPEOF_TYPE);
TYPE_FIELDS (type) = expr;
return type;
}
type = TREE_TYPE (expr);
if (!type || type == unknown_type_node)
{
error ("type of `%E' is unknown", expr);
return error_mark_node;
}
return type;
}
cp-tree.def (STMT_EXPR): New tree node. * cp-tree.def (STMT_EXPR): New tree node. * cp-tree.h (STMT_EXPR_STMT): New macro. (store_return_init): Change prototype. (finish_named_return_value): New function. (expand_stmt): Likewise. (expand_body): Likewise. (begin_stmt_tree): Likewise. (finish_stmt_tree): Likewise. (expanding_p): New variable. (last_expr_type): Likewise. (building_stmt_tree): New macro. * decl.c (start_function): Use building_stmt_tree, not processing_template_decl, where appropriate. (store_parm_decls): Likewise. (store_return_init): Move most of the body to semantics.c. (finish_function): Use building_stmt_tree. (finish_stmt): Clear last_expr_type here. (cp_function): Add expanding_p, last_tree, last_expr_type. (push_cp_function_context): Save them. (pop_cp_function_context): Restore them. * decl2.c (setup_vtbl_ptr): Move to semantics.c. * error.c (dump_expr): Handle STMT_EXPR. * except.c (expand_start_catch_block): Use building_stmt_tree. Use add_decl_stmt. * expr.c (cplus_expand_expr): Handle STMT_EXPR. (do_case): Move add_tree call to semantics.c. * parse.y (return_init): Use finish_named_return_value. (for.init.statement): Use finish_expr_stmt. * parse.c: Regenerated. * pt.c (do_pushlevel): Move to semantics.c. (do_poplevel): Likewise. (tsubst_copy): Handle STMT_EXPR instead of BIND_EXPR. (tsubst_expr): Don't expand all the way to RTL here. Handle RETURN_INIT and CTOR_INITIALIZER. (instantiate_decl): Call expand_body after tsubst'ing into DECL_SAVED_TREE. * semantics.c (expand_stmts): New function. (expanding_p): New variable. (last_expr_type): Likewise. (finish_expr_stmt): Use building_stmt_tree. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (fnish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_for_stmt): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (finish_switch_cond): Likewise. (finish_switch_stmt): Likewise. (finish_case_label): Call add_tree here if necessary. (finish_goto_statement): Use building_stmt_tree. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_named_return_value): New function. (setup_vtbl_ptr): Moved here from decl2.c. (do_pushlevel): Moved here from pt.c. (do_poplevel): Likewise. (begin_stmt_expr): Use building_stmt_tree. (finish_stmt_expr): Likewise. Build a STMT_EXPR, not a BIND_EXPR, when building_stmt_tree. (begin_stmt_tree): New function. (finish_stmt_tree): Likewise. (expand_stmt): Likewise. (expand_body): Likewise. * tree.c (build_cplus_method_type): Make sure the argument types end up on the same obstack as the METHOD_TYPE. (search_tree): Handle COMPOUND_EXPR, MODIFY_EXPR, THROW_EXPR, STMT_EXPR. (mapcar): Break out common cases. Handle COMPOUND_EXPR, MODIFY_EXPR, THROW_EXPR, STMT_EXPR, RTL_EXPR. Abort, rather than sorry, if an unsupported node is encountered. * typeck.c (require_complete_type_in_void): Handle BIND_EXPR. (c_expand_return): Don't call add_tree here. From-SVN: r28729
1999-08-16 21:01:36 +02:00
/* Generate RTL for the statement T, and its substatements, and any
other statements at its nesting level. */
cp-tree.def (STMT_EXPR): New tree node. * cp-tree.def (STMT_EXPR): New tree node. * cp-tree.h (STMT_EXPR_STMT): New macro. (store_return_init): Change prototype. (finish_named_return_value): New function. (expand_stmt): Likewise. (expand_body): Likewise. (begin_stmt_tree): Likewise. (finish_stmt_tree): Likewise. (expanding_p): New variable. (last_expr_type): Likewise. (building_stmt_tree): New macro. * decl.c (start_function): Use building_stmt_tree, not processing_template_decl, where appropriate. (store_parm_decls): Likewise. (store_return_init): Move most of the body to semantics.c. (finish_function): Use building_stmt_tree. (finish_stmt): Clear last_expr_type here. (cp_function): Add expanding_p, last_tree, last_expr_type. (push_cp_function_context): Save them. (pop_cp_function_context): Restore them. * decl2.c (setup_vtbl_ptr): Move to semantics.c. * error.c (dump_expr): Handle STMT_EXPR. * except.c (expand_start_catch_block): Use building_stmt_tree. Use add_decl_stmt. * expr.c (cplus_expand_expr): Handle STMT_EXPR. (do_case): Move add_tree call to semantics.c. * parse.y (return_init): Use finish_named_return_value. (for.init.statement): Use finish_expr_stmt. * parse.c: Regenerated. * pt.c (do_pushlevel): Move to semantics.c. (do_poplevel): Likewise. (tsubst_copy): Handle STMT_EXPR instead of BIND_EXPR. (tsubst_expr): Don't expand all the way to RTL here. Handle RETURN_INIT and CTOR_INITIALIZER. (instantiate_decl): Call expand_body after tsubst'ing into DECL_SAVED_TREE. * semantics.c (expand_stmts): New function. (expanding_p): New variable. (last_expr_type): Likewise. (finish_expr_stmt): Use building_stmt_tree. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (fnish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_for_stmt): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (finish_switch_cond): Likewise. (finish_switch_stmt): Likewise. (finish_case_label): Call add_tree here if necessary. (finish_goto_statement): Use building_stmt_tree. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_named_return_value): New function. (setup_vtbl_ptr): Moved here from decl2.c. (do_pushlevel): Moved here from pt.c. (do_poplevel): Likewise. (begin_stmt_expr): Use building_stmt_tree. (finish_stmt_expr): Likewise. Build a STMT_EXPR, not a BIND_EXPR, when building_stmt_tree. (begin_stmt_tree): New function. (finish_stmt_tree): Likewise. (expand_stmt): Likewise. (expand_body): Likewise. * tree.c (build_cplus_method_type): Make sure the argument types end up on the same obstack as the METHOD_TYPE. (search_tree): Handle COMPOUND_EXPR, MODIFY_EXPR, THROW_EXPR, STMT_EXPR. (mapcar): Break out common cases. Handle COMPOUND_EXPR, MODIFY_EXPR, THROW_EXPR, STMT_EXPR, RTL_EXPR. Abort, rather than sorry, if an unsupported node is encountered. * typeck.c (require_complete_type_in_void): Handle BIND_EXPR. (c_expand_return): Don't call add_tree here. From-SVN: r28729
1999-08-16 21:01:36 +02:00
static void
cp_expand_stmt (tree t)
cp-tree.def (STMT_EXPR): New tree node. * cp-tree.def (STMT_EXPR): New tree node. * cp-tree.h (STMT_EXPR_STMT): New macro. (store_return_init): Change prototype. (finish_named_return_value): New function. (expand_stmt): Likewise. (expand_body): Likewise. (begin_stmt_tree): Likewise. (finish_stmt_tree): Likewise. (expanding_p): New variable. (last_expr_type): Likewise. (building_stmt_tree): New macro. * decl.c (start_function): Use building_stmt_tree, not processing_template_decl, where appropriate. (store_parm_decls): Likewise. (store_return_init): Move most of the body to semantics.c. (finish_function): Use building_stmt_tree. (finish_stmt): Clear last_expr_type here. (cp_function): Add expanding_p, last_tree, last_expr_type. (push_cp_function_context): Save them. (pop_cp_function_context): Restore them. * decl2.c (setup_vtbl_ptr): Move to semantics.c. * error.c (dump_expr): Handle STMT_EXPR. * except.c (expand_start_catch_block): Use building_stmt_tree. Use add_decl_stmt. * expr.c (cplus_expand_expr): Handle STMT_EXPR. (do_case): Move add_tree call to semantics.c. * parse.y (return_init): Use finish_named_return_value. (for.init.statement): Use finish_expr_stmt. * parse.c: Regenerated. * pt.c (do_pushlevel): Move to semantics.c. (do_poplevel): Likewise. (tsubst_copy): Handle STMT_EXPR instead of BIND_EXPR. (tsubst_expr): Don't expand all the way to RTL here. Handle RETURN_INIT and CTOR_INITIALIZER. (instantiate_decl): Call expand_body after tsubst'ing into DECL_SAVED_TREE. * semantics.c (expand_stmts): New function. (expanding_p): New variable. (last_expr_type): Likewise. (finish_expr_stmt): Use building_stmt_tree. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (fnish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_for_stmt): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (finish_switch_cond): Likewise. (finish_switch_stmt): Likewise. (finish_case_label): Call add_tree here if necessary. (finish_goto_statement): Use building_stmt_tree. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_named_return_value): New function. (setup_vtbl_ptr): Moved here from decl2.c. (do_pushlevel): Moved here from pt.c. (do_poplevel): Likewise. (begin_stmt_expr): Use building_stmt_tree. (finish_stmt_expr): Likewise. Build a STMT_EXPR, not a BIND_EXPR, when building_stmt_tree. (begin_stmt_tree): New function. (finish_stmt_tree): Likewise. (expand_stmt): Likewise. (expand_body): Likewise. * tree.c (build_cplus_method_type): Make sure the argument types end up on the same obstack as the METHOD_TYPE. (search_tree): Handle COMPOUND_EXPR, MODIFY_EXPR, THROW_EXPR, STMT_EXPR. (mapcar): Break out common cases. Handle COMPOUND_EXPR, MODIFY_EXPR, THROW_EXPR, STMT_EXPR, RTL_EXPR. Abort, rather than sorry, if an unsupported node is encountered. * typeck.c (require_complete_type_in_void): Handle BIND_EXPR. (c_expand_return): Don't call add_tree here. From-SVN: r28729
1999-08-16 21:01:36 +02:00
{
switch (TREE_CODE (t))
{
case TRY_BLOCK:
genrtl_try_block (t);
break;
cp-tree.def (STMT_EXPR): New tree node. * cp-tree.def (STMT_EXPR): New tree node. * cp-tree.h (STMT_EXPR_STMT): New macro. (store_return_init): Change prototype. (finish_named_return_value): New function. (expand_stmt): Likewise. (expand_body): Likewise. (begin_stmt_tree): Likewise. (finish_stmt_tree): Likewise. (expanding_p): New variable. (last_expr_type): Likewise. (building_stmt_tree): New macro. * decl.c (start_function): Use building_stmt_tree, not processing_template_decl, where appropriate. (store_parm_decls): Likewise. (store_return_init): Move most of the body to semantics.c. (finish_function): Use building_stmt_tree. (finish_stmt): Clear last_expr_type here. (cp_function): Add expanding_p, last_tree, last_expr_type. (push_cp_function_context): Save them. (pop_cp_function_context): Restore them. * decl2.c (setup_vtbl_ptr): Move to semantics.c. * error.c (dump_expr): Handle STMT_EXPR. * except.c (expand_start_catch_block): Use building_stmt_tree. Use add_decl_stmt. * expr.c (cplus_expand_expr): Handle STMT_EXPR. (do_case): Move add_tree call to semantics.c. * parse.y (return_init): Use finish_named_return_value. (for.init.statement): Use finish_expr_stmt. * parse.c: Regenerated. * pt.c (do_pushlevel): Move to semantics.c. (do_poplevel): Likewise. (tsubst_copy): Handle STMT_EXPR instead of BIND_EXPR. (tsubst_expr): Don't expand all the way to RTL here. Handle RETURN_INIT and CTOR_INITIALIZER. (instantiate_decl): Call expand_body after tsubst'ing into DECL_SAVED_TREE. * semantics.c (expand_stmts): New function. (expanding_p): New variable. (last_expr_type): Likewise. (finish_expr_stmt): Use building_stmt_tree. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (fnish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_for_stmt): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (finish_switch_cond): Likewise. (finish_switch_stmt): Likewise. (finish_case_label): Call add_tree here if necessary. (finish_goto_statement): Use building_stmt_tree. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_named_return_value): New function. (setup_vtbl_ptr): Moved here from decl2.c. (do_pushlevel): Moved here from pt.c. (do_poplevel): Likewise. (begin_stmt_expr): Use building_stmt_tree. (finish_stmt_expr): Likewise. Build a STMT_EXPR, not a BIND_EXPR, when building_stmt_tree. (begin_stmt_tree): New function. (finish_stmt_tree): Likewise. (expand_stmt): Likewise. (expand_body): Likewise. * tree.c (build_cplus_method_type): Make sure the argument types end up on the same obstack as the METHOD_TYPE. (search_tree): Handle COMPOUND_EXPR, MODIFY_EXPR, THROW_EXPR, STMT_EXPR. (mapcar): Break out common cases. Handle COMPOUND_EXPR, MODIFY_EXPR, THROW_EXPR, STMT_EXPR, RTL_EXPR. Abort, rather than sorry, if an unsupported node is encountered. * typeck.c (require_complete_type_in_void): Handle BIND_EXPR. (c_expand_return): Don't call add_tree here. From-SVN: r28729
1999-08-16 21:01:36 +02:00
case EH_SPEC_BLOCK:
genrtl_eh_spec_block (t);
break;
case HANDLER:
genrtl_handler (t);
break;
cp-tree.def (STMT_EXPR): New tree node. * cp-tree.def (STMT_EXPR): New tree node. * cp-tree.h (STMT_EXPR_STMT): New macro. (store_return_init): Change prototype. (finish_named_return_value): New function. (expand_stmt): Likewise. (expand_body): Likewise. (begin_stmt_tree): Likewise. (finish_stmt_tree): Likewise. (expanding_p): New variable. (last_expr_type): Likewise. (building_stmt_tree): New macro. * decl.c (start_function): Use building_stmt_tree, not processing_template_decl, where appropriate. (store_parm_decls): Likewise. (store_return_init): Move most of the body to semantics.c. (finish_function): Use building_stmt_tree. (finish_stmt): Clear last_expr_type here. (cp_function): Add expanding_p, last_tree, last_expr_type. (push_cp_function_context): Save them. (pop_cp_function_context): Restore them. * decl2.c (setup_vtbl_ptr): Move to semantics.c. * error.c (dump_expr): Handle STMT_EXPR. * except.c (expand_start_catch_block): Use building_stmt_tree. Use add_decl_stmt. * expr.c (cplus_expand_expr): Handle STMT_EXPR. (do_case): Move add_tree call to semantics.c. * parse.y (return_init): Use finish_named_return_value. (for.init.statement): Use finish_expr_stmt. * parse.c: Regenerated. * pt.c (do_pushlevel): Move to semantics.c. (do_poplevel): Likewise. (tsubst_copy): Handle STMT_EXPR instead of BIND_EXPR. (tsubst_expr): Don't expand all the way to RTL here. Handle RETURN_INIT and CTOR_INITIALIZER. (instantiate_decl): Call expand_body after tsubst'ing into DECL_SAVED_TREE. * semantics.c (expand_stmts): New function. (expanding_p): New variable. (last_expr_type): Likewise. (finish_expr_stmt): Use building_stmt_tree. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (fnish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_for_stmt): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (finish_switch_cond): Likewise. (finish_switch_stmt): Likewise. (finish_case_label): Call add_tree here if necessary. (finish_goto_statement): Use building_stmt_tree. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_named_return_value): New function. (setup_vtbl_ptr): Moved here from decl2.c. (do_pushlevel): Moved here from pt.c. (do_poplevel): Likewise. (begin_stmt_expr): Use building_stmt_tree. (finish_stmt_expr): Likewise. Build a STMT_EXPR, not a BIND_EXPR, when building_stmt_tree. (begin_stmt_tree): New function. (finish_stmt_tree): Likewise. (expand_stmt): Likewise. (expand_body): Likewise. * tree.c (build_cplus_method_type): Make sure the argument types end up on the same obstack as the METHOD_TYPE. (search_tree): Handle COMPOUND_EXPR, MODIFY_EXPR, THROW_EXPR, STMT_EXPR. (mapcar): Break out common cases. Handle COMPOUND_EXPR, MODIFY_EXPR, THROW_EXPR, STMT_EXPR, RTL_EXPR. Abort, rather than sorry, if an unsupported node is encountered. * typeck.c (require_complete_type_in_void): Handle BIND_EXPR. (c_expand_return): Don't call add_tree here. From-SVN: r28729
1999-08-16 21:01:36 +02:00
case USING_STMT:
break;
default:
abort ();
break;
}
cp-tree.def (STMT_EXPR): New tree node. * cp-tree.def (STMT_EXPR): New tree node. * cp-tree.h (STMT_EXPR_STMT): New macro. (store_return_init): Change prototype. (finish_named_return_value): New function. (expand_stmt): Likewise. (expand_body): Likewise. (begin_stmt_tree): Likewise. (finish_stmt_tree): Likewise. (expanding_p): New variable. (last_expr_type): Likewise. (building_stmt_tree): New macro. * decl.c (start_function): Use building_stmt_tree, not processing_template_decl, where appropriate. (store_parm_decls): Likewise. (store_return_init): Move most of the body to semantics.c. (finish_function): Use building_stmt_tree. (finish_stmt): Clear last_expr_type here. (cp_function): Add expanding_p, last_tree, last_expr_type. (push_cp_function_context): Save them. (pop_cp_function_context): Restore them. * decl2.c (setup_vtbl_ptr): Move to semantics.c. * error.c (dump_expr): Handle STMT_EXPR. * except.c (expand_start_catch_block): Use building_stmt_tree. Use add_decl_stmt. * expr.c (cplus_expand_expr): Handle STMT_EXPR. (do_case): Move add_tree call to semantics.c. * parse.y (return_init): Use finish_named_return_value. (for.init.statement): Use finish_expr_stmt. * parse.c: Regenerated. * pt.c (do_pushlevel): Move to semantics.c. (do_poplevel): Likewise. (tsubst_copy): Handle STMT_EXPR instead of BIND_EXPR. (tsubst_expr): Don't expand all the way to RTL here. Handle RETURN_INIT and CTOR_INITIALIZER. (instantiate_decl): Call expand_body after tsubst'ing into DECL_SAVED_TREE. * semantics.c (expand_stmts): New function. (expanding_p): New variable. (last_expr_type): Likewise. (finish_expr_stmt): Use building_stmt_tree. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (fnish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_for_stmt): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (finish_switch_cond): Likewise. (finish_switch_stmt): Likewise. (finish_case_label): Call add_tree here if necessary. (finish_goto_statement): Use building_stmt_tree. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_named_return_value): New function. (setup_vtbl_ptr): Moved here from decl2.c. (do_pushlevel): Moved here from pt.c. (do_poplevel): Likewise. (begin_stmt_expr): Use building_stmt_tree. (finish_stmt_expr): Likewise. Build a STMT_EXPR, not a BIND_EXPR, when building_stmt_tree. (begin_stmt_tree): New function. (finish_stmt_tree): Likewise. (expand_stmt): Likewise. (expand_body): Likewise. * tree.c (build_cplus_method_type): Make sure the argument types end up on the same obstack as the METHOD_TYPE. (search_tree): Handle COMPOUND_EXPR, MODIFY_EXPR, THROW_EXPR, STMT_EXPR. (mapcar): Break out common cases. Handle COMPOUND_EXPR, MODIFY_EXPR, THROW_EXPR, STMT_EXPR, RTL_EXPR. Abort, rather than sorry, if an unsupported node is encountered. * typeck.c (require_complete_type_in_void): Handle BIND_EXPR. (c_expand_return): Don't call add_tree here. From-SVN: r28729
1999-08-16 21:01:36 +02:00
}
/* Called from expand_body via walk_tree. Replace all AGGR_INIT_EXPRs
will equivalent CALL_EXPRs. */
static tree
simplify_aggr_init_exprs_r (tree* tp,
int* walk_subtrees,
void* data ATTRIBUTE_UNUSED)
{
/* We don't need to walk into types; there's nothing in a type that
needs simplification. (And, furthermore, there are places we
actively don't want to go. For example, we don't want to wander
into the default arguments for a FUNCTION_DECL that appears in a
CALL_EXPR.) */
if (TYPE_P (*tp))
{
*walk_subtrees = 0;
return NULL_TREE;
}
/* Only AGGR_INIT_EXPRs are interesting. */
else if (TREE_CODE (*tp) != AGGR_INIT_EXPR)
return NULL_TREE;
simplify_aggr_init_expr (tp);
/* Keep iterating. */
return NULL_TREE;
}
/* Replace the AGGR_INIT_EXPR at *TP with an equivalent CALL_EXPR. This
function is broken out from the above for the benefit of the tree-ssa
project. */
void
simplify_aggr_init_expr (tree *tp)
{
tree aggr_init_expr = *tp;
/* Form an appropriate CALL_EXPR. */
tree fn = TREE_OPERAND (aggr_init_expr, 0);
tree args = TREE_OPERAND (aggr_init_expr, 1);
tree slot = TREE_OPERAND (aggr_init_expr, 2);
tree type = TREE_TYPE (aggr_init_expr);
tree call_expr;
enum style_t { ctor, arg, pcc } style;
if (AGGR_INIT_VIA_CTOR_P (aggr_init_expr))
style = ctor;
#ifdef PCC_STATIC_STRUCT_RETURN
else if (1)
style = pcc;
#endif
else if (TREE_ADDRESSABLE (type))
style = arg;
else
/* We shouldn't build an AGGR_INIT_EXPR if we don't need any special
handling. See build_cplus_new. */
abort ();
if (style == ctor || style == arg)
{
/* Pass the address of the slot. If this is a constructor, we
replace the first argument; otherwise, we tack on a new one. */
tree addr;
if (style == ctor)
args = TREE_CHAIN (args);
c-decl.c (grokdeclarator): Update. * c-decl.c (grokdeclarator): Update. * c-lang.c (LANG_HOOKS_MARK_ADDRESSABLE): Redefine. * c-tree.h (c_mark_addressable): New. * c-typeck.c (default_function_array_conversion, build_unary_op, build_array_ref, convert_for_assignment): Update. (mark_addressable): Rename. * calls.c (try_to_integrate, expand_call): Use langhook. * expr.c (expand_expr): Use langhook. * langhooks-def.h (LANG_HOOKS_INITIALIZER): Update. * langhooks.h (struct lang_hooks): New hook. * stmt.c (expand_asm_operands): Use langhook. * tree.h (mark_addressable): Remove. ada: * decl.c (gnat_to_gnu_entity): Update. * gigi.h (mark_addressable): Rename. * misc.c (LANG_HOOKS_MARK_ADDRESSABLE): Redefine. * trans.c (tree_transform): Update. * utils.c (create_var_decl): Update. * util2.c (build_binary_op, build_unary_op, fill_vms_descriptor): Update. (mark_addressable): Rename, update. cp: * call.c (build_addr_func): Update. * class.c (resolve_address_of_overloaded_function): Update. * cp-lang.c (LANG_HOOKS_MARK_ADDRESSABLE): Redefine. * cp-tree.h (cxx_mark_addressable): New. * decl.c (register_dtor_fn, cxx_maybe_build_cleanup): Update. * decl2.c (build_cleanup): Update. * except.c (build_throw): Update. * init.c (resolve_offset_ref): Update. * pt.c (convert_nontype_argument): Update. * semantics.c (finish_asm_stmt, simplify_affr_init_exprs_r): Update. * typeck.c (decay_conversion, build_array_ref, build_unary_op, unary_complex_lvalue): Update. (mark_addressable): Rename. f: * com.c (LANG_HOOKS_MARK_ADDRESSABLE): Redefine. (mark_addressable): Rename. (ffecom_arrayref_, ffecom_1): Update. java: * java-tree.h (java_mark_addressable): New. * lang.c (LANG_HOOKS_MARK_ADDRESSABLE): Redefine. * typeck.c (mark_addressable): Rename, update. objc: * objc-lang.c (LANG_HOOKS_MARK_ADDRESSABLE): Redefine. From-SVN: r51705
2002-04-01 22:26:18 +02:00
cxx_mark_addressable (slot);
addr = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (slot)), slot);
if (style == arg)
{
/* The return type might have different cv-quals from the slot. */
tree fntype = TREE_TYPE (TREE_TYPE (fn));
#ifdef ENABLE_CHECKING
if (TREE_CODE (fntype) != FUNCTION_TYPE
&& TREE_CODE (fntype) != METHOD_TYPE)
abort ();
#endif
addr = convert (build_pointer_type (TREE_TYPE (fntype)), addr);
}
args = tree_cons (NULL_TREE, addr, args);
}
call_expr = build (CALL_EXPR,
TREE_TYPE (TREE_TYPE (TREE_TYPE (fn))),
fn, args, NULL_TREE);
if (style == arg)
/* Tell the backend that we've added our return slot to the argument
list. */
CALL_EXPR_HAS_RETURN_SLOT_ADDR (call_expr) = 1;
else if (style == pcc)
{
/* If we're using the non-reentrant PCC calling convention, then we
need to copy the returned value out of the static buffer into the
SLOT. */
push_deferring_access_checks (dk_no_check);
call_expr = build_aggr_init (slot, call_expr,
DIRECT_BIND | LOOKUP_ONLYCONVERTING);
pop_deferring_access_checks ();
}
/* We want to use the value of the initialized location as the
result. */
call_expr = build (COMPOUND_EXPR, type,
call_expr, slot);
/* Replace the AGGR_INIT_EXPR with the CALL_EXPR. */
TREE_CHAIN (call_expr) = TREE_CHAIN (aggr_init_expr);
*tp = call_expr;
}
cp-tree.h (BV_USE_VCALL_INDEX_P): New macro. * cp-tree.h (BV_USE_VCALL_INDEX_P): New macro. (BV_GENERATE_THUNK_WITH_VTABLE_P): Likewise. (lang_decl_flags): Add generate_with_vtable_p. Make vcall_offset a tree, not an int. (THUNK_GENERATE_WITH_VTABLE_P): New macro. (make_thunk): Change prototype. (emit_thunk): Rename to use_thunk. (mangle_thunk): Change prototype. * class.c (get_derived_offset): Simplify. (copy_virtuals): Clear BV_USE_VCALL_INDEX_P and BV_GENERATE_THUNK_WITH_VTABLE_P. (build_primary_vtable): Simplify. (add_virtual_function): Use BV_FN, rather than TREE_VALUE. (dfs_find_base): Remove. (update_vtable_entry_for_fn): Correct bug in finding the base where a virtual function was first declared. Figure out whether or not to emit a vcall-thunk with the vtables in which it appears. Correct logic for deciding whether to use an ordinary thunk, or a vcall thunk. (finish_struct_1): Remove unnecssary code. (build_vtbl_initializer): Use ssize_int for the running counter of negative indices. (build_vtbl_initializer): Only use vcall thunks where necessary. Mark thunks as needing to be emitted with their vtables, or not. (build_vbase_offset_vtbl_entries): Adjust for use of ssize_int in indices. Use size_binop. (dfs_build_vcall_offset_vtbl_entries): Don't rely on BINFO_PRIMARY_MARKED_P here. Use BV_FN consistently. Use size_binop. (build_rtti_vtbl_entries): Adjust call to build_vtable_entry. (build_vtable_entry): Mark thunks as needing to be emitted with their vtables, or not. * decl.c (lang_mark_tree): Mark the vcall_offset in a thunk. * decl2.c (mark_vtable_entries): Use use_thunk instead of emit_thunk. * dump.c (dequeue_and_dump): Remove dead code. Dump new thunk information. * error.c (dump_expr): Use BV_FN. * mangle.c (mangle_thunk): Adjust now that vcall_offset is a tree, not an int. * method.c (make_thunk): Likewise. (emit_thunk): Rename to use_thunk. Allow callers to decide whether or not to actually emit the thunk. Adjust for changes in representation of vcall offsets. * search.c (dfs_get_pure_virtuals): Use BV_FN. * semantics.c (emit_associated_thunks): New function. (expand_body): Use it. * ir.texi: Adjust decriptions of thunks. From-SVN: r34656
2000-06-23 03:14:40 +02:00
/* Emit all thunks to FN that should be emitted when FN is emitted. */
static void
emit_associated_thunks (tree fn)
cp-tree.h (BV_USE_VCALL_INDEX_P): New macro. * cp-tree.h (BV_USE_VCALL_INDEX_P): New macro. (BV_GENERATE_THUNK_WITH_VTABLE_P): Likewise. (lang_decl_flags): Add generate_with_vtable_p. Make vcall_offset a tree, not an int. (THUNK_GENERATE_WITH_VTABLE_P): New macro. (make_thunk): Change prototype. (emit_thunk): Rename to use_thunk. (mangle_thunk): Change prototype. * class.c (get_derived_offset): Simplify. (copy_virtuals): Clear BV_USE_VCALL_INDEX_P and BV_GENERATE_THUNK_WITH_VTABLE_P. (build_primary_vtable): Simplify. (add_virtual_function): Use BV_FN, rather than TREE_VALUE. (dfs_find_base): Remove. (update_vtable_entry_for_fn): Correct bug in finding the base where a virtual function was first declared. Figure out whether or not to emit a vcall-thunk with the vtables in which it appears. Correct logic for deciding whether to use an ordinary thunk, or a vcall thunk. (finish_struct_1): Remove unnecssary code. (build_vtbl_initializer): Use ssize_int for the running counter of negative indices. (build_vtbl_initializer): Only use vcall thunks where necessary. Mark thunks as needing to be emitted with their vtables, or not. (build_vbase_offset_vtbl_entries): Adjust for use of ssize_int in indices. Use size_binop. (dfs_build_vcall_offset_vtbl_entries): Don't rely on BINFO_PRIMARY_MARKED_P here. Use BV_FN consistently. Use size_binop. (build_rtti_vtbl_entries): Adjust call to build_vtable_entry. (build_vtable_entry): Mark thunks as needing to be emitted with their vtables, or not. * decl.c (lang_mark_tree): Mark the vcall_offset in a thunk. * decl2.c (mark_vtable_entries): Use use_thunk instead of emit_thunk. * dump.c (dequeue_and_dump): Remove dead code. Dump new thunk information. * error.c (dump_expr): Use BV_FN. * mangle.c (mangle_thunk): Adjust now that vcall_offset is a tree, not an int. * method.c (make_thunk): Likewise. (emit_thunk): Rename to use_thunk. Allow callers to decide whether or not to actually emit the thunk. Adjust for changes in representation of vcall offsets. * search.c (dfs_get_pure_virtuals): Use BV_FN. * semantics.c (emit_associated_thunks): New function. (expand_body): Use it. * ir.texi: Adjust decriptions of thunks. From-SVN: r34656
2000-06-23 03:14:40 +02:00
{
/* When we use vcall offsets, we emit thunks with the virtual
functions to which they thunk. The whole point of vcall offsets
is so that you can know statically the entire set of thunks that
will ever be needed for a given virtual function, thereby
enabling you to output all the thunks with the function itself. */
if (DECL_VIRTUAL_P (fn))
cp-tree.h (BV_USE_VCALL_INDEX_P): New macro. * cp-tree.h (BV_USE_VCALL_INDEX_P): New macro. (BV_GENERATE_THUNK_WITH_VTABLE_P): Likewise. (lang_decl_flags): Add generate_with_vtable_p. Make vcall_offset a tree, not an int. (THUNK_GENERATE_WITH_VTABLE_P): New macro. (make_thunk): Change prototype. (emit_thunk): Rename to use_thunk. (mangle_thunk): Change prototype. * class.c (get_derived_offset): Simplify. (copy_virtuals): Clear BV_USE_VCALL_INDEX_P and BV_GENERATE_THUNK_WITH_VTABLE_P. (build_primary_vtable): Simplify. (add_virtual_function): Use BV_FN, rather than TREE_VALUE. (dfs_find_base): Remove. (update_vtable_entry_for_fn): Correct bug in finding the base where a virtual function was first declared. Figure out whether or not to emit a vcall-thunk with the vtables in which it appears. Correct logic for deciding whether to use an ordinary thunk, or a vcall thunk. (finish_struct_1): Remove unnecssary code. (build_vtbl_initializer): Use ssize_int for the running counter of negative indices. (build_vtbl_initializer): Only use vcall thunks where necessary. Mark thunks as needing to be emitted with their vtables, or not. (build_vbase_offset_vtbl_entries): Adjust for use of ssize_int in indices. Use size_binop. (dfs_build_vcall_offset_vtbl_entries): Don't rely on BINFO_PRIMARY_MARKED_P here. Use BV_FN consistently. Use size_binop. (build_rtti_vtbl_entries): Adjust call to build_vtable_entry. (build_vtable_entry): Mark thunks as needing to be emitted with their vtables, or not. * decl.c (lang_mark_tree): Mark the vcall_offset in a thunk. * decl2.c (mark_vtable_entries): Use use_thunk instead of emit_thunk. * dump.c (dequeue_and_dump): Remove dead code. Dump new thunk information. * error.c (dump_expr): Use BV_FN. * mangle.c (mangle_thunk): Adjust now that vcall_offset is a tree, not an int. * method.c (make_thunk): Likewise. (emit_thunk): Rename to use_thunk. Allow callers to decide whether or not to actually emit the thunk. Adjust for changes in representation of vcall offsets. * search.c (dfs_get_pure_virtuals): Use BV_FN. * semantics.c (emit_associated_thunks): New function. (expand_body): Use it. * ir.texi: Adjust decriptions of thunks. From-SVN: r34656
2000-06-23 03:14:40 +02:00
{
tree thunk;
for (thunk = DECL_THUNKS (fn); thunk; thunk = TREE_CHAIN (thunk))
{
use_thunk (thunk, /*emit_p=*/1);
if (DECL_RESULT_THUNK_P (thunk))
{
tree probe;
for (probe = DECL_THUNKS (thunk);
probe; probe = TREE_CHAIN (probe))
use_thunk (probe, /*emit_p=*/1);
}
}
cp-tree.h (BV_USE_VCALL_INDEX_P): New macro. * cp-tree.h (BV_USE_VCALL_INDEX_P): New macro. (BV_GENERATE_THUNK_WITH_VTABLE_P): Likewise. (lang_decl_flags): Add generate_with_vtable_p. Make vcall_offset a tree, not an int. (THUNK_GENERATE_WITH_VTABLE_P): New macro. (make_thunk): Change prototype. (emit_thunk): Rename to use_thunk. (mangle_thunk): Change prototype. * class.c (get_derived_offset): Simplify. (copy_virtuals): Clear BV_USE_VCALL_INDEX_P and BV_GENERATE_THUNK_WITH_VTABLE_P. (build_primary_vtable): Simplify. (add_virtual_function): Use BV_FN, rather than TREE_VALUE. (dfs_find_base): Remove. (update_vtable_entry_for_fn): Correct bug in finding the base where a virtual function was first declared. Figure out whether or not to emit a vcall-thunk with the vtables in which it appears. Correct logic for deciding whether to use an ordinary thunk, or a vcall thunk. (finish_struct_1): Remove unnecssary code. (build_vtbl_initializer): Use ssize_int for the running counter of negative indices. (build_vtbl_initializer): Only use vcall thunks where necessary. Mark thunks as needing to be emitted with their vtables, or not. (build_vbase_offset_vtbl_entries): Adjust for use of ssize_int in indices. Use size_binop. (dfs_build_vcall_offset_vtbl_entries): Don't rely on BINFO_PRIMARY_MARKED_P here. Use BV_FN consistently. Use size_binop. (build_rtti_vtbl_entries): Adjust call to build_vtable_entry. (build_vtable_entry): Mark thunks as needing to be emitted with their vtables, or not. * decl.c (lang_mark_tree): Mark the vcall_offset in a thunk. * decl2.c (mark_vtable_entries): Use use_thunk instead of emit_thunk. * dump.c (dequeue_and_dump): Remove dead code. Dump new thunk information. * error.c (dump_expr): Use BV_FN. * mangle.c (mangle_thunk): Adjust now that vcall_offset is a tree, not an int. * method.c (make_thunk): Likewise. (emit_thunk): Rename to use_thunk. Allow callers to decide whether or not to actually emit the thunk. Adjust for changes in representation of vcall offsets. * search.c (dfs_get_pure_virtuals): Use BV_FN. * semantics.c (emit_associated_thunks): New function. (expand_body): Use it. * ir.texi: Adjust decriptions of thunks. From-SVN: r34656
2000-06-23 03:14:40 +02:00
}
}
cp-tree.def (STMT_EXPR): New tree node. * cp-tree.def (STMT_EXPR): New tree node. * cp-tree.h (STMT_EXPR_STMT): New macro. (store_return_init): Change prototype. (finish_named_return_value): New function. (expand_stmt): Likewise. (expand_body): Likewise. (begin_stmt_tree): Likewise. (finish_stmt_tree): Likewise. (expanding_p): New variable. (last_expr_type): Likewise. (building_stmt_tree): New macro. * decl.c (start_function): Use building_stmt_tree, not processing_template_decl, where appropriate. (store_parm_decls): Likewise. (store_return_init): Move most of the body to semantics.c. (finish_function): Use building_stmt_tree. (finish_stmt): Clear last_expr_type here. (cp_function): Add expanding_p, last_tree, last_expr_type. (push_cp_function_context): Save them. (pop_cp_function_context): Restore them. * decl2.c (setup_vtbl_ptr): Move to semantics.c. * error.c (dump_expr): Handle STMT_EXPR. * except.c (expand_start_catch_block): Use building_stmt_tree. Use add_decl_stmt. * expr.c (cplus_expand_expr): Handle STMT_EXPR. (do_case): Move add_tree call to semantics.c. * parse.y (return_init): Use finish_named_return_value. (for.init.statement): Use finish_expr_stmt. * parse.c: Regenerated. * pt.c (do_pushlevel): Move to semantics.c. (do_poplevel): Likewise. (tsubst_copy): Handle STMT_EXPR instead of BIND_EXPR. (tsubst_expr): Don't expand all the way to RTL here. Handle RETURN_INIT and CTOR_INITIALIZER. (instantiate_decl): Call expand_body after tsubst'ing into DECL_SAVED_TREE. * semantics.c (expand_stmts): New function. (expanding_p): New variable. (last_expr_type): Likewise. (finish_expr_stmt): Use building_stmt_tree. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (fnish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_for_stmt): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (finish_switch_cond): Likewise. (finish_switch_stmt): Likewise. (finish_case_label): Call add_tree here if necessary. (finish_goto_statement): Use building_stmt_tree. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_named_return_value): New function. (setup_vtbl_ptr): Moved here from decl2.c. (do_pushlevel): Moved here from pt.c. (do_poplevel): Likewise. (begin_stmt_expr): Use building_stmt_tree. (finish_stmt_expr): Likewise. Build a STMT_EXPR, not a BIND_EXPR, when building_stmt_tree. (begin_stmt_tree): New function. (finish_stmt_tree): Likewise. (expand_stmt): Likewise. (expand_body): Likewise. * tree.c (build_cplus_method_type): Make sure the argument types end up on the same obstack as the METHOD_TYPE. (search_tree): Handle COMPOUND_EXPR, MODIFY_EXPR, THROW_EXPR, STMT_EXPR. (mapcar): Break out common cases. Handle COMPOUND_EXPR, MODIFY_EXPR, THROW_EXPR, STMT_EXPR, RTL_EXPR. Abort, rather than sorry, if an unsupported node is encountered. * typeck.c (require_complete_type_in_void): Handle BIND_EXPR. (c_expand_return): Don't call add_tree here. From-SVN: r28729
1999-08-16 21:01:36 +02:00
/* Generate RTL for FN. */
void
expand_body (tree fn)
cp-tree.def (STMT_EXPR): New tree node. * cp-tree.def (STMT_EXPR): New tree node. * cp-tree.h (STMT_EXPR_STMT): New macro. (store_return_init): Change prototype. (finish_named_return_value): New function. (expand_stmt): Likewise. (expand_body): Likewise. (begin_stmt_tree): Likewise. (finish_stmt_tree): Likewise. (expanding_p): New variable. (last_expr_type): Likewise. (building_stmt_tree): New macro. * decl.c (start_function): Use building_stmt_tree, not processing_template_decl, where appropriate. (store_parm_decls): Likewise. (store_return_init): Move most of the body to semantics.c. (finish_function): Use building_stmt_tree. (finish_stmt): Clear last_expr_type here. (cp_function): Add expanding_p, last_tree, last_expr_type. (push_cp_function_context): Save them. (pop_cp_function_context): Restore them. * decl2.c (setup_vtbl_ptr): Move to semantics.c. * error.c (dump_expr): Handle STMT_EXPR. * except.c (expand_start_catch_block): Use building_stmt_tree. Use add_decl_stmt. * expr.c (cplus_expand_expr): Handle STMT_EXPR. (do_case): Move add_tree call to semantics.c. * parse.y (return_init): Use finish_named_return_value. (for.init.statement): Use finish_expr_stmt. * parse.c: Regenerated. * pt.c (do_pushlevel): Move to semantics.c. (do_poplevel): Likewise. (tsubst_copy): Handle STMT_EXPR instead of BIND_EXPR. (tsubst_expr): Don't expand all the way to RTL here. Handle RETURN_INIT and CTOR_INITIALIZER. (instantiate_decl): Call expand_body after tsubst'ing into DECL_SAVED_TREE. * semantics.c (expand_stmts): New function. (expanding_p): New variable. (last_expr_type): Likewise. (finish_expr_stmt): Use building_stmt_tree. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (fnish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_for_stmt): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (finish_switch_cond): Likewise. (finish_switch_stmt): Likewise. (finish_case_label): Call add_tree here if necessary. (finish_goto_statement): Use building_stmt_tree. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_named_return_value): New function. (setup_vtbl_ptr): Moved here from decl2.c. (do_pushlevel): Moved here from pt.c. (do_poplevel): Likewise. (begin_stmt_expr): Use building_stmt_tree. (finish_stmt_expr): Likewise. Build a STMT_EXPR, not a BIND_EXPR, when building_stmt_tree. (begin_stmt_tree): New function. (finish_stmt_tree): Likewise. (expand_stmt): Likewise. (expand_body): Likewise. * tree.c (build_cplus_method_type): Make sure the argument types end up on the same obstack as the METHOD_TYPE. (search_tree): Handle COMPOUND_EXPR, MODIFY_EXPR, THROW_EXPR, STMT_EXPR. (mapcar): Break out common cases. Handle COMPOUND_EXPR, MODIFY_EXPR, THROW_EXPR, STMT_EXPR, RTL_EXPR. Abort, rather than sorry, if an unsupported node is encountered. * typeck.c (require_complete_type_in_void): Handle BIND_EXPR. (c_expand_return): Don't call add_tree here. From-SVN: r28729
1999-08-16 21:01:36 +02:00
{
tree saved_function;
/* Compute the appropriate object-file linkage for inline
functions. */
if (DECL_DECLARED_INLINE_P (fn))
import_export_decl (fn);
/* If FN is external, then there's no point in generating RTL for
it. This situation can arise with an inline function under
2001-11-23 20:00:14 +01:00
`-fexternal-templates'; we instantiate the function, even though
we're not planning on emitting it, in case we get a chance to
inline it. */
if (DECL_EXTERNAL (fn))
return;
tree-optimize.c: New file. gcc/ * tree-optimize.c: New file. * Makefile.in (OBJS-archive): Add tree-optimize.o. (tree-optimize.o): New. * c-decl.c (store_parm_decls): Use allocate_struct_function. (finish_function): Don't free_after_parsing or free_after_compilation. (set_save_expr_context): Move to tree-optimize.c. (c_expand_body_1): Use tree_rest_of_compilation. * c-lang.c (LANG_HOOKS_RTL_EXPAND_STMT): New. * objc/objc-lang.c (LANG_HOOKS_RTL_EXPAND_STMT): New. * c-objc-common.c (expand_deferred_fns): Don't emit unused inlines; iterate until closure. * langhooks-def.h (LANG_HOOKS_RTL_EXPAND_START, LANG_HOOKS_RTL_EXPAND_STMT, LANG_HOOKS_RTL_EXPAND_END): New. (LANG_HOOKS_RTL_EXPAND_INITIALIZER): New. * langhooks.h (struct lang_hooks_for_rtl_expansion): New. * toplev.h (tree_rest_of_compilation): Declare it. gcc/cp/ * cp-lang.c (LANG_HOOKS_RTL_EXPAND_START): New. (LANG_HOOKS_RTL_EXPAND_STMT): New. * cp-tree.h (cxx_expand_function_start): Declare. * decl.c (start_function): Use allocate_struct_function. Move stmts_are_full_exprs_p assertion from expand_body. Do not free_after_parsing or free_after_compilation. (cxx_push_function_context): Move code to set struct function data from genrtl_start_function. * optimize.c (optimize_function): Don't inc/dec function_depth. * semantics.c (expand_body): Use tree_rest_of_compilation. (cxx_expand_function_start): Rename from genrtl_start_function, omit bits done by tree_rest_of_compilation. (genrtl_finish_function): Remove. (clear_decl_rtl): Move to ../tree-optimize.c. Co-Authored-By: Jason Merrill <jason@redhat.com> From-SVN: r70933
2003-08-30 01:21:13 +02:00
/* ??? When is this needed? */
saved_function = current_function_decl;
timevar_push (TV_INTEGRATION);
optimize_function (fn);
timevar_pop (TV_INTEGRATION);
tree_rest_of_compilation (fn, function_depth > 1);
current_function_decl = saved_function;
tree-optimize.c: New file. gcc/ * tree-optimize.c: New file. * Makefile.in (OBJS-archive): Add tree-optimize.o. (tree-optimize.o): New. * c-decl.c (store_parm_decls): Use allocate_struct_function. (finish_function): Don't free_after_parsing or free_after_compilation. (set_save_expr_context): Move to tree-optimize.c. (c_expand_body_1): Use tree_rest_of_compilation. * c-lang.c (LANG_HOOKS_RTL_EXPAND_STMT): New. * objc/objc-lang.c (LANG_HOOKS_RTL_EXPAND_STMT): New. * c-objc-common.c (expand_deferred_fns): Don't emit unused inlines; iterate until closure. * langhooks-def.h (LANG_HOOKS_RTL_EXPAND_START, LANG_HOOKS_RTL_EXPAND_STMT, LANG_HOOKS_RTL_EXPAND_END): New. (LANG_HOOKS_RTL_EXPAND_INITIALIZER): New. * langhooks.h (struct lang_hooks_for_rtl_expansion): New. * toplev.h (tree_rest_of_compilation): Declare it. gcc/cp/ * cp-lang.c (LANG_HOOKS_RTL_EXPAND_START): New. (LANG_HOOKS_RTL_EXPAND_STMT): New. * cp-tree.h (cxx_expand_function_start): Declare. * decl.c (start_function): Use allocate_struct_function. Move stmts_are_full_exprs_p assertion from expand_body. Do not free_after_parsing or free_after_compilation. (cxx_push_function_context): Move code to set struct function data from genrtl_start_function. * optimize.c (optimize_function): Don't inc/dec function_depth. * semantics.c (expand_body): Use tree_rest_of_compilation. (cxx_expand_function_start): Rename from genrtl_start_function, omit bits done by tree_rest_of_compilation. (genrtl_finish_function): Remove. (clear_decl_rtl): Move to ../tree-optimize.c. Co-Authored-By: Jason Merrill <jason@redhat.com> From-SVN: r70933
2003-08-30 01:21:13 +02:00
extract_interface_info ();
/* Emit any thunks that should be emitted at the same time as FN. */
emit_associated_thunks (fn);
tree-optimize.c: New file. gcc/ * tree-optimize.c: New file. * Makefile.in (OBJS-archive): Add tree-optimize.o. (tree-optimize.o): New. * c-decl.c (store_parm_decls): Use allocate_struct_function. (finish_function): Don't free_after_parsing or free_after_compilation. (set_save_expr_context): Move to tree-optimize.c. (c_expand_body_1): Use tree_rest_of_compilation. * c-lang.c (LANG_HOOKS_RTL_EXPAND_STMT): New. * objc/objc-lang.c (LANG_HOOKS_RTL_EXPAND_STMT): New. * c-objc-common.c (expand_deferred_fns): Don't emit unused inlines; iterate until closure. * langhooks-def.h (LANG_HOOKS_RTL_EXPAND_START, LANG_HOOKS_RTL_EXPAND_STMT, LANG_HOOKS_RTL_EXPAND_END): New. (LANG_HOOKS_RTL_EXPAND_INITIALIZER): New. * langhooks.h (struct lang_hooks_for_rtl_expansion): New. * toplev.h (tree_rest_of_compilation): Declare it. gcc/cp/ * cp-lang.c (LANG_HOOKS_RTL_EXPAND_START): New. (LANG_HOOKS_RTL_EXPAND_STMT): New. * cp-tree.h (cxx_expand_function_start): Declare. * decl.c (start_function): Use allocate_struct_function. Move stmts_are_full_exprs_p assertion from expand_body. Do not free_after_parsing or free_after_compilation. (cxx_push_function_context): Move code to set struct function data from genrtl_start_function. * optimize.c (optimize_function): Don't inc/dec function_depth. * semantics.c (expand_body): Use tree_rest_of_compilation. (cxx_expand_function_start): Rename from genrtl_start_function, omit bits done by tree_rest_of_compilation. (genrtl_finish_function): Remove. (clear_decl_rtl): Move to ../tree-optimize.c. Co-Authored-By: Jason Merrill <jason@redhat.com> From-SVN: r70933
2003-08-30 01:21:13 +02:00
/* If this function is marked with the constructor attribute, add it
to the list of functions to be called along with constructors
from static duration objects. */
if (DECL_STATIC_CONSTRUCTOR (fn))
static_ctors = tree_cons (NULL_TREE, fn, static_ctors);
/* If this function is marked with the destructor attribute, add it
to the list of functions to be called along with destructors from
static duration objects. */
if (DECL_STATIC_DESTRUCTOR (fn))
static_dtors = tree_cons (NULL_TREE, fn, static_dtors);
if (DECL_CLONED_FUNCTION_P (fn))
{
/* If this is a clone, go through the other clones now and mark
their parameters used. We have to do that here, as we don't
know whether any particular clone will be expanded, and
therefore cannot pick one arbitrarily. */
tree probe;
for (probe = TREE_CHAIN (DECL_CLONED_FUNCTION (fn));
probe && DECL_CLONED_FUNCTION_P (probe);
probe = TREE_CHAIN (probe))
{
tree parms;
for (parms = DECL_ARGUMENTS (probe);
parms; parms = TREE_CHAIN (parms))
TREE_USED (parms) = 1;
}
}
cp-tree.def (STMT_EXPR): New tree node. * cp-tree.def (STMT_EXPR): New tree node. * cp-tree.h (STMT_EXPR_STMT): New macro. (store_return_init): Change prototype. (finish_named_return_value): New function. (expand_stmt): Likewise. (expand_body): Likewise. (begin_stmt_tree): Likewise. (finish_stmt_tree): Likewise. (expanding_p): New variable. (last_expr_type): Likewise. (building_stmt_tree): New macro. * decl.c (start_function): Use building_stmt_tree, not processing_template_decl, where appropriate. (store_parm_decls): Likewise. (store_return_init): Move most of the body to semantics.c. (finish_function): Use building_stmt_tree. (finish_stmt): Clear last_expr_type here. (cp_function): Add expanding_p, last_tree, last_expr_type. (push_cp_function_context): Save them. (pop_cp_function_context): Restore them. * decl2.c (setup_vtbl_ptr): Move to semantics.c. * error.c (dump_expr): Handle STMT_EXPR. * except.c (expand_start_catch_block): Use building_stmt_tree. Use add_decl_stmt. * expr.c (cplus_expand_expr): Handle STMT_EXPR. (do_case): Move add_tree call to semantics.c. * parse.y (return_init): Use finish_named_return_value. (for.init.statement): Use finish_expr_stmt. * parse.c: Regenerated. * pt.c (do_pushlevel): Move to semantics.c. (do_poplevel): Likewise. (tsubst_copy): Handle STMT_EXPR instead of BIND_EXPR. (tsubst_expr): Don't expand all the way to RTL here. Handle RETURN_INIT and CTOR_INITIALIZER. (instantiate_decl): Call expand_body after tsubst'ing into DECL_SAVED_TREE. * semantics.c (expand_stmts): New function. (expanding_p): New variable. (last_expr_type): Likewise. (finish_expr_stmt): Use building_stmt_tree. (begin_if_stmt): Likewise. (finish_if_stmt_cond): Likewise. (finish_then_clause): Likewise. (begin_else_clause): Likewise. (finish_else_clause): Likewise. (begin_while_stmt): Likewise. (finish_while_stmt_cond): Likewise. (finish_while_stmt): Likewise. (finish_do_body): Likewise. (finish_do_stmt): Likewise. (finish_return_stmt): Likewise. (begin_for_stmt): Likewise. (fnish_for_init_stmt): Likewise. (finish_for_cond): Likewise. (finish_for_expr): Likewise. (finish_for_stmt): Likewise. (finish_break_stmt): Likewise. (finish_continue_stmt): Likewise. (finish_switch_cond): Likewise. (finish_switch_stmt): Likewise. (finish_case_label): Call add_tree here if necessary. (finish_goto_statement): Use building_stmt_tree. (begin_try_block): Likewise. (begin_function_try_block): Likewise. (finish_try_block): Likewise. (finish_function_try_block): Likewise. (finish_handler_sequence): Likewise. (finish_function_handler_sequence): Likewise. (begin_handler): Likewise. (finish_handler_parms): Likewise. (finish_handler): Likewise. (begin_compound_stmt): Likewise. (finish_compound_stmt): Likewise. (finish_asm_stmt): Likewise. (finish_label_stmt): Likewise. (finish_named_return_value): New function. (setup_vtbl_ptr): Moved here from decl2.c. (do_pushlevel): Moved here from pt.c. (do_poplevel): Likewise. (begin_stmt_expr): Use building_stmt_tree. (finish_stmt_expr): Likewise. Build a STMT_EXPR, not a BIND_EXPR, when building_stmt_tree. (begin_stmt_tree): New function. (finish_stmt_tree): Likewise. (expand_stmt): Likewise. (expand_body): Likewise. * tree.c (build_cplus_method_type): Make sure the argument types end up on the same obstack as the METHOD_TYPE. (search_tree): Handle COMPOUND_EXPR, MODIFY_EXPR, THROW_EXPR, STMT_EXPR. (mapcar): Break out common cases. Handle COMPOUND_EXPR, MODIFY_EXPR, THROW_EXPR, STMT_EXPR, RTL_EXPR. Abort, rather than sorry, if an unsupported node is encountered. * typeck.c (require_complete_type_in_void): Handle BIND_EXPR. (c_expand_return): Don't call add_tree here. From-SVN: r28729
1999-08-16 21:01:36 +02:00
}
/* Generate RTL for FN. */
void
expand_or_defer_fn (tree fn)
{
/* When the parser calls us after finishing the body of a template
function, we don't really want to expand the body. When we're
processing an in-class definition of an inline function,
PROCESSING_TEMPLATE_DECL will no longer be set here, so we have
to look at the function itself. */
if (processing_template_decl
|| (DECL_LANG_SPECIFIC (fn)
&& DECL_TEMPLATE_INFO (fn)
&& uses_template_parms (DECL_TI_ARGS (fn))))
{
/* Normally, collection only occurs in rest_of_compilation. So,
if we don't collect here, we never collect junk generated
during the processing of templates until we hit a
non-template function. */
ggc_collect ();
return;
}
/* Replace AGGR_INIT_EXPRs with appropriate CALL_EXPRs. */
walk_tree_without_duplicates (&DECL_SAVED_TREE (fn),
simplify_aggr_init_exprs_r,
NULL);
/* If this is a constructor or destructor body, we have to clone
it. */
if (maybe_clone_body (fn))
{
/* We don't want to process FN again, so pretend we've written
it out, even though we haven't. */
TREE_ASM_WRITTEN (fn) = 1;
return;
}
/* There's no reason to do any of the work here if we're only doing
semantic analysis; this code just generates RTL. */
if (flag_syntax_only)
return;
/* Compute the appropriate object-file linkage for inline functions. */
if (DECL_DECLARED_INLINE_P (fn))
import_export_decl (fn);
function_depth++;
/* Expand or defer, at the whim of the compilation unit manager. */
cgraph_finalize_function (fn, function_depth > 1);
function_depth--;
}
/* Helper function for walk_tree, used by finish_function to override all
the RETURN_STMTs and pertinent CLEANUP_STMTs for the named return
value optimization. */
tree
nullify_returns_r (tree* tp, int* walk_subtrees, void* data)
{
tree nrv = (tree) data;
/* No need to walk into types. There wouldn't be any need to walk into
non-statements, except that we have to consider STMT_EXPRs. */
if (TYPE_P (*tp))
*walk_subtrees = 0;
else if (TREE_CODE (*tp) == RETURN_STMT)
RETURN_STMT_EXPR (*tp) = NULL_TREE;
else if (TREE_CODE (*tp) == CLEANUP_STMT
&& CLEANUP_DECL (*tp) == nrv)
CLEANUP_EH_ONLY (*tp) = 1;
/* Keep iterating. */
return NULL_TREE;
}
c-common.h (genrtl_clear_out_block): Remove. * c-common.h (genrtl_clear_out_block): Remove. * c-semantics.c (genrtl_clear_out_block): Remove. (genrtl_while_stmt): Don't call it. (genrtl_for_stmt): Likewise. * cp-tree.h (struct saved_scope): Remove x_function_parms. (current_function_parms): Don't define. (struct cp_language_function): Remove parms_stored. (current_function_just_assigned_this): Don't define. (current_function_parms_stored): Likewise. (static_ctors): Declare. (static_dtors): Likewise. (SF_EXPAND): Don't define. (expand_start_early_try_stmts): Remove declaration. (store_parm_decls): Likewise. * decl.c (static_ctors): Don't declare. (static_dtors): Likewise. (struct binding_level): Remove this_block. (poplevel): Remove dead code. (set_block): Likewise. (mark_binding_level): Don't mark this_block. (mark_saved_scope): Don't mark x_function_parms. (init_decl_processing): Don't add current_function_parms as a GC root. (check_function_type): Change prototype. (start_function): Remove RTL-generation code. (expand_start_early_try_stmts): Remove. (store_parm_decls): Give it internal linkage. Remove RTL-generation code. (finish_function): Remove RTL-generation code. * decl2.c (static_ctors): Fix formatting. (static_dtors): Likewise. * method.c (use_thunk): Don't call store_parm_decls. (synthesize_method): Likewise. * optimize.c (maybe_clone_body): Likewise. * parse.y (fn.def2): Likewise. (.set_base_init): Likewise. (nodecls): Likewise. * pt.c (instantiate_decl): Likewise. * rtti.c (synthesize_tinfo_fn): Likewise. * semantics.c (genrtl_try_block): Simplify. (expand_body): Use genrtl_start_function and genrtl_finish_function. (genrtl_start_function): New function. (genrtl_finish_function): Likewise. From-SVN: r36350
2000-09-12 08:46:00 +02:00
/* Start generating the RTL for FN. */
tree-optimize.c: New file. gcc/ * tree-optimize.c: New file. * Makefile.in (OBJS-archive): Add tree-optimize.o. (tree-optimize.o): New. * c-decl.c (store_parm_decls): Use allocate_struct_function. (finish_function): Don't free_after_parsing or free_after_compilation. (set_save_expr_context): Move to tree-optimize.c. (c_expand_body_1): Use tree_rest_of_compilation. * c-lang.c (LANG_HOOKS_RTL_EXPAND_STMT): New. * objc/objc-lang.c (LANG_HOOKS_RTL_EXPAND_STMT): New. * c-objc-common.c (expand_deferred_fns): Don't emit unused inlines; iterate until closure. * langhooks-def.h (LANG_HOOKS_RTL_EXPAND_START, LANG_HOOKS_RTL_EXPAND_STMT, LANG_HOOKS_RTL_EXPAND_END): New. (LANG_HOOKS_RTL_EXPAND_INITIALIZER): New. * langhooks.h (struct lang_hooks_for_rtl_expansion): New. * toplev.h (tree_rest_of_compilation): Declare it. gcc/cp/ * cp-lang.c (LANG_HOOKS_RTL_EXPAND_START): New. (LANG_HOOKS_RTL_EXPAND_STMT): New. * cp-tree.h (cxx_expand_function_start): Declare. * decl.c (start_function): Use allocate_struct_function. Move stmts_are_full_exprs_p assertion from expand_body. Do not free_after_parsing or free_after_compilation. (cxx_push_function_context): Move code to set struct function data from genrtl_start_function. * optimize.c (optimize_function): Don't inc/dec function_depth. * semantics.c (expand_body): Use tree_rest_of_compilation. (cxx_expand_function_start): Rename from genrtl_start_function, omit bits done by tree_rest_of_compilation. (genrtl_finish_function): Remove. (clear_decl_rtl): Move to ../tree-optimize.c. Co-Authored-By: Jason Merrill <jason@redhat.com> From-SVN: r70933
2003-08-30 01:21:13 +02:00
void
cxx_expand_function_start (void)
c-common.h (genrtl_clear_out_block): Remove. * c-common.h (genrtl_clear_out_block): Remove. * c-semantics.c (genrtl_clear_out_block): Remove. (genrtl_while_stmt): Don't call it. (genrtl_for_stmt): Likewise. * cp-tree.h (struct saved_scope): Remove x_function_parms. (current_function_parms): Don't define. (struct cp_language_function): Remove parms_stored. (current_function_just_assigned_this): Don't define. (current_function_parms_stored): Likewise. (static_ctors): Declare. (static_dtors): Likewise. (SF_EXPAND): Don't define. (expand_start_early_try_stmts): Remove declaration. (store_parm_decls): Likewise. * decl.c (static_ctors): Don't declare. (static_dtors): Likewise. (struct binding_level): Remove this_block. (poplevel): Remove dead code. (set_block): Likewise. (mark_binding_level): Don't mark this_block. (mark_saved_scope): Don't mark x_function_parms. (init_decl_processing): Don't add current_function_parms as a GC root. (check_function_type): Change prototype. (start_function): Remove RTL-generation code. (expand_start_early_try_stmts): Remove. (store_parm_decls): Give it internal linkage. Remove RTL-generation code. (finish_function): Remove RTL-generation code. * decl2.c (static_ctors): Fix formatting. (static_dtors): Likewise. * method.c (use_thunk): Don't call store_parm_decls. (synthesize_method): Likewise. * optimize.c (maybe_clone_body): Likewise. * parse.y (fn.def2): Likewise. (.set_base_init): Likewise. (nodecls): Likewise. * pt.c (instantiate_decl): Likewise. * rtti.c (synthesize_tinfo_fn): Likewise. * semantics.c (genrtl_try_block): Simplify. (expand_body): Use genrtl_start_function and genrtl_finish_function. (genrtl_start_function): New function. (genrtl_finish_function): Likewise. From-SVN: r36350
2000-09-12 08:46:00 +02:00
{
/* Give our named return value the same RTL as our RESULT_DECL. */
if (current_function_return_value)
tree-optimize.c: New file. gcc/ * tree-optimize.c: New file. * Makefile.in (OBJS-archive): Add tree-optimize.o. (tree-optimize.o): New. * c-decl.c (store_parm_decls): Use allocate_struct_function. (finish_function): Don't free_after_parsing or free_after_compilation. (set_save_expr_context): Move to tree-optimize.c. (c_expand_body_1): Use tree_rest_of_compilation. * c-lang.c (LANG_HOOKS_RTL_EXPAND_STMT): New. * objc/objc-lang.c (LANG_HOOKS_RTL_EXPAND_STMT): New. * c-objc-common.c (expand_deferred_fns): Don't emit unused inlines; iterate until closure. * langhooks-def.h (LANG_HOOKS_RTL_EXPAND_START, LANG_HOOKS_RTL_EXPAND_STMT, LANG_HOOKS_RTL_EXPAND_END): New. (LANG_HOOKS_RTL_EXPAND_INITIALIZER): New. * langhooks.h (struct lang_hooks_for_rtl_expansion): New. * toplev.h (tree_rest_of_compilation): Declare it. gcc/cp/ * cp-lang.c (LANG_HOOKS_RTL_EXPAND_START): New. (LANG_HOOKS_RTL_EXPAND_STMT): New. * cp-tree.h (cxx_expand_function_start): Declare. * decl.c (start_function): Use allocate_struct_function. Move stmts_are_full_exprs_p assertion from expand_body. Do not free_after_parsing or free_after_compilation. (cxx_push_function_context): Move code to set struct function data from genrtl_start_function. * optimize.c (optimize_function): Don't inc/dec function_depth. * semantics.c (expand_body): Use tree_rest_of_compilation. (cxx_expand_function_start): Rename from genrtl_start_function, omit bits done by tree_rest_of_compilation. (genrtl_finish_function): Remove. (clear_decl_rtl): Move to ../tree-optimize.c. Co-Authored-By: Jason Merrill <jason@redhat.com> From-SVN: r70933
2003-08-30 01:21:13 +02:00
COPY_DECL_RTL (DECL_RESULT (cfun->decl), current_function_return_value);
}
/* Perform initialization related to this module. */
void
init_cp_semantics (void)
{
lang_expand_stmt = cp_expand_stmt;
}
config-lang.in: Add semantics.c to gtfiles. * config-lang.in: Add semantics.c to gtfiles. * cp-tree.h (flagged_type_tree_s): Remove lookups field. (saved_scope): Likewise. (type_lookups): Remove. (deferred_access): New structure. (type_access_control): Remove. (save_type_access_control): Likewise. (reset_type_access_control): Likewise. (decl_type_access_control): Likewise. (push_deferring_access_checks): Declare. (resume_deferring_access_checks): Likewise. (stop_deferring_access_checks): Likewise. (pop_deferring_access_checks): Likewise. (get_deferred_access_checks): Likewise. (pop_to_parent_deferring_access_checks): Likewise. (perform_deferred_access_checks): Likewise. (perform_or_defer_access_check): Likewise. * decl.c (make_typename_type): Use perform_or_defer_access_check. (make_unbound_class_template): Likewise. (grokdeclarator): Don't call decl_type_access_control. * parser.c (cp_parser_context): Remove deferred_access_checks and deferring_access_checks_p fields. (cp_parser_context_new): Adjust. (cp_parser): Remove access_checks_lists. (cp_parser_defer_access_check): Remove. (cp_parser_start_deferring_access_checks): Remove. (cp_parser_stop_deferring_access_checks): Remove. (cp_parser_perform_deferred_access_checks): Remove. (cp_parser_nested_name_specifier_opt): Use new deferred access functions. (cp_parser_simple_declaration): Likewise. (cp_parser_template_id): Likewise. (cp_parser_function_definition): Likewise. (cp_parser_class_specifier): Likewise. (cp_parser_lookup_name): Likewise. (cp_parser_single_declaration): Likewise. (cp_parser_pre_parsed_nested_name_specifier): Likewise. (cp_parser_parse_tentatively): Likewise. (cp_parser_parse_definitely): Likewise. (yyparse): Likewise. (cp_parser_init_declarator): Remove access_checks parameter. Use new deferred access functions. (cp_parser_function_definition_from_specifiers_and_declarator): Likewise. (cp_parser_class_head): Remove deferring_access_checks_p and saved_access_checks parameters. Use new deferred access functions. (cp_parser_member_specification_opt): Don't call reset_type_access_control. * search.c (type_access_control): Remove. * semantics.c: Include "gt-cp-semantics.h". (deferred_type_access_control): Remove. (deferred_access_stack): New variable. (deferred_access_free_list): Likewise. (push_deferring_access_checks): New function. (resume_deferring_access_checks): Likewise. (stop_deferring_access_checks): Likewise. (pop_deferring_access_checks): Likewise. (get_deferred_access_checks): Likewise. (pop_to_parent_deferring_access_checks): Likewise. (perform_deferred_access_checks): New function, adapted from cp_parser_perform_deferred_access_checks. (perform_or_defer_access_check): New function, adapted from cp_parser_defer_access_check. (current_type_lookups): Remove. (deferred_type_access_control): Likewise. (decl_type_access_control): Likewise. (save_type_access_control): Likewise. (reset_type_access_control): Likewise. (begin_function_definition): Adjust. (begin_class_definiton): Likewise. From-SVN: r61283
2003-01-14 14:40:53 +01:00
#include "gt-cp-semantics.h"