2003-03-30 15:18:18 +02:00
|
|
|
|
/* Declarations for C++ name lookup routines.
|
re PR c++/19030 (ice on tree check)
cp:
PR c++/19030
* cp-tree.h (start_decl): Take pointer to pushed scope, not bool.
* name-lookup.h (push_scope): Return pushed scope, not flag.
* name-lookup.c (push_scope): Return scope that should be popped,
not a flag.
* decl.c (start_decl): Adjust.
(grokfndecl): Adjust scope push and pop.
* decl2.c (check_classfn): Likewise.
* parser.c (cp_parser_condition, cp_parser_conversion_function_id,
cp_parser_init_declarator, cp_parser_direct_declarator,
cp_parser_class_specifier, cp_parser_class_head,
cp_parser_lookup_name,
cp_parser_constructor_declarator_p): Likewise.
* pt.c (instantiate_class_template,
resolve_typename_type): Likewise.
testsuite:
PR c++/19030
* g++.dg/parse/crash22.C: New
From-SVN: r92946
2005-01-05 11:02:35 +01:00
|
|
|
|
Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
|
2003-03-30 15:18:18 +02:00
|
|
|
|
Contributed by Gabriel Dos Reis <gdr@integrable-solutions.net>
|
|
|
|
|
|
2003-03-30 18:00:39 +02:00
|
|
|
|
This file is part of GCC.
|
2003-03-30 15:18:18 +02:00
|
|
|
|
|
2003-03-30 18:00:39 +02:00
|
|
|
|
GCC is free software; you can redistribute it and/or modify
|
2003-03-30 15:18:18 +02:00
|
|
|
|
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.
|
|
|
|
|
|
2003-03-30 18:00:39 +02:00
|
|
|
|
GCC is distributed in the hope that it will be useful,
|
2003-03-30 15:18:18 +02:00
|
|
|
|
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
|
2003-03-30 18:00:39 +02:00
|
|
|
|
along with GCC; see the file COPYING. If not, write to
|
2005-06-25 02:59:41 +02:00
|
|
|
|
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
|
|
|
|
Boston, MA 02110-1301, USA. */
|
2003-03-30 15:18:18 +02:00
|
|
|
|
|
|
|
|
|
#ifndef GCC_CP_NAME_LOOKUP_H
|
|
|
|
|
#define GCC_CP_NAME_LOOKUP_H
|
|
|
|
|
|
|
|
|
|
#include "c-common.h"
|
|
|
|
|
|
2003-05-18 15:40:54 +02:00
|
|
|
|
/* The type of dictionary used to map names to types declared at
|
|
|
|
|
a given scope. */
|
|
|
|
|
typedef struct binding_table_s *binding_table;
|
|
|
|
|
typedef struct binding_entry_s *binding_entry;
|
|
|
|
|
|
|
|
|
|
/* The type of a routine repeatedly called by binding_table_foreach. */
|
|
|
|
|
typedef void (*bt_foreach_proc) (binding_entry, void *);
|
|
|
|
|
|
|
|
|
|
struct binding_entry_s GTY(())
|
|
|
|
|
{
|
|
|
|
|
binding_entry chain;
|
|
|
|
|
tree name;
|
|
|
|
|
tree type;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/* These macros indicate the initial chains count for binding_table. */
|
2005-06-15 02:41:35 +02:00
|
|
|
|
#define SCOPE_DEFAULT_HT_SIZE (1 << 3)
|
|
|
|
|
#define CLASS_SCOPE_HT_SIZE (1 << 3)
|
|
|
|
|
#define NAMESPACE_ORDINARY_HT_SIZE (1 << 5)
|
|
|
|
|
#define NAMESPACE_STD_HT_SIZE (1 << 8)
|
|
|
|
|
#define GLOBAL_SCOPE_HT_SIZE (1 << 8)
|
2003-05-18 15:40:54 +02:00
|
|
|
|
|
|
|
|
|
extern void binding_table_foreach (binding_table, bt_foreach_proc, void *);
|
|
|
|
|
extern binding_entry binding_table_find (binding_table, tree);
|
|
|
|
|
|
2003-03-30 15:18:18 +02:00
|
|
|
|
/* Datatype that represents binding established by a declaration between
|
|
|
|
|
a name and a C++ entity. */
|
|
|
|
|
typedef struct cxx_binding cxx_binding;
|
|
|
|
|
|
2003-03-30 18:00:39 +02:00
|
|
|
|
/* The datatype used to implement C++ scope. */
|
|
|
|
|
typedef struct cp_binding_level cxx_scope;
|
|
|
|
|
|
2003-03-30 15:18:18 +02:00
|
|
|
|
/* Nonzero if this binding is for a local scope, as opposed to a class
|
|
|
|
|
or namespace scope. */
|
|
|
|
|
#define LOCAL_BINDING_P(NODE) ((NODE)->is_local)
|
|
|
|
|
|
2003-09-27 03:55:13 +02:00
|
|
|
|
/* True if NODE->value is from a base class of the class which is
|
2003-03-30 15:18:18 +02:00
|
|
|
|
currently being defined. */
|
|
|
|
|
#define INHERITED_VALUE_BINDING_P(NODE) ((NODE)->value_is_inherited)
|
|
|
|
|
|
|
|
|
|
struct cxx_binding GTY(())
|
|
|
|
|
{
|
|
|
|
|
/* Link to chain together various bindings for this name. */
|
|
|
|
|
cxx_binding *previous;
|
|
|
|
|
/* The non-type entity this name is bound to. */
|
|
|
|
|
tree value;
|
|
|
|
|
/* The type entity this name is bound to. */
|
|
|
|
|
tree type;
|
2003-03-30 18:00:39 +02:00
|
|
|
|
/* The scope at which this binding was made. */
|
|
|
|
|
cxx_scope *scope;
|
2003-03-30 15:18:18 +02:00
|
|
|
|
unsigned value_is_inherited : 1;
|
|
|
|
|
unsigned is_local : 1;
|
|
|
|
|
};
|
|
|
|
|
|
2004-07-11 23:02:31 +02:00
|
|
|
|
/* Datatype used to temporarily save C++ bindings (for implicit
|
|
|
|
|
instantiations purposes and like). Implemented in decl.c. */
|
|
|
|
|
typedef struct cxx_saved_binding GTY(())
|
|
|
|
|
{
|
|
|
|
|
/* The name of the current binding. */
|
|
|
|
|
tree identifier;
|
|
|
|
|
/* The binding we're saving. */
|
|
|
|
|
cxx_binding *binding;
|
|
|
|
|
tree real_type_value;
|
|
|
|
|
} cxx_saved_binding;
|
|
|
|
|
|
vec.h: Update API to separate allocation mechanism from type.
* vec.h: Update API to separate allocation mechanism from type.
(VEC_safe_grow): New.
* vec.c (calculate_allocation): New.
(vec_gc_o_reserve, vec_heap_o_reserve): Adjust.
(vec_gc_free, vec_heap_free): Remove.
* gengtype-lex.l (DEF_VEC_): Process mult-argument macros. Adjust.
(VEC): Likewise.
(mangle_macro_name): New.
(struct macro_def): New.
(struct macro): Add multiple argument values.
(macro_expans_end): New.
(push_macro_expansion): Chain on new macro. Process multiple
args, create follow on expansion. Return follow on argument.
(macro_input): Deal with multiple arguments.
* tree.h: Define VEC(tree,heap) and VEC(tree,gc).
(struct tree_binfo): Adjust.
* basic-block.h: Define VEC(edge,gc).
(struct edge_def): Adjust.
(struct basic_block_def, struct edge_iterator): Likewise.
(ei_container, ei_start_1, ei_last_1): Likewise.
* cfg.c (connect_src, connect_dest): Likewise.
* cfgrtl.c (force_nonfallthru_and_redirect)
* dbxout.c (dbxout_type)
* dwarf2out.c (gen_member_die)
* lambda-code.c: Define VEC(int,gc), VEC(lambda_loop,gc).
(gcc_tree_to_linear_expression): Adjust.
(gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest,
lbv_to_gcc_expression, lle_to_gcc_expression,
lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest,
perfect_nestify): Likewise.
* lambda.h (gcc_loopnest_to_lambda_loopnest,
lambda_loopnest_to_gcc_loopnest): Adjust prototypes.
* profile.c (instrument_values): Adjust.
* tree-cfg.c (modified_noreturn_calls): Adjust.
(remove_fallthru_edge): Likewise.
* tree-dump.c (dequeue_and_dump): Adjust.
* tree-flow-inline.h (mark_stmt_modified): Adjust.
* tree-flow.h (modified_noreturn_calls): Adjust.
(tree_on_heap): Remove. (yay!)
(register_new_def): Adjust.
* tree-into-ssa.c: Define VEC(int,heap).
(block_defs_stack): Adjust.
(find_idf, insert_phi_nodes, register_new_def,
rewrite_initialize_block, rewrite_finalize_block,
register_new_update_single, rewrite_update_init_block,
rewrite_update_fini_block, rewrite_blocks,
ssa_rewrite_finalize_block, ssa_register_new_def,
ssa_rewrite_initialize_block, rewrite_ssa_into_ssa): Likewise.
* tree-loop-linear.c (linear_transform_loops): Adjust.
* tree-ssa-alias.c: Define VEC(fieldoff_t,heap).
(push_fields_onto_fieldstack, create_overlap_variables_for): Adjust.
* tree-ssa-dom.c (avail_exprs_stack, block_defs_stack,
stmts_to_rescan, const_and_copies_stack, nonzero_vars_stack,
vrp_variables_stack): Adjust declarations.
(tree_ssa_dominator_optimize): Adjust.
(dom_opt_initialize_block, remove_local_expressions_from_table,
restore_nonzero_vars_to_original_value,
restore_vars_to_original_value,
restore_currdefs_to_original_value, dom_opt_finalize_block,
record_var_is_nonzero, record_cond, record_const_or_copy_1,
optimize_stmt, update_rhs_and_lookup_avail_expr,
lookup_avail_expr, record_range): Likewise.
* tree-ssa-pre.c: Define VEC(basic_block,heap).
(compute_antic_aux): Adjust.
(inserted_exprs, create_expression_by_pieces,
insert_into_preds_of_block, eliminate, mark_operand_necessary,
remove_dead_inserted_code, fini_pre): Likewise.
* tree-ssa-propagate.c (interesting_ssa_edges): Adjust.
(varying_ssa_edges, add_ssa_edge, process_ssa_edge_worklist.
ssa_prop_init): Likewise.
* tree-ssa.c: Define VEC(bitmap,heap).
(verify_name_tags): Adjust.
* value-prof.c (rtl_divmod_values_to_profile): Adjust.
(insn_prefetch_values_to_profile, rtl_find_values_to_profile,
tree_divmod_values_to_profile, tree_find_values_to_profile,
value_profile_transformations): Likewise.
* value-prof.h: Define VEC(histogram_value,heap).
* varasm.c: Remove alias_pair pointer typedef, define
VEC(alias_pair,gc).
(finish_aliases_1, finish_aliases_2, assemble_alias): Adjust.
* config/pa/pa.c (typedef extern_symbol): Typedef the structure,
not a pointer to it. Create an object vector.
(extern_symbols): Turn into an object vector.
(pa_hpux_asm_output_external, pa_hpux_file_end): Adjust.
* cp/cp-tree.h: Adjust for new VEC API.
Define VEC(tree_pair_s,gc).
(struct save_scope): Adjust.
(struct lang_type_class): Adjust.
(unemitted_tinfo_decls): Adjust.
* cp/class.c (add_method, resort_type_method_vec,
finish_struct_methods, struct find_final_overrider_data,
dfs_find_final_overrider_pre, find_final_overrider,
get_vcall_index, warn_hidden, walk_subobject_offsets,
check_methods, fixup_inline_methods, end_of_class,
warn_about_ambiguous_bases, finish_struct, build_vtbl_initializer,
add_vcall_offset): Adjust.
* cp/decl.c (xref_basetypes, finish_method): Adjust.
* cp/decl2.c (check_classfn): Adjust.
* cp/init.c (sort_mem_initializers, push_base_cleanups): Adjust.
* cp/method.c (do_build_copy_constructor): Adjust.
* cp/name-lookup.c (new_class_binding, store_binding,
store_bindings, store_class_bindings): Adjust.
* cp/name-lookup.h: Define VEC(cxx_saved_binding,gc),
VEC(cp_class_binding,gc).
(struct cp_binding_level): Adjust.
* cp/parser.c: Define VEC(cp_token_position,heap).
(struct cp_lexer): Adjust.
(cp_lexer_new_main, cp_lexer_new_from_tokens, cp_lexer_destroy,
cp_lexer_save_tokens): Adjust.
* cp/pt.c (retrieve_specialization,
check_explicit_specialization): Adjust.
* cp/rtti.c (unemitted_tinfo_decls): Adjust.
(init_rtti_processing, get_tinfo_decl, get_pseudo_ti_init,
get_pseudo_ti_desc): Adjust.
* cp/search.c (dfs_access_in_type, lookup_conversion_operator,
lookup_fnfields_1, dfs_walk_once, dfs_walk_once_accessible,
dfs_get_pure_virtuals, lookup_conversions_r, binfo_for_vbase): Adjust.
* cp/semantics.c: Define VEC(deferred_access,gc).
(push_deferring_access_checks): Adjust.
* cp/typeck2.c (abstract_virtuals_error): Adjust.
From-SVN: r98498
2005-04-21 11:18:28 +02:00
|
|
|
|
DEF_VEC_O(cxx_saved_binding);
|
|
|
|
|
DEF_VEC_ALLOC_O(cxx_saved_binding,gc);
|
2004-07-11 23:02:31 +02:00
|
|
|
|
|
2003-10-13 12:26:36 +02:00
|
|
|
|
extern tree identifier_type_value (tree);
|
|
|
|
|
extern void set_identifier_type_value (tree, tree);
|
|
|
|
|
extern void pop_binding (tree, tree);
|
2003-10-14 10:19:06 +02:00
|
|
|
|
extern tree constructor_name (tree);
|
|
|
|
|
extern bool constructor_name_p (tree, tree);
|
2003-03-30 15:18:18 +02:00
|
|
|
|
|
2003-10-03 22:27:05 +02:00
|
|
|
|
/* The kinds of scopes we recognize. */
|
|
|
|
|
typedef enum scope_kind {
|
|
|
|
|
sk_block = 0, /* An ordinary block scope. This enumerator must
|
|
|
|
|
have the value zero because "cp_binding_level"
|
|
|
|
|
is initialized by using "memset" to set the
|
|
|
|
|
contents to zero, and the default scope kind
|
|
|
|
|
is "sk_block". */
|
2005-06-15 02:41:35 +02:00
|
|
|
|
sk_cleanup, /* A scope for (pseudo-)scope for cleanup. It is
|
|
|
|
|
peusdo in that it is transparent to name lookup
|
|
|
|
|
activities. */
|
2003-10-03 22:27:05 +02:00
|
|
|
|
sk_try, /* A try-block. */
|
2005-06-15 02:41:35 +02:00
|
|
|
|
sk_catch, /* A catch-block. */
|
|
|
|
|
sk_for, /* The scope of the variable declared in a
|
2003-10-03 22:27:05 +02:00
|
|
|
|
for-init-statement. */
|
|
|
|
|
sk_function_parms, /* The scope containing function parameters. */
|
2005-06-15 02:41:35 +02:00
|
|
|
|
sk_class, /* The scope containing the members of a class. */
|
|
|
|
|
sk_namespace, /* The scope containing the members of a
|
2003-10-03 22:27:05 +02:00
|
|
|
|
namespace, including the global scope. */
|
|
|
|
|
sk_template_parms, /* A scope for template parameters. */
|
|
|
|
|
sk_template_spec /* Like sk_template_parms, but for an explicit
|
|
|
|
|
specialization. Since, by definition, an
|
|
|
|
|
explicit specialization is introduced by
|
|
|
|
|
"template <>", this scope is always empty. */
|
|
|
|
|
} scope_kind;
|
|
|
|
|
|
Friend class name lookup 2/n, PR c++/14513, c++/15410
Friend class name lookup 2/n, PR c++/14513, c++/15410
* name-lookup.c (lookup_name_real): Simplify.
(lookup_type_scope): Add SCOPE parameter. Handle friend class
lookup.
* name-lookup.h (tag_scope): New enum type.
(lookup_type_scope): Adjust declaration.
* decl.c (lookup_and_check_tag, xref_tag, xref_tag_from_type):
Change bool parameter GLOBALIZED to TAG_SCOPE parameter SCOPE.
(start_enum): Likewise. Add assertion test that NAME is
IDENTIFIER_NODE. Use anonymous name for dummy ENUMERAL_TYPE in
case of error.
* cp-tree.h (xref_tag, xref_tag_from_type): Adjust declarations.
* parser.c (cp_parser_elaborated_type_specifier,
cp_parser_class_head): Adjust call to xref_tag.
* pt.c (lookup_template_class, instantiate_class_template):
Likewise.
* rtti.c (init_rtti_processing, build_dynamic_cast_1,
tinfo_base_init, emit_support_tinfos): Likewise.
* g++.dg/lookup/friend2.C: New test.
* g++.dg/template/friend31.C: Likewise.
From-SVN: r91299
2004-11-25 17:55:34 +01:00
|
|
|
|
/* The scope where the class/struct/union/enum tag applies. */
|
|
|
|
|
typedef enum tag_scope {
|
|
|
|
|
ts_current = 0, /* Current scope only. This is for the
|
|
|
|
|
class-key identifier;
|
|
|
|
|
case mentioned in [basic.lookup.elab]/2,
|
|
|
|
|
or the class/enum definition
|
|
|
|
|
class-key identifier { ... }; */
|
|
|
|
|
ts_global = 1, /* All scopes. This is the 3.4.1
|
|
|
|
|
[basic.lookup.unqual] lookup mentioned
|
|
|
|
|
in [basic.lookup.elab]/2. */
|
|
|
|
|
ts_within_enclosing_non_class = 2 /* Search within enclosing non-class
|
|
|
|
|
only, for friend class lookup
|
|
|
|
|
according to [namespace.memdef]/3
|
|
|
|
|
and [class.friend]/9. */
|
|
|
|
|
} tag_scope;
|
|
|
|
|
|
2004-07-08 06:32:27 +02:00
|
|
|
|
typedef struct cp_class_binding GTY(())
|
|
|
|
|
{
|
|
|
|
|
cxx_binding base;
|
|
|
|
|
/* The bound name. */
|
|
|
|
|
tree identifier;
|
|
|
|
|
} cp_class_binding;
|
|
|
|
|
|
vec.h: Update API to separate allocation mechanism from type.
* vec.h: Update API to separate allocation mechanism from type.
(VEC_safe_grow): New.
* vec.c (calculate_allocation): New.
(vec_gc_o_reserve, vec_heap_o_reserve): Adjust.
(vec_gc_free, vec_heap_free): Remove.
* gengtype-lex.l (DEF_VEC_): Process mult-argument macros. Adjust.
(VEC): Likewise.
(mangle_macro_name): New.
(struct macro_def): New.
(struct macro): Add multiple argument values.
(macro_expans_end): New.
(push_macro_expansion): Chain on new macro. Process multiple
args, create follow on expansion. Return follow on argument.
(macro_input): Deal with multiple arguments.
* tree.h: Define VEC(tree,heap) and VEC(tree,gc).
(struct tree_binfo): Adjust.
* basic-block.h: Define VEC(edge,gc).
(struct edge_def): Adjust.
(struct basic_block_def, struct edge_iterator): Likewise.
(ei_container, ei_start_1, ei_last_1): Likewise.
* cfg.c (connect_src, connect_dest): Likewise.
* cfgrtl.c (force_nonfallthru_and_redirect)
* dbxout.c (dbxout_type)
* dwarf2out.c (gen_member_die)
* lambda-code.c: Define VEC(int,gc), VEC(lambda_loop,gc).
(gcc_tree_to_linear_expression): Adjust.
(gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest,
lbv_to_gcc_expression, lle_to_gcc_expression,
lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest,
perfect_nestify): Likewise.
* lambda.h (gcc_loopnest_to_lambda_loopnest,
lambda_loopnest_to_gcc_loopnest): Adjust prototypes.
* profile.c (instrument_values): Adjust.
* tree-cfg.c (modified_noreturn_calls): Adjust.
(remove_fallthru_edge): Likewise.
* tree-dump.c (dequeue_and_dump): Adjust.
* tree-flow-inline.h (mark_stmt_modified): Adjust.
* tree-flow.h (modified_noreturn_calls): Adjust.
(tree_on_heap): Remove. (yay!)
(register_new_def): Adjust.
* tree-into-ssa.c: Define VEC(int,heap).
(block_defs_stack): Adjust.
(find_idf, insert_phi_nodes, register_new_def,
rewrite_initialize_block, rewrite_finalize_block,
register_new_update_single, rewrite_update_init_block,
rewrite_update_fini_block, rewrite_blocks,
ssa_rewrite_finalize_block, ssa_register_new_def,
ssa_rewrite_initialize_block, rewrite_ssa_into_ssa): Likewise.
* tree-loop-linear.c (linear_transform_loops): Adjust.
* tree-ssa-alias.c: Define VEC(fieldoff_t,heap).
(push_fields_onto_fieldstack, create_overlap_variables_for): Adjust.
* tree-ssa-dom.c (avail_exprs_stack, block_defs_stack,
stmts_to_rescan, const_and_copies_stack, nonzero_vars_stack,
vrp_variables_stack): Adjust declarations.
(tree_ssa_dominator_optimize): Adjust.
(dom_opt_initialize_block, remove_local_expressions_from_table,
restore_nonzero_vars_to_original_value,
restore_vars_to_original_value,
restore_currdefs_to_original_value, dom_opt_finalize_block,
record_var_is_nonzero, record_cond, record_const_or_copy_1,
optimize_stmt, update_rhs_and_lookup_avail_expr,
lookup_avail_expr, record_range): Likewise.
* tree-ssa-pre.c: Define VEC(basic_block,heap).
(compute_antic_aux): Adjust.
(inserted_exprs, create_expression_by_pieces,
insert_into_preds_of_block, eliminate, mark_operand_necessary,
remove_dead_inserted_code, fini_pre): Likewise.
* tree-ssa-propagate.c (interesting_ssa_edges): Adjust.
(varying_ssa_edges, add_ssa_edge, process_ssa_edge_worklist.
ssa_prop_init): Likewise.
* tree-ssa.c: Define VEC(bitmap,heap).
(verify_name_tags): Adjust.
* value-prof.c (rtl_divmod_values_to_profile): Adjust.
(insn_prefetch_values_to_profile, rtl_find_values_to_profile,
tree_divmod_values_to_profile, tree_find_values_to_profile,
value_profile_transformations): Likewise.
* value-prof.h: Define VEC(histogram_value,heap).
* varasm.c: Remove alias_pair pointer typedef, define
VEC(alias_pair,gc).
(finish_aliases_1, finish_aliases_2, assemble_alias): Adjust.
* config/pa/pa.c (typedef extern_symbol): Typedef the structure,
not a pointer to it. Create an object vector.
(extern_symbols): Turn into an object vector.
(pa_hpux_asm_output_external, pa_hpux_file_end): Adjust.
* cp/cp-tree.h: Adjust for new VEC API.
Define VEC(tree_pair_s,gc).
(struct save_scope): Adjust.
(struct lang_type_class): Adjust.
(unemitted_tinfo_decls): Adjust.
* cp/class.c (add_method, resort_type_method_vec,
finish_struct_methods, struct find_final_overrider_data,
dfs_find_final_overrider_pre, find_final_overrider,
get_vcall_index, warn_hidden, walk_subobject_offsets,
check_methods, fixup_inline_methods, end_of_class,
warn_about_ambiguous_bases, finish_struct, build_vtbl_initializer,
add_vcall_offset): Adjust.
* cp/decl.c (xref_basetypes, finish_method): Adjust.
* cp/decl2.c (check_classfn): Adjust.
* cp/init.c (sort_mem_initializers, push_base_cleanups): Adjust.
* cp/method.c (do_build_copy_constructor): Adjust.
* cp/name-lookup.c (new_class_binding, store_binding,
store_bindings, store_class_bindings): Adjust.
* cp/name-lookup.h: Define VEC(cxx_saved_binding,gc),
VEC(cp_class_binding,gc).
(struct cp_binding_level): Adjust.
* cp/parser.c: Define VEC(cp_token_position,heap).
(struct cp_lexer): Adjust.
(cp_lexer_new_main, cp_lexer_new_from_tokens, cp_lexer_destroy,
cp_lexer_save_tokens): Adjust.
* cp/pt.c (retrieve_specialization,
check_explicit_specialization): Adjust.
* cp/rtti.c (unemitted_tinfo_decls): Adjust.
(init_rtti_processing, get_tinfo_decl, get_pseudo_ti_init,
get_pseudo_ti_desc): Adjust.
* cp/search.c (dfs_access_in_type, lookup_conversion_operator,
lookup_fnfields_1, dfs_walk_once, dfs_walk_once_accessible,
dfs_get_pure_virtuals, lookup_conversions_r, binfo_for_vbase): Adjust.
* cp/semantics.c: Define VEC(deferred_access,gc).
(push_deferring_access_checks): Adjust.
* cp/typeck2.c (abstract_virtuals_error): Adjust.
From-SVN: r98498
2005-04-21 11:18:28 +02:00
|
|
|
|
DEF_VEC_O(cp_class_binding);
|
|
|
|
|
DEF_VEC_ALLOC_O(cp_class_binding,gc);
|
2004-07-08 06:32:27 +02:00
|
|
|
|
|
2003-10-03 22:27:05 +02:00
|
|
|
|
/* For each binding contour we allocate a binding_level structure
|
|
|
|
|
which records the names defined in that contour.
|
|
|
|
|
Contours include:
|
|
|
|
|
0) the global one
|
|
|
|
|
1) one for each function definition,
|
|
|
|
|
where internal declarations of the parameters appear.
|
|
|
|
|
2) one for each compound statement,
|
|
|
|
|
to record its declarations.
|
|
|
|
|
|
|
|
|
|
The current meaning of a name can be found by searching the levels
|
|
|
|
|
from the current one out to the global one.
|
|
|
|
|
|
|
|
|
|
Off to the side, may be the class_binding_level. This exists only
|
|
|
|
|
to catch class-local declarations. It is otherwise nonexistent.
|
|
|
|
|
|
|
|
|
|
Also there may be binding levels that catch cleanups that must be
|
|
|
|
|
run when exceptions occur. Thus, to see whether a name is bound in
|
|
|
|
|
the current scope, it is not enough to look in the
|
|
|
|
|
CURRENT_BINDING_LEVEL. You should use lookup_name_current_level
|
|
|
|
|
instead. */
|
|
|
|
|
|
|
|
|
|
/* Note that the information in the `names' component of the global contour
|
|
|
|
|
is duplicated in the IDENTIFIER_GLOBAL_VALUEs of all identifiers. */
|
|
|
|
|
|
|
|
|
|
struct cp_binding_level GTY(())
|
|
|
|
|
{
|
|
|
|
|
/* A chain of _DECL nodes for all variables, constants, functions,
|
|
|
|
|
and typedef types. These are in the reverse of the order
|
|
|
|
|
supplied. There may be OVERLOADs on this list, too, but they
|
|
|
|
|
are wrapped in TREE_LISTs; the TREE_VALUE is the OVERLOAD. */
|
|
|
|
|
tree names;
|
|
|
|
|
|
|
|
|
|
/* Count of elements in names chain. */
|
|
|
|
|
size_t names_size;
|
|
|
|
|
|
|
|
|
|
/* A chain of NAMESPACE_DECL nodes. */
|
|
|
|
|
tree namespaces;
|
|
|
|
|
|
|
|
|
|
/* An array of static functions and variables (for namespaces only) */
|
2005-05-07 04:29:34 +02:00
|
|
|
|
VEC(tree,gc) *static_decls;
|
2003-10-03 22:27:05 +02:00
|
|
|
|
|
|
|
|
|
/* A chain of VTABLE_DECL nodes. */
|
2005-06-14 22:01:59 +02:00
|
|
|
|
tree vtables;
|
2003-10-03 22:27:05 +02:00
|
|
|
|
|
|
|
|
|
/* A list of USING_DECL nodes. */
|
|
|
|
|
tree usings;
|
|
|
|
|
|
|
|
|
|
/* A list of used namespaces. PURPOSE is the namespace,
|
|
|
|
|
VALUE the common ancestor with this binding_level's namespace. */
|
|
|
|
|
tree using_directives;
|
|
|
|
|
|
2004-07-08 16:53:42 +02:00
|
|
|
|
/* For the binding level corresponding to a class, the entities
|
|
|
|
|
declared in the class or its base classes. */
|
vec.h: Update API to separate allocation mechanism from type.
* vec.h: Update API to separate allocation mechanism from type.
(VEC_safe_grow): New.
* vec.c (calculate_allocation): New.
(vec_gc_o_reserve, vec_heap_o_reserve): Adjust.
(vec_gc_free, vec_heap_free): Remove.
* gengtype-lex.l (DEF_VEC_): Process mult-argument macros. Adjust.
(VEC): Likewise.
(mangle_macro_name): New.
(struct macro_def): New.
(struct macro): Add multiple argument values.
(macro_expans_end): New.
(push_macro_expansion): Chain on new macro. Process multiple
args, create follow on expansion. Return follow on argument.
(macro_input): Deal with multiple arguments.
* tree.h: Define VEC(tree,heap) and VEC(tree,gc).
(struct tree_binfo): Adjust.
* basic-block.h: Define VEC(edge,gc).
(struct edge_def): Adjust.
(struct basic_block_def, struct edge_iterator): Likewise.
(ei_container, ei_start_1, ei_last_1): Likewise.
* cfg.c (connect_src, connect_dest): Likewise.
* cfgrtl.c (force_nonfallthru_and_redirect)
* dbxout.c (dbxout_type)
* dwarf2out.c (gen_member_die)
* lambda-code.c: Define VEC(int,gc), VEC(lambda_loop,gc).
(gcc_tree_to_linear_expression): Adjust.
(gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest,
lbv_to_gcc_expression, lle_to_gcc_expression,
lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest,
perfect_nestify): Likewise.
* lambda.h (gcc_loopnest_to_lambda_loopnest,
lambda_loopnest_to_gcc_loopnest): Adjust prototypes.
* profile.c (instrument_values): Adjust.
* tree-cfg.c (modified_noreturn_calls): Adjust.
(remove_fallthru_edge): Likewise.
* tree-dump.c (dequeue_and_dump): Adjust.
* tree-flow-inline.h (mark_stmt_modified): Adjust.
* tree-flow.h (modified_noreturn_calls): Adjust.
(tree_on_heap): Remove. (yay!)
(register_new_def): Adjust.
* tree-into-ssa.c: Define VEC(int,heap).
(block_defs_stack): Adjust.
(find_idf, insert_phi_nodes, register_new_def,
rewrite_initialize_block, rewrite_finalize_block,
register_new_update_single, rewrite_update_init_block,
rewrite_update_fini_block, rewrite_blocks,
ssa_rewrite_finalize_block, ssa_register_new_def,
ssa_rewrite_initialize_block, rewrite_ssa_into_ssa): Likewise.
* tree-loop-linear.c (linear_transform_loops): Adjust.
* tree-ssa-alias.c: Define VEC(fieldoff_t,heap).
(push_fields_onto_fieldstack, create_overlap_variables_for): Adjust.
* tree-ssa-dom.c (avail_exprs_stack, block_defs_stack,
stmts_to_rescan, const_and_copies_stack, nonzero_vars_stack,
vrp_variables_stack): Adjust declarations.
(tree_ssa_dominator_optimize): Adjust.
(dom_opt_initialize_block, remove_local_expressions_from_table,
restore_nonzero_vars_to_original_value,
restore_vars_to_original_value,
restore_currdefs_to_original_value, dom_opt_finalize_block,
record_var_is_nonzero, record_cond, record_const_or_copy_1,
optimize_stmt, update_rhs_and_lookup_avail_expr,
lookup_avail_expr, record_range): Likewise.
* tree-ssa-pre.c: Define VEC(basic_block,heap).
(compute_antic_aux): Adjust.
(inserted_exprs, create_expression_by_pieces,
insert_into_preds_of_block, eliminate, mark_operand_necessary,
remove_dead_inserted_code, fini_pre): Likewise.
* tree-ssa-propagate.c (interesting_ssa_edges): Adjust.
(varying_ssa_edges, add_ssa_edge, process_ssa_edge_worklist.
ssa_prop_init): Likewise.
* tree-ssa.c: Define VEC(bitmap,heap).
(verify_name_tags): Adjust.
* value-prof.c (rtl_divmod_values_to_profile): Adjust.
(insn_prefetch_values_to_profile, rtl_find_values_to_profile,
tree_divmod_values_to_profile, tree_find_values_to_profile,
value_profile_transformations): Likewise.
* value-prof.h: Define VEC(histogram_value,heap).
* varasm.c: Remove alias_pair pointer typedef, define
VEC(alias_pair,gc).
(finish_aliases_1, finish_aliases_2, assemble_alias): Adjust.
* config/pa/pa.c (typedef extern_symbol): Typedef the structure,
not a pointer to it. Create an object vector.
(extern_symbols): Turn into an object vector.
(pa_hpux_asm_output_external, pa_hpux_file_end): Adjust.
* cp/cp-tree.h: Adjust for new VEC API.
Define VEC(tree_pair_s,gc).
(struct save_scope): Adjust.
(struct lang_type_class): Adjust.
(unemitted_tinfo_decls): Adjust.
* cp/class.c (add_method, resort_type_method_vec,
finish_struct_methods, struct find_final_overrider_data,
dfs_find_final_overrider_pre, find_final_overrider,
get_vcall_index, warn_hidden, walk_subobject_offsets,
check_methods, fixup_inline_methods, end_of_class,
warn_about_ambiguous_bases, finish_struct, build_vtbl_initializer,
add_vcall_offset): Adjust.
* cp/decl.c (xref_basetypes, finish_method): Adjust.
* cp/decl2.c (check_classfn): Adjust.
* cp/init.c (sort_mem_initializers, push_base_cleanups): Adjust.
* cp/method.c (do_build_copy_constructor): Adjust.
* cp/name-lookup.c (new_class_binding, store_binding,
store_bindings, store_class_bindings): Adjust.
* cp/name-lookup.h: Define VEC(cxx_saved_binding,gc),
VEC(cp_class_binding,gc).
(struct cp_binding_level): Adjust.
* cp/parser.c: Define VEC(cp_token_position,heap).
(struct cp_lexer): Adjust.
(cp_lexer_new_main, cp_lexer_new_from_tokens, cp_lexer_destroy,
cp_lexer_save_tokens): Adjust.
* cp/pt.c (retrieve_specialization,
check_explicit_specialization): Adjust.
* cp/rtti.c (unemitted_tinfo_decls): Adjust.
(init_rtti_processing, get_tinfo_decl, get_pseudo_ti_init,
get_pseudo_ti_desc): Adjust.
* cp/search.c (dfs_access_in_type, lookup_conversion_operator,
lookup_fnfields_1, dfs_walk_once, dfs_walk_once_accessible,
dfs_get_pure_virtuals, lookup_conversions_r, binfo_for_vbase): Adjust.
* cp/semantics.c: Define VEC(deferred_access,gc).
(push_deferring_access_checks): Adjust.
* cp/typeck2.c (abstract_virtuals_error): Adjust.
From-SVN: r98498
2005-04-21 11:18:28 +02:00
|
|
|
|
VEC(cp_class_binding,gc) *class_shadowed;
|
2003-10-03 22:27:05 +02:00
|
|
|
|
|
|
|
|
|
/* Similar to class_shadowed, but for IDENTIFIER_TYPE_VALUE, and
|
2004-07-08 16:53:42 +02:00
|
|
|
|
is used for all binding levels. The TREE_PURPOSE is the name of
|
|
|
|
|
the entity, the TREE_TYPE is the associated type. In addition
|
|
|
|
|
the TREE_VALUE is the IDENTIFIER_TYPE_VALUE before we entered
|
|
|
|
|
the class. */
|
2003-10-03 22:27:05 +02:00
|
|
|
|
tree type_shadowed;
|
|
|
|
|
|
|
|
|
|
/* A TREE_LIST. Each TREE_VALUE is the LABEL_DECL for a local
|
|
|
|
|
label in this scope. The TREE_PURPOSE is the previous value of
|
|
|
|
|
the IDENTIFIER_LABEL VALUE. */
|
|
|
|
|
tree shadowed_labels;
|
|
|
|
|
|
|
|
|
|
/* For each level (except not the global one),
|
|
|
|
|
a chain of BLOCK nodes for all the levels
|
|
|
|
|
that were entered and exited one level down. */
|
|
|
|
|
tree blocks;
|
|
|
|
|
|
|
|
|
|
/* The entity (namespace, class, function) the scope of which this
|
|
|
|
|
binding contour corresponds to. Otherwise NULL. */
|
|
|
|
|
tree this_entity;
|
|
|
|
|
|
|
|
|
|
/* The binding level which this one is contained in (inherits from). */
|
|
|
|
|
struct cp_binding_level *level_chain;
|
|
|
|
|
|
|
|
|
|
/* List of VAR_DECLS saved from a previous for statement.
|
|
|
|
|
These would be dead in ISO-conforming code, but might
|
|
|
|
|
be referenced in ARM-era code. These are stored in a
|
|
|
|
|
TREE_LIST; the TREE_VALUE is the actual declaration. */
|
|
|
|
|
tree dead_vars_from_for;
|
|
|
|
|
|
c-common.c (lang_gimplify_stmt): Remove next_p argument.
* c-common.c (lang_gimplify_stmt): Remove next_p argument.
(if_elt, if_stack, if_stack_space, c_expand_start_cond, c_finish_then,
c_expand_end_cond, c_expand_start_else, c_finish_else, c_begin_if_stmt,
c_begin_while_stmt, c_finish_while_stmt_cond): Move to c-typeck.c.
(finish_fname_decls, fname_decl): Use statement_lists.
(c_expand_expr_stmt): Don't set last_expr_type.
(c_type_hash): Fix indentation.
(c_safe_from_p): Don't follow TREE_CHAIN.
(c_tree_chain_matters_p): Remove.
* c-common.def (SCOPE_STMT): Remove.
(CLEANUP_STMT): Redefine to contain its own body.
* c-common.h (struct stmt_tree_s): Remove x_last_stmt,
x_last_expr_type, x_last_expr_filename, x_scope_stmt_stack.
Add x_cur_stmt_list.
(last_tree, last_expr_type, last_expr_filename, RECHAIN_STMTS): Remove.
(cur_stmt_list): New.
(STATEMENT_LIST_STMT_EXPR): New.
(SCOPE_BEGIN_P, SCOPE_END_P, SCOPE_STMT_BLOCK, SCOPE_NULLIFIED_P,
SCOPE_NO_CLEANUPS_P, SCOPE_PARTIAL_P, NEW_FOR_SCOPE_P): Remove.
(CLEANUP_BODY): New.
(CLEANUP_DECL): Move to operand 2.
(c_common_stmt_codes): Remove SCOPE_STMT.
(COMPOUND_STMT_NO_SCOPE, COMPOUND_STMT_BODY_BLOCK): Remove.
* c-decl.c (c_scope_stmt_stack, current_scope_stmt_stack): Remove.
(c_push_function_context, c_pop_function_context): Don't save it.
(finish_decl): Set TREE_USED on the decl for a cleanup.
Use push_cleanup.
(store_parm_decls): Use statement lists.
(finish_function): Remove compstmt rule workaround. Use statement
lists. Call finish_fname_decls after finalizing the body.
(c_begin_compound_stmt): Move to c-typeck.c.
* c-dump.c (c_dump_tree): Remove SCOPE_STMT.
* c-gimplify.c (gimplify_cleanup_stmt, gimplify_cleanup_stmts): New.
(c_genericize): Invoke them.
(c_gimplify_stmt): Don't look through TREE_CHAIN. Kill SCOPE_STMT.
(c_build_bind_expr): Export.
(gimplify_block, gimplify_cleanup): Remove.
(gimplify_condition): Use gimplify_stmt.
(gimplify_for_stmt): Remove FOR_INIT_STMT chaining hack.
(gimplify_if_stmt): Remove recursion hack.
(c_gimplify_expr): Remove STMT_EXPR handling.
(stmt_expr_last_stmt, gimplify_stmt_expr): Remove.
(is_last_stmt_of_scope): Remove.
* c-lang.c (LANG_HOOKS_TREE_INLINING_TREE_CHAIN_MATTERS_P): Remove.
* c-mudflap.c (mflang_flush_calls): Use c_begin_compound_stmt,
c_end_compound_stmt.
* c-objc-common.c (build_cdtor): Likewise.
* c-parse.in (primary): Use c_finish_stmt_expr.
(push_scope, pop_scope): Remove.
(c99_block_start, compstmt_start): Use c_begin_compound_stmt.
(c99_block_end, compstmt): Use c_end_compound_stmt.
(c99_block_lineno_labeled_stmt): Likewise.
(compstmt_primary_start): Use c_begin_stmt_expr.
(simple_if, select_or_iter_stmt): Update calls to stmt builders.
(do_stmt_start): Fill in body directly.
(lineno_stmt): Avoid setting lineno on constants.
* c-pretty-print.c (pp_c_statement): Handle STATEMENT_LIST.
Remove SCOPE_STMT.
* c-semantics.c (begin_stmt_tree): Remove.
(push_stmt_list, re_push_stmt_list, pop_stmt_list): New.
(add_stmt): Use statement lists.
(add_scope_stmt, finish_stmt_tree): Remove.
(push_cleanup): New.
* c-tree.h: Move some decls from c-common.h.
* c-typeck.c (c_tree_expr_nonnegative_p): Simplify for statement lists.
(do_case, c_finish_case): Likewise.
(c_finish_then): Take body for then as argument.
(c_finish_else): Similarly.
(c_begin_for_stmt, c_finish_for_stmt_init, c_finish_for_stmt_cond,
c_finish_for_stmt_incr, c_finish_for_stmt): New.
(c_begin_stmt_expr, c_finish_stmt_expr): New.
(c_begin_compound_stmt): Do scope management.
(c_end_compound_stmt): New.
* fold-const.c (tree_expr_nonnegative_p): Fix BIND_EXPR.
* gimplify.c (voidify_wrapper_expr): Accept temporary argument.
Look through exception handling constructs.
(gimplify_bind_expr): Accept temporary argument.
(gimplify_target_expr): Special case BIND_EXPR bodies.
(gimplify_expr): Handle fallback == fb_none like a statement.
* langhooks-def.h (LANG_HOOKS_TREE_INLINING_TREE_CHAIN_MATTERS_P): Kill.
* langhooks.c (lhd_tree_inlining_tree_chain_matters_p): Remove.
* langhooks.h (tree_chain_matters_p): Remove.
* stub-objc.c (objc_clear_super_receiver): New.
* tree-gimple.h (voidify_wrapper_expr): Update decl.
(append_to_statement_list, append_to_statement_list_force): Move
to tree-iterator.h.
* tree-inline.c (expand_call_inline): Update call.
(clone_body): Use statement lists.
(walk_tree): Don't check tree_chain_matters_p.
(copy_tree_r): Likewise.
* tree-iterator.c (alloc_stmt_list): Clear lang bits.
(tsi_link_before, tsi_link_after): Set TREE_SIDE_EFFECTS properly.
* tree-iterator.h (append_to_statement_list,
append_to_statement_list_force): Moved from tree-gimple.h.
* tree-pretty-print.c (dump_generic_node): Clean up TARGET_EXPR dump.
* objc/objc-act.c (build_module_descriptor): Use c_begin_compound_stmt.
(objc_enter_block): Likewise.
(objc_exit_block): Use c_end_compound_stmt.
(objc_build_try_enter_fragment): Add #error and comment for
rewriting for OBJCPLUS.
(objc_build_extract_fragment, objc_build_try_epilogue,
objc_build_catch_stmt, objc_build_finally_prologue,
objc_build_finally_epilogue): Update for C statement builders.
* objc/objc-lang.c (LANG_HOOKS_TREE_INLINING_TREE_CHAIN_MATTERS_P):
Remove.
cp/
* call.c (initialize_reference): Don't build CLEANUP_STMT here.
* cp-gimplify.c (cp_gimplify_stmt): Remove next_p argument.
(genericize_try_block): Use gimplify_stmt.
(genericize_catch_block, genericize_eh_spec_block): Likewise.
(cp_gimplify_init_expr): Remove STMT_EXPR special case.
(gimplify_must_not_throw_expr): Update voidify_wrapper_expr call.
* cp-lang.c (LANG_HOOKS_TREE_INLINING_TREE_CHAIN_MATTERS_P): Remove.
(cp_tree_chain_matters_p): Remove.
* cp-tree.h (COMPOUND_STMT_TRY_BLOCK): New.
(COMPOUND_STMT_BODY_BLOCK): New.
(STATEMENT_LIST_NO_SCOPE, STATEMENT_LIST_TRY_BLOCK): New.
(EXPR_STMT_STMT_EXPR_RESULT): New.
(building_stmt_tree): Check cur_stmt_list.
(tf_stmt_expr_cmpd, tf_stmt_expr_body): Remove.
(BCS_NO_SCOPE, BCS_TRY_BLOCK, BCS_FN_BODY): New.
* decl.c (poplevel): Use pop_stmt_list for minding cleanups.
(cp_finish_decl): Use push_cleanup.
(start_function, finish_function): Use statement lists.
(finish_stmt): Do nothing.
* except.c (begin_eh_spec_block): Use statement lists.
(check_handlers_1, check_handlers): Likewise.
* init.c (construct_virtual_base): Don't add extra compound stmts.
(build_vec_init): Likewise.
* name-lookup.c (maybe_push_cleanup_level): Use statement lists.
* name-lookup.h (struct cp_binding_level): Add statement_list.
* parser.c (cp_parser_statement): Take the STMT_EXPR node, not a bool.
(cp_parser_labeled_statement, cp_parser_expression_statement,
cp_parser_statement_seq_opt): Likewise.
(cp_parser_compound_statement): Likewise. Take bool for try block.
(cp_parser_selection_statement): Tidy if processing.
(cp_parser_already_scoped_statement): Rewrite to do what it says.
* pt.c (tsubst_copy): Move STMT_EXPR to tsubst_expr.
(tsubst_expr): Rewrite STMT_EXPR processing. Handle STATEMENT_LIST.
Mind COMPOUND_STMT_TRY_BLOCK, EXPR_STMT_STMT_EXPR_RESULT.
* semantics.c (do_poplevel, do_pushlevel): Use statement lists.
(finish_cond): New, rewritten from FINISH_COND.
(simplify_loop_decl_cond): New.
(finish_expr_stmt): Avoid nested EXPR_STMTs.
(begin_if_stmt, finish_if_stmt_cond, finish_then_clause,
begin_else_clause, finish_else_clause, finish_if_stmt,
begin_while_stmt, finish_while_stmt_cond, finish_while_stmt,
begin_do_stmt, finish_do_body, begin_for_stmt, finish_for_init_stmt,
finish_for_cond, finish_for_stmt, begin_switch_stmt,
finish_switch_cond, finish_switch_stmt, begin_try_block,
finish_try_block, finish_cleanup_try_block, finish_function_try_block,
finish_handler_sequence, finish_function_handler_sequence,
begin_handler, finish_handler_parms, finish_handler,
begin_stmt_expr, finish_stmt_expr_expr, finish_stmt_expr): Rewrite
using statement lists.
(begin_compound_stmt): Replace has_no_scope argument with flags.
Update all callers. Use statement lists.
(finish_compound_stmt): Likewise.
(finish_decl_cleanup, finish_eh_cleanup): Use push_cleanup.
(current_scope_stmt_stack): Remove.
(simplify_aggr_init_expr): Don't muck with TREE_CHAIN.
* typeck2.c (split_nonconstant_init_1, split_nonconstant_init):
Rewrite with statement lists.
testsuite/
* g++.dg/ext/stmtexpr1.C: XFAIL.
* gcc.dg/20030612-1.c: XFAIL.
From-SVN: r83221
2004-06-16 03:21:38 +02:00
|
|
|
|
/* STATEMENT_LIST for statements in this binding contour.
|
|
|
|
|
Only used at present for SK_CLEANUP temporary bindings. */
|
|
|
|
|
tree statement_list;
|
|
|
|
|
|
2003-10-03 22:27:05 +02:00
|
|
|
|
/* Binding depth at which this level began. */
|
|
|
|
|
int binding_depth;
|
|
|
|
|
|
|
|
|
|
/* The kind of scope that this object represents. However, a
|
|
|
|
|
SK_TEMPLATE_SPEC scope is represented with KIND set to
|
class.c, [...]: Fix comment typos.
* class.c, cp-tree.h, decl.c, decl2.c, mangle.c,
name-lookup.h, parser.c, search.c, semantics.c, typeck2.c: Fix
comment typos.
From-SVN: r87292
2004-09-10 13:12:15 +02:00
|
|
|
|
SK_TEMPLATE_PARMS and EXPLICIT_SPEC_P set to true. */
|
2003-12-02 11:11:24 +01:00
|
|
|
|
ENUM_BITFIELD (scope_kind) kind : 4;
|
2003-10-03 22:27:05 +02:00
|
|
|
|
|
|
|
|
|
/* True if this scope is an SK_TEMPLATE_SPEC scope. This field is
|
|
|
|
|
only valid if KIND == SK_TEMPLATE_PARMS. */
|
2004-01-27 03:33:22 +01:00
|
|
|
|
BOOL_BITFIELD explicit_spec_p : 1;
|
2003-10-03 22:27:05 +02:00
|
|
|
|
|
|
|
|
|
/* true means make a BLOCK for this level regardless of all else. */
|
|
|
|
|
unsigned keep : 1;
|
|
|
|
|
|
|
|
|
|
/* Nonzero if this level can safely have additional
|
|
|
|
|
cleanup-needing variables added to it. */
|
|
|
|
|
unsigned more_cleanups_ok : 1;
|
|
|
|
|
unsigned have_cleanups : 1;
|
|
|
|
|
|
|
|
|
|
/* 22 bits left to fill a 32-bit word. */
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/* The binding level currently in effect. */
|
|
|
|
|
|
|
|
|
|
#define current_binding_level \
|
|
|
|
|
(*(cfun && cp_function_chain->bindings \
|
|
|
|
|
? &cp_function_chain->bindings \
|
|
|
|
|
: &scope_chain->bindings))
|
|
|
|
|
|
|
|
|
|
/* The binding level of the current class, if any. */
|
|
|
|
|
|
|
|
|
|
#define class_binding_level scope_chain->class_bindings
|
|
|
|
|
|
2003-09-27 18:44:05 +02:00
|
|
|
|
/* The tree node representing the global scope. */
|
|
|
|
|
extern GTY(()) tree global_namespace;
|
2003-10-13 12:26:36 +02:00
|
|
|
|
extern GTY(()) tree global_scope_name;
|
|
|
|
|
|
|
|
|
|
/* Indicates that there is a type value in some namespace, although
|
|
|
|
|
that is not necessarily in scope at the moment. */
|
|
|
|
|
|
|
|
|
|
extern GTY(()) tree global_type_node;
|
2003-09-27 18:44:05 +02:00
|
|
|
|
|
2003-05-29 13:04:10 +02:00
|
|
|
|
/* True if SCOPE designates the global scope binding contour. */
|
|
|
|
|
#define global_scope_p(SCOPE) \
|
|
|
|
|
((SCOPE) == NAMESPACE_LEVEL (global_namespace))
|
2003-03-30 15:18:18 +02:00
|
|
|
|
|
2003-10-13 12:26:36 +02:00
|
|
|
|
extern cxx_scope *leave_scope (void);
|
|
|
|
|
extern bool kept_level_p (void);
|
|
|
|
|
extern int global_bindings_p (void);
|
|
|
|
|
extern bool toplevel_bindings_p (void);
|
|
|
|
|
extern bool namespace_bindings_p (void);
|
|
|
|
|
extern bool template_parm_scope_p (void);
|
|
|
|
|
extern scope_kind innermost_scope_kind (void);
|
|
|
|
|
extern cxx_scope *begin_scope (scope_kind, tree);
|
|
|
|
|
extern void print_binding_stack (void);
|
|
|
|
|
extern void push_to_top_level (void);
|
|
|
|
|
extern void pop_from_top_level (void);
|
|
|
|
|
extern void pop_everything (void);
|
|
|
|
|
extern void keep_next_level (bool);
|
2003-10-14 10:19:06 +02:00
|
|
|
|
extern bool is_ancestor (tree, tree);
|
re PR c++/19030 (ice on tree check)
cp:
PR c++/19030
* cp-tree.h (start_decl): Take pointer to pushed scope, not bool.
* name-lookup.h (push_scope): Return pushed scope, not flag.
* name-lookup.c (push_scope): Return scope that should be popped,
not a flag.
* decl.c (start_decl): Adjust.
(grokfndecl): Adjust scope push and pop.
* decl2.c (check_classfn): Likewise.
* parser.c (cp_parser_condition, cp_parser_conversion_function_id,
cp_parser_init_declarator, cp_parser_direct_declarator,
cp_parser_class_specifier, cp_parser_class_head,
cp_parser_lookup_name,
cp_parser_constructor_declarator_p): Likewise.
* pt.c (instantiate_class_template,
resolve_typename_type): Likewise.
testsuite:
PR c++/19030
* g++.dg/parse/crash22.C: New
From-SVN: r92946
2005-01-05 11:02:35 +01:00
|
|
|
|
extern tree push_scope (tree);
|
2003-10-14 10:19:06 +02:00
|
|
|
|
extern void pop_scope (tree);
|
2004-11-25 18:05:38 +01:00
|
|
|
|
extern tree push_inner_scope (tree);
|
|
|
|
|
extern void pop_inner_scope (tree, tree);
|
2004-07-08 06:32:27 +02:00
|
|
|
|
extern void push_binding_level (struct cp_binding_level *);
|
2003-10-13 12:26:36 +02:00
|
|
|
|
|
|
|
|
|
extern void push_namespace (tree);
|
|
|
|
|
extern void pop_namespace (void);
|
|
|
|
|
extern void push_nested_namespace (tree);
|
|
|
|
|
extern void pop_nested_namespace (tree);
|
|
|
|
|
extern void pushlevel_class (void);
|
|
|
|
|
extern void poplevel_class (void);
|
|
|
|
|
extern tree pushdecl_with_scope (tree, cxx_scope *);
|
|
|
|
|
extern tree lookup_name (tree, int);
|
2004-07-12 03:33:47 +02:00
|
|
|
|
extern tree lookup_name_real (tree, int, int, bool, int, int);
|
Friend class name lookup 2/n, PR c++/14513, c++/15410
Friend class name lookup 2/n, PR c++/14513, c++/15410
* name-lookup.c (lookup_name_real): Simplify.
(lookup_type_scope): Add SCOPE parameter. Handle friend class
lookup.
* name-lookup.h (tag_scope): New enum type.
(lookup_type_scope): Adjust declaration.
* decl.c (lookup_and_check_tag, xref_tag, xref_tag_from_type):
Change bool parameter GLOBALIZED to TAG_SCOPE parameter SCOPE.
(start_enum): Likewise. Add assertion test that NAME is
IDENTIFIER_NODE. Use anonymous name for dummy ENUMERAL_TYPE in
case of error.
* cp-tree.h (xref_tag, xref_tag_from_type): Adjust declarations.
* parser.c (cp_parser_elaborated_type_specifier,
cp_parser_class_head): Adjust call to xref_tag.
* pt.c (lookup_template_class, instantiate_class_template):
Likewise.
* rtti.c (init_rtti_processing, build_dynamic_cast_1,
tinfo_base_init, emit_support_tinfos): Likewise.
* g++.dg/lookup/friend2.C: New test.
* g++.dg/template/friend31.C: Likewise.
From-SVN: r91299
2004-11-25 17:55:34 +01:00
|
|
|
|
extern tree lookup_type_scope (tree, tag_scope);
|
2003-03-30 18:00:39 +02:00
|
|
|
|
extern tree namespace_binding (tree, tree);
|
|
|
|
|
extern void set_namespace_binding (tree, tree, tree);
|
2005-03-14 15:33:54 +01:00
|
|
|
|
extern bool hidden_name_p (tree);
|
2003-10-13 12:26:36 +02:00
|
|
|
|
extern tree lookup_namespace_name (tree, tree);
|
|
|
|
|
extern tree lookup_qualified_name (tree, tree, bool, bool);
|
|
|
|
|
extern tree lookup_name_nonclass (tree);
|
2004-07-12 03:33:47 +02:00
|
|
|
|
extern tree lookup_function_nonclass (tree, tree, bool);
|
2004-03-09 09:16:49 +01:00
|
|
|
|
extern void push_local_binding (tree, tree, int);
|
2003-10-13 12:26:36 +02:00
|
|
|
|
extern bool pushdecl_class_level (tree);
|
|
|
|
|
extern tree pushdecl_namespace_level (tree);
|
|
|
|
|
extern bool push_class_level_binding (tree, tree);
|
|
|
|
|
extern tree getdecls (void);
|
|
|
|
|
extern tree cp_namespace_decls (tree);
|
2003-10-14 10:19:06 +02:00
|
|
|
|
extern void set_decl_namespace (tree, tree, bool);
|
|
|
|
|
extern void push_decl_namespace (tree);
|
|
|
|
|
extern void pop_decl_namespace (void);
|
|
|
|
|
extern void do_namespace_alias (tree, tree);
|
2004-01-15 15:45:15 +01:00
|
|
|
|
extern void do_toplevel_using_decl (tree, tree, tree);
|
|
|
|
|
extern void do_local_using_decl (tree, tree, tree);
|
2004-12-31 00:29:33 +01:00
|
|
|
|
extern tree do_class_using_decl (tree, tree);
|
2003-10-14 10:19:06 +02:00
|
|
|
|
extern void do_using_directive (tree);
|
|
|
|
|
extern tree lookup_arg_dependent (tree, tree, tree);
|
2003-11-11 23:27:32 +01:00
|
|
|
|
extern bool is_associated_namespace (tree, tree);
|
|
|
|
|
extern void parse_using_directive (tree, tree);
|
2004-07-14 17:34:30 +02:00
|
|
|
|
extern tree innermost_non_namespace_value (tree);
|
|
|
|
|
extern cxx_binding *outer_binding (tree, cxx_binding *, bool);
|
2005-06-08 13:49:23 +02:00
|
|
|
|
extern void cp_emit_debug_info_for_using (tree, tree);
|
2003-09-27 18:44:05 +02:00
|
|
|
|
|
|
|
|
|
/* Set *DECL to the (non-hidden) declaration for ID at global scope,
|
|
|
|
|
if present and return true; otherwise return false. */
|
|
|
|
|
|
|
|
|
|
static inline bool
|
|
|
|
|
get_global_value_if_present (tree id, tree *decl)
|
|
|
|
|
{
|
|
|
|
|
tree global_value = namespace_binding (id, global_namespace);
|
|
|
|
|
if (global_value)
|
|
|
|
|
*decl = global_value;
|
|
|
|
|
return global_value != NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* True is the binding of IDENTIFIER at global scope names a type. */
|
|
|
|
|
|
|
|
|
|
static inline bool
|
|
|
|
|
is_typename_at_global_scope (tree id)
|
|
|
|
|
{
|
|
|
|
|
tree global_value = namespace_binding (id, global_namespace);
|
|
|
|
|
|
|
|
|
|
return global_value && TREE_CODE (global_value) == TYPE_DECL;
|
|
|
|
|
}
|
|
|
|
|
|
2003-03-30 15:18:18 +02:00
|
|
|
|
#endif /* GCC_CP_NAME_LOOKUP_H */
|