gcc/gcc/cp/name-lookup.h

376 lines
14 KiB
C
Raw Normal View History

/* Declarations for C++ name lookup routines.
Copyright (C) 2003, 2004, 2005, 2007, 2008, 2009, 2010
tree.c (build_tree_list_vec_stat): New function. ./: * tree.c (build_tree_list_vec_stat): New function. (ctor_to_vec): New function. (build_nt_call_vec): New function. (build_call_array): Change args to be a const pointer. (build_call_vec): New function. * tree.h (build_nt_call_vec): Declare. (build_tree_list_vec_stat): Declare. (build_tree_list_vec): Define. (build_call_array): Update declaration. (build_call_vec): Declare. (ctor_to_vec): Declare. * c-common.c (tree_vector_cache): New static variable. (make_tree_vector): New function. (release_tree_vector): New function. (make_tree_vector_single): New function. (make_tree_vector_copy): New function. * c-common.h (tree_vector_cache, make_tree_vector): Declare. (make_tree_vector_single, make_tree_vector_copy): Declare. * c-parser.c (cached_expr_list_1, cached_expr_list_2): Remove. (c_parser_expr_list): Don't manage cache here, instead call make_tree_vector. (c_parser_release_expr_list): Remove static function. (c_parser_vec_to_tree_list): Remove static function. (c_parser_attributes): Call build_tree_list_vec instead of c_parser_vec_to_tree_list. Call release_tree_vector instead of c_parser_release_expr_list. (c_parser_postfix_expression_after_primary): Likewise. (c_parser_objc_keywordexpr): Likewise. cp/: * parser.c (cp_parser_postfix_expression): Change args to a vec. Release it when done. (tree_vector): Define typedef. Define VEC functions. (cp_parser_parenthesized_expression_list): Change return type to vec. Change all callers. (cp_parser_new_expression): Change placement and initializer to vecs. Release them when done. (cp_parser_new_placement): Change return type to vec. Change all callers. (cp_parser_new_initializer): Likewise. * typeck.c (build_function_call_vec): Just call cp_build_function_call_vec. (cp_build_function_call): Just build a vec and call cp_build_function_call_vec. (cp_build_function_call_vec): New function based on old cp_build_function_call. (convert_arguments): Remove nargs and argarray parameters. Change values to a vec. Change caller. (build_x_compound_expr_from_vec): New function. (cp_build_modify_expr): Build vec to pass to build_special_member_call. * call.c (struct z_candidate): Add first_arg field. Change args field to vec. (convert_class_to_reference): Handle first argument separately. (add_candidate): Add first_arg parameter. Change args parameter to vec. Change all callers. (add_function_candidate, add_conv_candidate): Likewise. (add_template_candidate_real, add_template_candidate): Likewise. (add_template_conv_candidate): Likewise. (build_user_type_conversion_1): Handle first argument separately. (resolve_args): Change return type and parameter type to vecs. Change all callers. (perform_overload_resolution): Change args parameter to vec. Change all callers. (build_new_function_call, build_operator_new_call): Likewise. (add_candidates): Likewise. (build_op_call): New globally visible function, built from and replacing static function build_object_call. (build_new_op): Don't handle CALL_EXPR. Build vec, not tree_list, of arguments. (build_op_delete_call): Build vec to pass to cp_build_function_call_vec. (build_temp): Build vec to pass to build_special_member_call. (convert_like_real): Likewise. (perform_direct_initialization_if_possible): Likewise. (build_over_call): Handle first_arg field. Use build_call_array rather than build_call_list. (build_special_member_call): Change args parameter to vec. Change all callers. (build_new_method_call): Likewise. * init.c (expand_default_init): Change parms to vec. (build_raw_new_expr): Change placement and init to vecs. Change all callers. (build_new_1, build_new): Likewise. * class.c (resolve_address_of_overloaded_function): Build array to pass to fn_type_unification. * pt.c (tsubst_copy_and_build): For NEW_EXPR build vecs to pass to build_new. For CALL_EXPR create a vec rather than a tree_list; expand a pack if necessary. (fn_type_unification): Change args parameter to const tree *. Add nargs parameter. Change all callers. (type_unification_real): Likewise. (unify): Build array to pass to type_unification_real. (get_bindings): Build array to pass to fn_type_unification. (any_type_dependent_arguments_p): Change args parameter to a vec. Change all callers. (make_args_non_dependent): Renamed from build_non_dependent_args. Change return type to void. Change parameter type to vec. Change all callers. (do_auto_deduction): Pass an array to type_unification_real. * semantics.c (perform_koenig_lookup): Change args to vec. Change all callers. (finish_call_expr): Change args to vec. Change all callers. Call build_op_call instead of passing CALL_EXPR to build_new_op. (cxx_omp_create_clause_info): Allocate vec to pass to build_special_member_call. * decl2.c (build_offset_ref_call_from_tree): Change args parameter to vec. Change all callers. * name-lookup.c (lookup_function_nonclass): Likewise. (struct arg_lookup): Change args to vec. (arg_assoc_namespace): Handle args as a vec. (arg_assoc_args_vec): New static function. (lookup_arg_dependent): Change args parameter to vec. Change all callers. * method.c (do_build_assign_ref): Allocate vec to pass to build_special_member_call. * except.c (build_throw): Likewise. * typeck2.c (build_functional_cast): Likewise. * cvt.c (ocp_convert): Likewise. * tree.c (build_min_non_dep_call_vec): Change last parameter to vec. Change all callers. * cp-tree.h: Update declarations. * name-lookup.h: Update declarations. objc/: * objc-act.c (objc_generate_cxx_ctor_or_dtor): Pass NULL rather than NULL_TREE to build_special_member_call. From-SVN: r147759
2009-05-21 07:58:39 +02:00
Free Software Foundation, Inc.
Contributed by Gabriel Dos Reis <gdr@integrable-solutions.net>
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 3, 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 COPYING3. If not see
<http://www.gnu.org/licenses/>. */
#ifndef GCC_CP_NAME_LOOKUP_H
#define GCC_CP_NAME_LOOKUP_H
c-common.c: Move to c-family/. gcc/ChangeLog: * c-common.c: Move to c-family/. * c-common.def: Likewise. * c-common.h: Likewise. * c-cppbuiltin.c: Likewise. * c-dump.c: Likewise. * c-format.c: Likewise. * c-format.h : Likewise. * c-gimplify.c: Likewise. * c-lex.c: Likewise. * c-omp.c: Likewise. * c.opt: Likewise. * c-opts.c: Likewise. * c-pch.c: Likewise. * c-ppoutput.c: Likewise. * c-pragma.c: Likewise. * c-pragma.h: Likewise. * c-pretty-print.c: Likewise. * c-pretty-print.h: Likewise. * c-semantics.c: Likewise. * stub-objc.c: Likewise. * gengtype.c (get_file_langdir): Special-case files in c-family/. (get_output_file_with_visibility): Fix name for c-common.h. * c-config-lang.in: Update paths in gtfiles for files in c-family/. * c-tree.h: Update include path for moved files. * c-lang.c: Likewise. * c-lang.h: Likewise. * c-parser.c: Likewise. * c-convert.c: Likewise. * c-decl.c: Likewise. * c-objc-common.c: Likewise. * configure.ac: Make sure c-family/ exists in the build directory. * configure: Regenerate. * Makefile.in: Update paths for moved files. Regroup files per location and update dependencies. Move generated_files down after ALL_GTFILES_H. * config/spu/spu-c.c: Update paths for moved files. * config/mep/mep-pragma.c: Likewise. * config/darwin-c.c: Likewise. * config/i386/msformat-c.c: Likewise. * config/i386/i386-c.c: Likewise. * config/avr/avr-c.c: Likewise. * config/sol2-c.c: Likewise. * config/ia64/ia64-c.c: Likewise. * config/rs6000/rs6000-c.c: Likewise. * config/arm/arm.c: Likewise. * config/arm/arm-c.c: Likewise. * config/h8300/h8300.c: Likewise. * config/v850/v850-c.c: Likewise. * config/t-darwin: Fix dependencies for moved files. * config/t-sol2: Fix dependencies for moved files. * config/mep/t-mep: Fix dependencies for moved files. * config/ia64/t-ia64: Fix dependencies for moved files. * config/rs6000/t-rs6000: Fix dependencies for moved files. * config/v850/t-v850: Fix dependencies for moved files. * config/v850/t-v850e: Fix dependencies for moved files. * config/m32c/m32c-pragma.c * po/exgettext: Look in c-family/ also. c-family/ChangeLog: * c-common.c: Include gt-c-family-c-common.h. * c-pragma.c: Include gt-c-family-c-pragma.h. objc/ChangeLog: * objc-act.c: Update include path for moved files. * objc-lang.c: Likewise. * config-lang.in: Update paths in gtfiles for files in c-family/. objcp/ChangeLog: * objcp-lang.c: Update include path for moved files. * config-lang.in: Update paths in gtfiles for files in c-family/. cp/ChangeLog: * typeck.c: Update include path for moved files. * decl.c: Likewise. * rtti.c: Likewise. * cp-gimplify.c: Likewise. * cp-lang.c: Likewise. * pt.c: Likewise. * semantics.c: Likewise. * cxx-pretty-print.h: Likewise. * decl2.c: Likewise. * parser.c: Likewise. * cp-objcp-common.c: Likewise. * cp-tree.h: Likewise. * name-lookup.c: Likewise. * lex.c: Likewise. * name-lookup.h: Likewise. * config-lang.in: Update paths in gtfiles for files in c-family/. * Make-lang.in: Likewise. From-SVN: r160330
2010-06-05 22:33:22 +02:00
#include "c-family/c-common.h"
hashtable.h (struct ht_identifier): Add data member "hash_value". * hashtable.h (struct ht_identifier): Add data member "hash_value". * hashtable.c (ht_lookup): Use it when searching, remember. (ht_expand): Do not recompute. * tree.h (IDENTIFIER_HASH_VALUE): New macro. cp/ * cp-tree.h (struct lang_type_class): Replace data member tags with hash-table nested_udts. (CLASSTYPE_NESTED_UTDS): Rename from CLASSTYPE_TAGS. * class.c (unreverse_member_declarations): Don't touch CLASSTYPE_TAGS. (pushclass): Use cxx_remember_type_decls. * decl.c (struct cp_binding_level): Replace data member tags with hash-table type_decls. (pop_binding_level): Handle level->type_decls. (kept_level_p): Adjust. (poplevel): Remove unused local variable. (bt_print_entry): New function. (print_binding_level): Use it. (push_namespace): Build current_binding_level->type_decls. (maybe_process_template_type_declaration): Adjust. (pushtag): Likewise. (clear_anon_tags): Use binding_table_remove_anonymous_types. (gettags): Remove. (cxx_remember_type_decls): Rename from storetags. Adjust. (lookup_tag): Use binding_table_find_anon_type. Tidy. (lookup_tag_reverse): Use binding_table_reverse_maybe_remap. (cxx_init_decl_processing): Build global_binding_level->type_decls. (store_parm_decls): Remove pointless code. * name-lookup.c (free_binding_entry): New variable. (ENTRY_INDEX): New macro. (struct binding_table_s): New datatype. (binding_entry_make): New function. (binding_entry_free): Likewise. (binding_table_construct): Likewise. (binding_table_free): Likewise. (binding_table_new): Likewise. (binding_table_expand): Likewise. (binding_table_insert): Likewise. (binding_table_find): Likewise. (binding_table_find_anon_type): Likewise. (binding_table_reverse_maybe_remap): Likewise. (binding_table_remove_anonymous_types): Likewise. (binding_table_foreach): Likewise. * name-lookup.h (binding_table): New type. (binding_entry): Likewise. (bt_foreach_proc): Likewise. (struct binding_entry_s): New datatype. (SCOPE_DEFAULT_HT_SIZE): New macro. (CLASS_SCOPE_HT_SIZE): Likewise. (NAMESPACE_ORDINARY_HT_SIZE): Likewise. (NAMESPACE_STD_HT_SIZE): Likewise. (GLOBAL_SCOPE_HT_SIZE): Likewise. (binding_table_new): Declare. (binding_table_free): Likewise. (binding_table_insert): Likewise. (binding_table_find_anon_type): Likewise. (binding_table_reverse_maybe_remap): Likewise. (binding_table_remove_anonymous_types): Likewise. (binding_table_foreach): Likewise. (binding_table_find): Likewise. (cxx_remember_type_decls): Likewise. * pt.c (bt_instantiate_type_proc): New function. (do_type_instantiation): Use it. * search.c (lookup_field_r): Use binding_table_find. From-SVN: r66930
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 *);
hashtab.h: Update GTY annotations to new syntax 2009-04-21 Taras Glek <tglek@mozilla.com> * include/hashtab.h: Update GTY annotations to new syntax * include/splay-tree.h: Likewise gcc/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * alias.c: Update GTY annotations to new syntax * basic-block.h: Likewise * bitmap.h: Likewise * c-common.h: Likewise * c-decl.c: Likewise * c-parser.c: Likewise * c-pragma.c: Likewise * c-tree.h: Likewise * cfgloop.h: Likewise * cgraph.h: Likewise * config/alpha/alpha.c: Likewise * config/arm/arm.h: Likewise * config/avr/avr.h: Likewise * config/bfin/bfin.c: Likewise * config/cris/cris.c: Likewise * config/darwin.c: Likewise * config/frv/frv.c: Likewise * config/i386/i386.c: Likewise * config/i386/i386.h: Likewise * config/i386/winnt.c: Likewise * config/ia64/ia64.h: Likewise * config/iq2000/iq2000.c: Likewise * config/mips/mips.c: Likewise * config/mmix/mmix.h: Likewise * config/pa/pa.c: Likewise * config/pa/pa.h: Likewise * config/rs6000/rs6000.c: Likewise * config/s390/s390.c: Likewise * config/sparc/sparc.c: Likewise * config/xtensa/xtensa.c: Likewise * cselib.h: Likewise * dbxout.c: Likewise * dwarf2out.c: Likewise * except.c: Likewise * except.h: Likewise * fixed-value.h: Likewise * function.c: Likewise * function.h: Likewise * gimple.h: Likewise * integrate.c: Likewise * optabs.c: Likewise * output.h: Likewise * real.h: Likewise * rtl.h: Likewise * stringpool.c: Likewise * tree-data-ref.c: Likewise * tree-flow.h: Likewise * tree-scalar-evolution.c: Likewise * tree-ssa-address.c: Likewise * tree-ssa-alias.h: Likewise * tree-ssa-operands.h: Likewise * tree.c: Likewise * tree.h: Likewise * varasm.c: Likewise * varray.h: Likewise * vec.h: Likewise * coretypes.h: Do not define GTY macro if it is already defined * doc/gty.texi: Update GTY documentation to new syntax * gengtype-lex.l: Enforce attribute-like syntax for GTY annotations on structs * gengtype-parse.c: Likewise gcc/ada/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * gcc-interface/ada-tree.h: Update GTY annotations to new syntax * gcc-interface/trans.c: Likewise * gcc-interface/utils.c: Likewise gcc/cp/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * cp-tree.h: Update GTY annotations to new syntax * decl.c: Likewise * mangle.c: Likewise * name-lookup.c: Likewise * name-lookup.h: Likewise * parser.c: Likewise * pt.c: Likewise * rtti.c: Likewise * semantics.c: Likewise * typeck2.c: Likewise gcc/fortran/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * f95-lang.c: Update GTY annotations to new syntax * trans-intrinsic.c: Likewise * trans-io.c: Likewise * trans.h: Likewise gcc/java/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * builtins.c: Update GTY annotations to new syntax * decl.c: Likewise * java-tree.h: Likewise * jcf.h: Likewise * lang.c: Likewise gcc/objc/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * objc-act.c: Update GTY annotations to new syntax * objc-act.h: Likewise libcpp/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * include/cpp-id-data.h: Update GTY annotations to new syntax * include/cpplib.h: Likewise * include/line-map.h: Likewise * include/symtab.h: Likewise From-SVN: r146607
2009-04-22 20:29:36 +02:00
struct GTY(()) binding_entry_s {
hashtable.h (struct ht_identifier): Add data member "hash_value". * hashtable.h (struct ht_identifier): Add data member "hash_value". * hashtable.c (ht_lookup): Use it when searching, remember. (ht_expand): Do not recompute. * tree.h (IDENTIFIER_HASH_VALUE): New macro. cp/ * cp-tree.h (struct lang_type_class): Replace data member tags with hash-table nested_udts. (CLASSTYPE_NESTED_UTDS): Rename from CLASSTYPE_TAGS. * class.c (unreverse_member_declarations): Don't touch CLASSTYPE_TAGS. (pushclass): Use cxx_remember_type_decls. * decl.c (struct cp_binding_level): Replace data member tags with hash-table type_decls. (pop_binding_level): Handle level->type_decls. (kept_level_p): Adjust. (poplevel): Remove unused local variable. (bt_print_entry): New function. (print_binding_level): Use it. (push_namespace): Build current_binding_level->type_decls. (maybe_process_template_type_declaration): Adjust. (pushtag): Likewise. (clear_anon_tags): Use binding_table_remove_anonymous_types. (gettags): Remove. (cxx_remember_type_decls): Rename from storetags. Adjust. (lookup_tag): Use binding_table_find_anon_type. Tidy. (lookup_tag_reverse): Use binding_table_reverse_maybe_remap. (cxx_init_decl_processing): Build global_binding_level->type_decls. (store_parm_decls): Remove pointless code. * name-lookup.c (free_binding_entry): New variable. (ENTRY_INDEX): New macro. (struct binding_table_s): New datatype. (binding_entry_make): New function. (binding_entry_free): Likewise. (binding_table_construct): Likewise. (binding_table_free): Likewise. (binding_table_new): Likewise. (binding_table_expand): Likewise. (binding_table_insert): Likewise. (binding_table_find): Likewise. (binding_table_find_anon_type): Likewise. (binding_table_reverse_maybe_remap): Likewise. (binding_table_remove_anonymous_types): Likewise. (binding_table_foreach): Likewise. * name-lookup.h (binding_table): New type. (binding_entry): Likewise. (bt_foreach_proc): Likewise. (struct binding_entry_s): New datatype. (SCOPE_DEFAULT_HT_SIZE): New macro. (CLASS_SCOPE_HT_SIZE): Likewise. (NAMESPACE_ORDINARY_HT_SIZE): Likewise. (NAMESPACE_STD_HT_SIZE): Likewise. (GLOBAL_SCOPE_HT_SIZE): Likewise. (binding_table_new): Declare. (binding_table_free): Likewise. (binding_table_insert): Likewise. (binding_table_find_anon_type): Likewise. (binding_table_reverse_maybe_remap): Likewise. (binding_table_remove_anonymous_types): Likewise. (binding_table_foreach): Likewise. (binding_table_find): Likewise. (cxx_remember_type_decls): Likewise. * pt.c (bt_instantiate_type_proc): New function. (do_type_instantiation): Use it. * search.c (lookup_field_r): Use binding_table_find. From-SVN: r66930
2003-05-18 15:40:54 +02:00
binding_entry chain;
tree name;
tree type;
};
/* These macros indicate the initial chains count for binding_table. */
#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)
hashtable.h (struct ht_identifier): Add data member "hash_value". * hashtable.h (struct ht_identifier): Add data member "hash_value". * hashtable.c (ht_lookup): Use it when searching, remember. (ht_expand): Do not recompute. * tree.h (IDENTIFIER_HASH_VALUE): New macro. cp/ * cp-tree.h (struct lang_type_class): Replace data member tags with hash-table nested_udts. (CLASSTYPE_NESTED_UTDS): Rename from CLASSTYPE_TAGS. * class.c (unreverse_member_declarations): Don't touch CLASSTYPE_TAGS. (pushclass): Use cxx_remember_type_decls. * decl.c (struct cp_binding_level): Replace data member tags with hash-table type_decls. (pop_binding_level): Handle level->type_decls. (kept_level_p): Adjust. (poplevel): Remove unused local variable. (bt_print_entry): New function. (print_binding_level): Use it. (push_namespace): Build current_binding_level->type_decls. (maybe_process_template_type_declaration): Adjust. (pushtag): Likewise. (clear_anon_tags): Use binding_table_remove_anonymous_types. (gettags): Remove. (cxx_remember_type_decls): Rename from storetags. Adjust. (lookup_tag): Use binding_table_find_anon_type. Tidy. (lookup_tag_reverse): Use binding_table_reverse_maybe_remap. (cxx_init_decl_processing): Build global_binding_level->type_decls. (store_parm_decls): Remove pointless code. * name-lookup.c (free_binding_entry): New variable. (ENTRY_INDEX): New macro. (struct binding_table_s): New datatype. (binding_entry_make): New function. (binding_entry_free): Likewise. (binding_table_construct): Likewise. (binding_table_free): Likewise. (binding_table_new): Likewise. (binding_table_expand): Likewise. (binding_table_insert): Likewise. (binding_table_find): Likewise. (binding_table_find_anon_type): Likewise. (binding_table_reverse_maybe_remap): Likewise. (binding_table_remove_anonymous_types): Likewise. (binding_table_foreach): Likewise. * name-lookup.h (binding_table): New type. (binding_entry): Likewise. (bt_foreach_proc): Likewise. (struct binding_entry_s): New datatype. (SCOPE_DEFAULT_HT_SIZE): New macro. (CLASS_SCOPE_HT_SIZE): Likewise. (NAMESPACE_ORDINARY_HT_SIZE): Likewise. (NAMESPACE_STD_HT_SIZE): Likewise. (GLOBAL_SCOPE_HT_SIZE): Likewise. (binding_table_new): Declare. (binding_table_free): Likewise. (binding_table_insert): Likewise. (binding_table_find_anon_type): Likewise. (binding_table_reverse_maybe_remap): Likewise. (binding_table_remove_anonymous_types): Likewise. (binding_table_foreach): Likewise. (binding_table_find): Likewise. (cxx_remember_type_decls): Likewise. * pt.c (bt_instantiate_type_proc): New function. (do_type_instantiation): Use it. * search.c (lookup_field_r): Use binding_table_find. From-SVN: r66930
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);
/* Datatype that represents binding established by a declaration between
a name and a C++ entity. */
typedef struct cxx_binding cxx_binding;
/* The datatype used to implement C++ scope. */
typedef struct cp_binding_level cxx_scope;
/* 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)
/* True if NODE->value is from a base class of the class which is
currently being defined. */
#define INHERITED_VALUE_BINDING_P(NODE) ((NODE)->value_is_inherited)
hashtab.h: Update GTY annotations to new syntax 2009-04-21 Taras Glek <tglek@mozilla.com> * include/hashtab.h: Update GTY annotations to new syntax * include/splay-tree.h: Likewise gcc/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * alias.c: Update GTY annotations to new syntax * basic-block.h: Likewise * bitmap.h: Likewise * c-common.h: Likewise * c-decl.c: Likewise * c-parser.c: Likewise * c-pragma.c: Likewise * c-tree.h: Likewise * cfgloop.h: Likewise * cgraph.h: Likewise * config/alpha/alpha.c: Likewise * config/arm/arm.h: Likewise * config/avr/avr.h: Likewise * config/bfin/bfin.c: Likewise * config/cris/cris.c: Likewise * config/darwin.c: Likewise * config/frv/frv.c: Likewise * config/i386/i386.c: Likewise * config/i386/i386.h: Likewise * config/i386/winnt.c: Likewise * config/ia64/ia64.h: Likewise * config/iq2000/iq2000.c: Likewise * config/mips/mips.c: Likewise * config/mmix/mmix.h: Likewise * config/pa/pa.c: Likewise * config/pa/pa.h: Likewise * config/rs6000/rs6000.c: Likewise * config/s390/s390.c: Likewise * config/sparc/sparc.c: Likewise * config/xtensa/xtensa.c: Likewise * cselib.h: Likewise * dbxout.c: Likewise * dwarf2out.c: Likewise * except.c: Likewise * except.h: Likewise * fixed-value.h: Likewise * function.c: Likewise * function.h: Likewise * gimple.h: Likewise * integrate.c: Likewise * optabs.c: Likewise * output.h: Likewise * real.h: Likewise * rtl.h: Likewise * stringpool.c: Likewise * tree-data-ref.c: Likewise * tree-flow.h: Likewise * tree-scalar-evolution.c: Likewise * tree-ssa-address.c: Likewise * tree-ssa-alias.h: Likewise * tree-ssa-operands.h: Likewise * tree.c: Likewise * tree.h: Likewise * varasm.c: Likewise * varray.h: Likewise * vec.h: Likewise * coretypes.h: Do not define GTY macro if it is already defined * doc/gty.texi: Update GTY documentation to new syntax * gengtype-lex.l: Enforce attribute-like syntax for GTY annotations on structs * gengtype-parse.c: Likewise gcc/ada/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * gcc-interface/ada-tree.h: Update GTY annotations to new syntax * gcc-interface/trans.c: Likewise * gcc-interface/utils.c: Likewise gcc/cp/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * cp-tree.h: Update GTY annotations to new syntax * decl.c: Likewise * mangle.c: Likewise * name-lookup.c: Likewise * name-lookup.h: Likewise * parser.c: Likewise * pt.c: Likewise * rtti.c: Likewise * semantics.c: Likewise * typeck2.c: Likewise gcc/fortran/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * f95-lang.c: Update GTY annotations to new syntax * trans-intrinsic.c: Likewise * trans-io.c: Likewise * trans.h: Likewise gcc/java/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * builtins.c: Update GTY annotations to new syntax * decl.c: Likewise * java-tree.h: Likewise * jcf.h: Likewise * lang.c: Likewise gcc/objc/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * objc-act.c: Update GTY annotations to new syntax * objc-act.h: Likewise libcpp/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * include/cpp-id-data.h: Update GTY annotations to new syntax * include/cpplib.h: Likewise * include/line-map.h: Likewise * include/symtab.h: Likewise From-SVN: r146607
2009-04-22 20:29:36 +02:00
struct GTY(()) cxx_binding {
/* 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;
/* The scope at which this binding was made. */
cxx_scope *scope;
unsigned value_is_inherited : 1;
unsigned is_local : 1;
};
/* Datatype used to temporarily save C++ bindings (for implicit
instantiations purposes and like). Implemented in decl.c. */
hashtab.h: Update GTY annotations to new syntax 2009-04-21 Taras Glek <tglek@mozilla.com> * include/hashtab.h: Update GTY annotations to new syntax * include/splay-tree.h: Likewise gcc/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * alias.c: Update GTY annotations to new syntax * basic-block.h: Likewise * bitmap.h: Likewise * c-common.h: Likewise * c-decl.c: Likewise * c-parser.c: Likewise * c-pragma.c: Likewise * c-tree.h: Likewise * cfgloop.h: Likewise * cgraph.h: Likewise * config/alpha/alpha.c: Likewise * config/arm/arm.h: Likewise * config/avr/avr.h: Likewise * config/bfin/bfin.c: Likewise * config/cris/cris.c: Likewise * config/darwin.c: Likewise * config/frv/frv.c: Likewise * config/i386/i386.c: Likewise * config/i386/i386.h: Likewise * config/i386/winnt.c: Likewise * config/ia64/ia64.h: Likewise * config/iq2000/iq2000.c: Likewise * config/mips/mips.c: Likewise * config/mmix/mmix.h: Likewise * config/pa/pa.c: Likewise * config/pa/pa.h: Likewise * config/rs6000/rs6000.c: Likewise * config/s390/s390.c: Likewise * config/sparc/sparc.c: Likewise * config/xtensa/xtensa.c: Likewise * cselib.h: Likewise * dbxout.c: Likewise * dwarf2out.c: Likewise * except.c: Likewise * except.h: Likewise * fixed-value.h: Likewise * function.c: Likewise * function.h: Likewise * gimple.h: Likewise * integrate.c: Likewise * optabs.c: Likewise * output.h: Likewise * real.h: Likewise * rtl.h: Likewise * stringpool.c: Likewise * tree-data-ref.c: Likewise * tree-flow.h: Likewise * tree-scalar-evolution.c: Likewise * tree-ssa-address.c: Likewise * tree-ssa-alias.h: Likewise * tree-ssa-operands.h: Likewise * tree.c: Likewise * tree.h: Likewise * varasm.c: Likewise * varray.h: Likewise * vec.h: Likewise * coretypes.h: Do not define GTY macro if it is already defined * doc/gty.texi: Update GTY documentation to new syntax * gengtype-lex.l: Enforce attribute-like syntax for GTY annotations on structs * gengtype-parse.c: Likewise gcc/ada/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * gcc-interface/ada-tree.h: Update GTY annotations to new syntax * gcc-interface/trans.c: Likewise * gcc-interface/utils.c: Likewise gcc/cp/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * cp-tree.h: Update GTY annotations to new syntax * decl.c: Likewise * mangle.c: Likewise * name-lookup.c: Likewise * name-lookup.h: Likewise * parser.c: Likewise * pt.c: Likewise * rtti.c: Likewise * semantics.c: Likewise * typeck2.c: Likewise gcc/fortran/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * f95-lang.c: Update GTY annotations to new syntax * trans-intrinsic.c: Likewise * trans-io.c: Likewise * trans.h: Likewise gcc/java/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * builtins.c: Update GTY annotations to new syntax * decl.c: Likewise * java-tree.h: Likewise * jcf.h: Likewise * lang.c: Likewise gcc/objc/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * objc-act.c: Update GTY annotations to new syntax * objc-act.h: Likewise libcpp/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * include/cpp-id-data.h: Update GTY annotations to new syntax * include/cpplib.h: Likewise * include/line-map.h: Likewise * include/symtab.h: Likewise From-SVN: r146607
2009-04-22 20:29:36 +02:00
typedef struct GTY(()) cxx_saved_binding {
/* 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);
Break out decl.c (2/n) Break out decl.c (2/n) * name-lookup.c: Include diagnostic.h (cxx_binding_free): Make static. (cxx_binding_make): Likewise. (binding_table_new): Likewise (binding_table_free): Likewise. (binding_table_insert): Likewise. (binding_table_find_anon_type): Likewise. (binding_table_reverse_maybe_remap): Likewise. (supplement_binding): Likewise. * name-lookup.h (global_scope_name): Declare extern. (global_type_node): Likewise. (cxx_binding_free): Don't export. (cxx_binding_make): Likewise. (binding_table_new): Likewise. (binding_table_free): Likewise. (binding_table_insert): Likewise. (binding_table_find_anon_type): Likewise. (binding_table_reverse_maybe_remap): Likewise. * Make-lang.in (cp/name-lookup.o): Depend on $(DIAGNOSTIC_H) * decl.c (lookup_namespace_name): Move to name-lookup.c (select_decl): Likewise. (unqualified_namespace_lookup): Likewise. (lookup_qualified_name): Likewise. (lookup_name_real): Likewise. (lookup_name_nonclass): Likewise. (lookup_function_nonclass): Likewise. (lookup_name): Likewise. (lookup_name_current_level): Likewise. (lookup_type_current_level): Likewise. (lookup_flags): Likewise. (qualify_lookup): Likewise. (lookup_tag): Likewise. (lookup_tag_reverse): Likewise. (getdecls): Likewise. (storedecls): Remove. (cxx_remember_type_decls): Likewise. (global_bindings_p): Likewise. (innermost_nonclass_level): Likewise. (toplevel_bindings_p): Likewise. (namespace_bindings_p): Likewise. (kept_level_p): Likewise. (innermost_scope_kind): Likewise. (template_parm_scope_p): Likewise. (push_binding): Likewise. (push_local_binding): Likewise. (add_decl_to_level): Likewise. Make extern. (push_class_binding): Move to name-lookup.c. (resume_level): Likewise. Rename to resume_scope. (begin_scope): Likewise. (indent): Likewise. (binding_depth): Likewise. (is_class_level): Likewise. (cxx_scope_descriptor): Likewise. (cxx_scope_debug): Likewise. (namespace_scope_ht_size): Likewise. (leave_scope): Likewise. (pushlevel_class): Likewise. (poplevel_class): Likewise. (clear_identifier_class_values): Likewise. (pushdecl_with_scope): Likewise. (pushdecl_namespace_level): Likewise. (pushdecl_class_level): Likewise. (push_class_level_binding): Likewise. (push_using_directive): Likewise. (identifier_global_value): Likewise. (keep_next_level_flag): Likewise. (keep_next_level): Likewise. (free_binding_level): Likewise. (set_class_shadows): Likewise. (maybe_push_cleanup_level): Likewise. (cp_namespace_decls): Likewise. (bt_print_entry): Likewise. (print_binding_level): Likewise. (print_other_binding_stack): Likewise. (print_binding_stack): Likewise. (push_namespace): Likewise. (pop_namespace): Likewise. (push_nested_namespace): Likewise. (pop_nested_namespace): Likewise. (cxx_saved_binding_make): Likewise. (struct cxx_saved_binding_make): Likewise. (store_bindings): Likewise. (maybe_push_to_top_level): Likewise. (push_to_top_level): Likewise. (pop_from_top_level): Likewise. (identifier_type_value): Likewise. (set_identifier_type_value): Likewise. (set_identifier_type_value_with_scope): Likewise. (pop_everything): Likewise. (pushtag): Likewise. (follow_tag_typedef): Likewise. (maybe_process_template_type_declaration): Likewise. (pop_binding): Likewise. * cp-tree.h: Move corresponding declarations to name-lookup.h From-SVN: r72426
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);
extern tree constructor_name (tree);
extern bool constructor_name_p (tree, tree);
/* 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". */
sk_cleanup, /* A scope for (pseudo-)scope for cleanup. It is
pseudo in that it is transparent to name lookup
activities. */
sk_try, /* A try-block. */
sk_catch, /* A catch-block. */
sk_for, /* The scope of the variable declared in a
for-init-statement. */
sk_function_parms, /* The scope containing function parameters. */
sk_class, /* The scope containing the members of a class. */
c-common.c (do_switch_warnings): Look through the CONST_DECLs in the enumerators of an ENUMERAL_TYPE. 2008-08-26 Douglas Gregor <doug.gregor@gmail.com> * c-common.c (do_switch_warnings): Look through the CONST_DECLs in the enumerators of an ENUMERAL_TYPE. * dbxout.c (dbxout_type): Ditto. 2008-08-26 Douglas Gregor <doug.gregor@gmail.com> * typeck.c (type_after_usual_arithmetic_conversions): Don't do the usual arithmetic conversions on scoped enumeration types. (common_type): Ditto. (default_conversion): Don't perform integral promotions on scoped enumeration types. (build_array_ref): Scoped enumeration types can't be used as subscripts. * decl.c (start_enum): If building a C++0x scoped enumeration, enter its scope. If provided with an underlying type, check that underlying type and set up the enumeration type accordingly. (finish_enum): Only compute an underlying type if the underlying type isn't already fixed, and only convert the enumerator values now if we've just computed the underlying type. Finish the scope of C++0x scoped enumerations. (build_enumerator): For enumerations with a fixed underlying type, check the enumerator values when the enumerator is defined. (lookup_enumerator): New. * call.c (standard_conversion): Don't allow assignment from integers to scoped enumeration types, even with -fpermissive. Don't convert from scoped enumerations to bool or any arithmetic types. (build_conditional_expr): Don't per the usual arithmetic conversions for scoped enumeration types. (convert_like_real): Check complain to see if we should produce warnings. * error.c (class_key_or_enum_as_string): Print scoped enums. * cp-tree.h (MAYBE_CLASS_TYPE_P): Check CLASS_TYPE_P, not TYPE_LANG_FLAG_5. (INTEGRAL_OR_UNSCOPED_ENUMERATION_TYPE_P): New. (SCOPED_ENUM_P): New. (UNSCOPED_ENUM_P): New. (SET_SCOPED_ENUM_P): New. (ENUM_UNDERLYING_TYPE): New. * pt.c (lookup_template_class): Update the instantiation of enum types to deal with C++0x scoped enumerations and underlying types. * name-lookup.c (begin_scope): Deal with scoped enumeration scopes. (lookup_qualified_name): Deal with lookup into enumeration types. * name-lookup.h (enum scope_kind): Add sk_scoped_enum. * parser.c (cp_parser_class_or_namespace_name): Rename to... (cp_parser_qualifying_entity): ... this. Also, in C++0x mode, parse a type-name that can be an enumeration type. (cp_parser_nested_name_specifier_opt): Update with C++0x grammar. (cp_parser_elaborated_type_specifier): Parse the optional `struct' or `class' following enum (in C++0x). (cp_parser_enum_specifier): Parse C++0x scoped enumerations and enum-base clauses. 2008-08-26 Douglas Gregor <doug.gregor@gmail.com> * g++.dg/cpp0x/scoped_enum_examples.C: New. * g++.dg/cpp0x/scoped_enum.C: New. * g++.dg/cpp0x/scoped_enum_98.C: New. * g++.dg/cpp0x/enum_base_warn.C: New. * g++.dg/cpp0x/enum_base.C: New. From-SVN: r139611
2008-08-27 00:33:10 +02:00
sk_scoped_enum, /* The scope containing the enumertors of a C++0x
scoped enumeration. */
sk_namespace, /* The scope containing the members of a
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. */
2006-06-06 13:44:09 +02:00
sk_omp /* An OpenMP structured block. */
} scope_kind;
/* 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;
hashtab.h: Update GTY annotations to new syntax 2009-04-21 Taras Glek <tglek@mozilla.com> * include/hashtab.h: Update GTY annotations to new syntax * include/splay-tree.h: Likewise gcc/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * alias.c: Update GTY annotations to new syntax * basic-block.h: Likewise * bitmap.h: Likewise * c-common.h: Likewise * c-decl.c: Likewise * c-parser.c: Likewise * c-pragma.c: Likewise * c-tree.h: Likewise * cfgloop.h: Likewise * cgraph.h: Likewise * config/alpha/alpha.c: Likewise * config/arm/arm.h: Likewise * config/avr/avr.h: Likewise * config/bfin/bfin.c: Likewise * config/cris/cris.c: Likewise * config/darwin.c: Likewise * config/frv/frv.c: Likewise * config/i386/i386.c: Likewise * config/i386/i386.h: Likewise * config/i386/winnt.c: Likewise * config/ia64/ia64.h: Likewise * config/iq2000/iq2000.c: Likewise * config/mips/mips.c: Likewise * config/mmix/mmix.h: Likewise * config/pa/pa.c: Likewise * config/pa/pa.h: Likewise * config/rs6000/rs6000.c: Likewise * config/s390/s390.c: Likewise * config/sparc/sparc.c: Likewise * config/xtensa/xtensa.c: Likewise * cselib.h: Likewise * dbxout.c: Likewise * dwarf2out.c: Likewise * except.c: Likewise * except.h: Likewise * fixed-value.h: Likewise * function.c: Likewise * function.h: Likewise * gimple.h: Likewise * integrate.c: Likewise * optabs.c: Likewise * output.h: Likewise * real.h: Likewise * rtl.h: Likewise * stringpool.c: Likewise * tree-data-ref.c: Likewise * tree-flow.h: Likewise * tree-scalar-evolution.c: Likewise * tree-ssa-address.c: Likewise * tree-ssa-alias.h: Likewise * tree-ssa-operands.h: Likewise * tree.c: Likewise * tree.h: Likewise * varasm.c: Likewise * varray.h: Likewise * vec.h: Likewise * coretypes.h: Do not define GTY macro if it is already defined * doc/gty.texi: Update GTY documentation to new syntax * gengtype-lex.l: Enforce attribute-like syntax for GTY annotations on structs * gengtype-parse.c: Likewise gcc/ada/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * gcc-interface/ada-tree.h: Update GTY annotations to new syntax * gcc-interface/trans.c: Likewise * gcc-interface/utils.c: Likewise gcc/cp/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * cp-tree.h: Update GTY annotations to new syntax * decl.c: Likewise * mangle.c: Likewise * name-lookup.c: Likewise * name-lookup.h: Likewise * parser.c: Likewise * pt.c: Likewise * rtti.c: Likewise * semantics.c: Likewise * typeck2.c: Likewise gcc/fortran/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * f95-lang.c: Update GTY annotations to new syntax * trans-intrinsic.c: Likewise * trans-io.c: Likewise * trans.h: Likewise gcc/java/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * builtins.c: Update GTY annotations to new syntax * decl.c: Likewise * java-tree.h: Likewise * jcf.h: Likewise * lang.c: Likewise gcc/objc/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * objc-act.c: Update GTY annotations to new syntax * objc-act.h: Likewise libcpp/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * include/cpp-id-data.h: Update GTY annotations to new syntax * include/cpplib.h: Likewise * include/line-map.h: Likewise * include/symtab.h: Likewise From-SVN: r146607
2009-04-22 20:29:36 +02:00
typedef struct GTY(()) cp_class_binding {
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);
typedef struct GTY(()) cp_label_binding {
/* The bound LABEL_DECL. */
tree label;
/* The previous IDENTIFIER_LABEL_VALUE. */
tree prev_value;
} cp_label_binding;
DEF_VEC_O(cp_label_binding);
DEF_VEC_ALLOC_O(cp_label_binding,gc);
/* 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. */
hashtab.h: Update GTY annotations to new syntax 2009-04-21 Taras Glek <tglek@mozilla.com> * include/hashtab.h: Update GTY annotations to new syntax * include/splay-tree.h: Likewise gcc/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * alias.c: Update GTY annotations to new syntax * basic-block.h: Likewise * bitmap.h: Likewise * c-common.h: Likewise * c-decl.c: Likewise * c-parser.c: Likewise * c-pragma.c: Likewise * c-tree.h: Likewise * cfgloop.h: Likewise * cgraph.h: Likewise * config/alpha/alpha.c: Likewise * config/arm/arm.h: Likewise * config/avr/avr.h: Likewise * config/bfin/bfin.c: Likewise * config/cris/cris.c: Likewise * config/darwin.c: Likewise * config/frv/frv.c: Likewise * config/i386/i386.c: Likewise * config/i386/i386.h: Likewise * config/i386/winnt.c: Likewise * config/ia64/ia64.h: Likewise * config/iq2000/iq2000.c: Likewise * config/mips/mips.c: Likewise * config/mmix/mmix.h: Likewise * config/pa/pa.c: Likewise * config/pa/pa.h: Likewise * config/rs6000/rs6000.c: Likewise * config/s390/s390.c: Likewise * config/sparc/sparc.c: Likewise * config/xtensa/xtensa.c: Likewise * cselib.h: Likewise * dbxout.c: Likewise * dwarf2out.c: Likewise * except.c: Likewise * except.h: Likewise * fixed-value.h: Likewise * function.c: Likewise * function.h: Likewise * gimple.h: Likewise * integrate.c: Likewise * optabs.c: Likewise * output.h: Likewise * real.h: Likewise * rtl.h: Likewise * stringpool.c: Likewise * tree-data-ref.c: Likewise * tree-flow.h: Likewise * tree-scalar-evolution.c: Likewise * tree-ssa-address.c: Likewise * tree-ssa-alias.h: Likewise * tree-ssa-operands.h: Likewise * tree.c: Likewise * tree.h: Likewise * varasm.c: Likewise * varray.h: Likewise * vec.h: Likewise * coretypes.h: Do not define GTY macro if it is already defined * doc/gty.texi: Update GTY documentation to new syntax * gengtype-lex.l: Enforce attribute-like syntax for GTY annotations on structs * gengtype-parse.c: Likewise gcc/ada/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * gcc-interface/ada-tree.h: Update GTY annotations to new syntax * gcc-interface/trans.c: Likewise * gcc-interface/utils.c: Likewise gcc/cp/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * cp-tree.h: Update GTY annotations to new syntax * decl.c: Likewise * mangle.c: Likewise * name-lookup.c: Likewise * name-lookup.h: Likewise * parser.c: Likewise * pt.c: Likewise * rtti.c: Likewise * semantics.c: Likewise * typeck2.c: Likewise gcc/fortran/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * f95-lang.c: Update GTY annotations to new syntax * trans-intrinsic.c: Likewise * trans-io.c: Likewise * trans.h: Likewise gcc/java/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * builtins.c: Update GTY annotations to new syntax * decl.c: Likewise * java-tree.h: Likewise * jcf.h: Likewise * lang.c: Likewise gcc/objc/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * objc-act.c: Update GTY annotations to new syntax * objc-act.h: Likewise libcpp/ChangeLog 2009-04-21 Taras Glek <tglek@mozilla.com> * include/cpp-id-data.h: Update GTY annotations to new syntax * include/cpplib.h: Likewise * include/line-map.h: Likewise * include/symtab.h: Likewise From-SVN: r146607
2009-04-22 20:29:36 +02:00
struct GTY(()) cp_binding_level {
/* 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) */
VEC(tree,gc) *static_decls;
/* 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;
/* 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;
/* Similar to class_shadowed, but for IDENTIFIER_TYPE_VALUE, and
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. */
tree type_shadowed;
/* Similar to class_shadowed, but for IDENTIFIER_LABEL_VALUE, and
used for all binding levels. */
VEC(cp_label_binding,gc) *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. */
VEC(tree,gc) *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;
/* 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
SK_TEMPLATE_PARMS and EXPLICIT_SPEC_P set to true. */
ENUM_BITFIELD (scope_kind) kind : 4;
/* True if this scope is an SK_TEMPLATE_SPEC scope. This field is
only valid if KIND == SK_TEMPLATE_PARMS. */
BOOL_BITFIELD explicit_spec_p : 1;
/* 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;
/* 24 bits left to fill a 32-bit word. */
};
/* The binding level currently in effect. */
#define current_binding_level \
(*(cfun && cp_function_chain && 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
/* The tree node representing the global scope. */
extern GTY(()) tree global_namespace;
Break out decl.c (2/n) Break out decl.c (2/n) * name-lookup.c: Include diagnostic.h (cxx_binding_free): Make static. (cxx_binding_make): Likewise. (binding_table_new): Likewise (binding_table_free): Likewise. (binding_table_insert): Likewise. (binding_table_find_anon_type): Likewise. (binding_table_reverse_maybe_remap): Likewise. (supplement_binding): Likewise. * name-lookup.h (global_scope_name): Declare extern. (global_type_node): Likewise. (cxx_binding_free): Don't export. (cxx_binding_make): Likewise. (binding_table_new): Likewise. (binding_table_free): Likewise. (binding_table_insert): Likewise. (binding_table_find_anon_type): Likewise. (binding_table_reverse_maybe_remap): Likewise. * Make-lang.in (cp/name-lookup.o): Depend on $(DIAGNOSTIC_H) * decl.c (lookup_namespace_name): Move to name-lookup.c (select_decl): Likewise. (unqualified_namespace_lookup): Likewise. (lookup_qualified_name): Likewise. (lookup_name_real): Likewise. (lookup_name_nonclass): Likewise. (lookup_function_nonclass): Likewise. (lookup_name): Likewise. (lookup_name_current_level): Likewise. (lookup_type_current_level): Likewise. (lookup_flags): Likewise. (qualify_lookup): Likewise. (lookup_tag): Likewise. (lookup_tag_reverse): Likewise. (getdecls): Likewise. (storedecls): Remove. (cxx_remember_type_decls): Likewise. (global_bindings_p): Likewise. (innermost_nonclass_level): Likewise. (toplevel_bindings_p): Likewise. (namespace_bindings_p): Likewise. (kept_level_p): Likewise. (innermost_scope_kind): Likewise. (template_parm_scope_p): Likewise. (push_binding): Likewise. (push_local_binding): Likewise. (add_decl_to_level): Likewise. Make extern. (push_class_binding): Move to name-lookup.c. (resume_level): Likewise. Rename to resume_scope. (begin_scope): Likewise. (indent): Likewise. (binding_depth): Likewise. (is_class_level): Likewise. (cxx_scope_descriptor): Likewise. (cxx_scope_debug): Likewise. (namespace_scope_ht_size): Likewise. (leave_scope): Likewise. (pushlevel_class): Likewise. (poplevel_class): Likewise. (clear_identifier_class_values): Likewise. (pushdecl_with_scope): Likewise. (pushdecl_namespace_level): Likewise. (pushdecl_class_level): Likewise. (push_class_level_binding): Likewise. (push_using_directive): Likewise. (identifier_global_value): Likewise. (keep_next_level_flag): Likewise. (keep_next_level): Likewise. (free_binding_level): Likewise. (set_class_shadows): Likewise. (maybe_push_cleanup_level): Likewise. (cp_namespace_decls): Likewise. (bt_print_entry): Likewise. (print_binding_level): Likewise. (print_other_binding_stack): Likewise. (print_binding_stack): Likewise. (push_namespace): Likewise. (pop_namespace): Likewise. (push_nested_namespace): Likewise. (pop_nested_namespace): Likewise. (cxx_saved_binding_make): Likewise. (struct cxx_saved_binding_make): Likewise. (store_bindings): Likewise. (maybe_push_to_top_level): Likewise. (push_to_top_level): Likewise. (pop_from_top_level): Likewise. (identifier_type_value): Likewise. (set_identifier_type_value): Likewise. (set_identifier_type_value_with_scope): Likewise. (pop_everything): Likewise. (pushtag): Likewise. (follow_tag_typedef): Likewise. (maybe_process_template_type_declaration): Likewise. (pop_binding): Likewise. * cp-tree.h: Move corresponding declarations to name-lookup.h From-SVN: r72426
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;
/* True if SCOPE designates the global scope binding contour. */
#define global_scope_p(SCOPE) \
((SCOPE) == NAMESPACE_LEVEL (global_namespace))
Break out decl.c (2/n) Break out decl.c (2/n) * name-lookup.c: Include diagnostic.h (cxx_binding_free): Make static. (cxx_binding_make): Likewise. (binding_table_new): Likewise (binding_table_free): Likewise. (binding_table_insert): Likewise. (binding_table_find_anon_type): Likewise. (binding_table_reverse_maybe_remap): Likewise. (supplement_binding): Likewise. * name-lookup.h (global_scope_name): Declare extern. (global_type_node): Likewise. (cxx_binding_free): Don't export. (cxx_binding_make): Likewise. (binding_table_new): Likewise. (binding_table_free): Likewise. (binding_table_insert): Likewise. (binding_table_find_anon_type): Likewise. (binding_table_reverse_maybe_remap): Likewise. * Make-lang.in (cp/name-lookup.o): Depend on $(DIAGNOSTIC_H) * decl.c (lookup_namespace_name): Move to name-lookup.c (select_decl): Likewise. (unqualified_namespace_lookup): Likewise. (lookup_qualified_name): Likewise. (lookup_name_real): Likewise. (lookup_name_nonclass): Likewise. (lookup_function_nonclass): Likewise. (lookup_name): Likewise. (lookup_name_current_level): Likewise. (lookup_type_current_level): Likewise. (lookup_flags): Likewise. (qualify_lookup): Likewise. (lookup_tag): Likewise. (lookup_tag_reverse): Likewise. (getdecls): Likewise. (storedecls): Remove. (cxx_remember_type_decls): Likewise. (global_bindings_p): Likewise. (innermost_nonclass_level): Likewise. (toplevel_bindings_p): Likewise. (namespace_bindings_p): Likewise. (kept_level_p): Likewise. (innermost_scope_kind): Likewise. (template_parm_scope_p): Likewise. (push_binding): Likewise. (push_local_binding): Likewise. (add_decl_to_level): Likewise. Make extern. (push_class_binding): Move to name-lookup.c. (resume_level): Likewise. Rename to resume_scope. (begin_scope): Likewise. (indent): Likewise. (binding_depth): Likewise. (is_class_level): Likewise. (cxx_scope_descriptor): Likewise. (cxx_scope_debug): Likewise. (namespace_scope_ht_size): Likewise. (leave_scope): Likewise. (pushlevel_class): Likewise. (poplevel_class): Likewise. (clear_identifier_class_values): Likewise. (pushdecl_with_scope): Likewise. (pushdecl_namespace_level): Likewise. (pushdecl_class_level): Likewise. (push_class_level_binding): Likewise. (push_using_directive): Likewise. (identifier_global_value): Likewise. (keep_next_level_flag): Likewise. (keep_next_level): Likewise. (free_binding_level): Likewise. (set_class_shadows): Likewise. (maybe_push_cleanup_level): Likewise. (cp_namespace_decls): Likewise. (bt_print_entry): Likewise. (print_binding_level): Likewise. (print_other_binding_stack): Likewise. (print_binding_stack): Likewise. (push_namespace): Likewise. (pop_namespace): Likewise. (push_nested_namespace): Likewise. (pop_nested_namespace): Likewise. (cxx_saved_binding_make): Likewise. (struct cxx_saved_binding_make): Likewise. (store_bindings): Likewise. (maybe_push_to_top_level): Likewise. (push_to_top_level): Likewise. (pop_from_top_level): Likewise. (identifier_type_value): Likewise. (set_identifier_type_value): Likewise. (set_identifier_type_value_with_scope): Likewise. (pop_everything): Likewise. (pushtag): Likewise. (follow_tag_typedef): Likewise. (maybe_process_template_type_declaration): Likewise. (pop_binding): Likewise. * cp-tree.h: Move corresponding declarations to name-lookup.h From-SVN: r72426
2003-10-13 12:26:36 +02:00
extern cxx_scope *leave_scope (void);
extern bool kept_level_p (void);
extern bool global_bindings_p (void);
Break out decl.c (2/n) Break out decl.c (2/n) * name-lookup.c: Include diagnostic.h (cxx_binding_free): Make static. (cxx_binding_make): Likewise. (binding_table_new): Likewise (binding_table_free): Likewise. (binding_table_insert): Likewise. (binding_table_find_anon_type): Likewise. (binding_table_reverse_maybe_remap): Likewise. (supplement_binding): Likewise. * name-lookup.h (global_scope_name): Declare extern. (global_type_node): Likewise. (cxx_binding_free): Don't export. (cxx_binding_make): Likewise. (binding_table_new): Likewise. (binding_table_free): Likewise. (binding_table_insert): Likewise. (binding_table_find_anon_type): Likewise. (binding_table_reverse_maybe_remap): Likewise. * Make-lang.in (cp/name-lookup.o): Depend on $(DIAGNOSTIC_H) * decl.c (lookup_namespace_name): Move to name-lookup.c (select_decl): Likewise. (unqualified_namespace_lookup): Likewise. (lookup_qualified_name): Likewise. (lookup_name_real): Likewise. (lookup_name_nonclass): Likewise. (lookup_function_nonclass): Likewise. (lookup_name): Likewise. (lookup_name_current_level): Likewise. (lookup_type_current_level): Likewise. (lookup_flags): Likewise. (qualify_lookup): Likewise. (lookup_tag): Likewise. (lookup_tag_reverse): Likewise. (getdecls): Likewise. (storedecls): Remove. (cxx_remember_type_decls): Likewise. (global_bindings_p): Likewise. (innermost_nonclass_level): Likewise. (toplevel_bindings_p): Likewise. (namespace_bindings_p): Likewise. (kept_level_p): Likewise. (innermost_scope_kind): Likewise. (template_parm_scope_p): Likewise. (push_binding): Likewise. (push_local_binding): Likewise. (add_decl_to_level): Likewise. Make extern. (push_class_binding): Move to name-lookup.c. (resume_level): Likewise. Rename to resume_scope. (begin_scope): Likewise. (indent): Likewise. (binding_depth): Likewise. (is_class_level): Likewise. (cxx_scope_descriptor): Likewise. (cxx_scope_debug): Likewise. (namespace_scope_ht_size): Likewise. (leave_scope): Likewise. (pushlevel_class): Likewise. (poplevel_class): Likewise. (clear_identifier_class_values): Likewise. (pushdecl_with_scope): Likewise. (pushdecl_namespace_level): Likewise. (pushdecl_class_level): Likewise. (push_class_level_binding): Likewise. (push_using_directive): Likewise. (identifier_global_value): Likewise. (keep_next_level_flag): Likewise. (keep_next_level): Likewise. (free_binding_level): Likewise. (set_class_shadows): Likewise. (maybe_push_cleanup_level): Likewise. (cp_namespace_decls): Likewise. (bt_print_entry): Likewise. (print_binding_level): Likewise. (print_other_binding_stack): Likewise. (print_binding_stack): Likewise. (push_namespace): Likewise. (pop_namespace): Likewise. (push_nested_namespace): Likewise. (pop_nested_namespace): Likewise. (cxx_saved_binding_make): Likewise. (struct cxx_saved_binding_make): Likewise. (store_bindings): Likewise. (maybe_push_to_top_level): Likewise. (push_to_top_level): Likewise. (pop_from_top_level): Likewise. (identifier_type_value): Likewise. (set_identifier_type_value): Likewise. (set_identifier_type_value_with_scope): Likewise. (pop_everything): Likewise. (pushtag): Likewise. (follow_tag_typedef): Likewise. (maybe_process_template_type_declaration): Likewise. (pop_binding): Likewise. * cp-tree.h: Move corresponding declarations to name-lookup.h From-SVN: r72426
2003-10-13 12:26:36 +02:00
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);
extern bool is_ancestor (tree, tree);
extern tree push_scope (tree);
extern void pop_scope (tree);
extern tree push_inner_scope (tree);
extern void pop_inner_scope (tree, tree);
extern void push_binding_level (struct cp_binding_level *);
Break out decl.c (2/n) Break out decl.c (2/n) * name-lookup.c: Include diagnostic.h (cxx_binding_free): Make static. (cxx_binding_make): Likewise. (binding_table_new): Likewise (binding_table_free): Likewise. (binding_table_insert): Likewise. (binding_table_find_anon_type): Likewise. (binding_table_reverse_maybe_remap): Likewise. (supplement_binding): Likewise. * name-lookup.h (global_scope_name): Declare extern. (global_type_node): Likewise. (cxx_binding_free): Don't export. (cxx_binding_make): Likewise. (binding_table_new): Likewise. (binding_table_free): Likewise. (binding_table_insert): Likewise. (binding_table_find_anon_type): Likewise. (binding_table_reverse_maybe_remap): Likewise. * Make-lang.in (cp/name-lookup.o): Depend on $(DIAGNOSTIC_H) * decl.c (lookup_namespace_name): Move to name-lookup.c (select_decl): Likewise. (unqualified_namespace_lookup): Likewise. (lookup_qualified_name): Likewise. (lookup_name_real): Likewise. (lookup_name_nonclass): Likewise. (lookup_function_nonclass): Likewise. (lookup_name): Likewise. (lookup_name_current_level): Likewise. (lookup_type_current_level): Likewise. (lookup_flags): Likewise. (qualify_lookup): Likewise. (lookup_tag): Likewise. (lookup_tag_reverse): Likewise. (getdecls): Likewise. (storedecls): Remove. (cxx_remember_type_decls): Likewise. (global_bindings_p): Likewise. (innermost_nonclass_level): Likewise. (toplevel_bindings_p): Likewise. (namespace_bindings_p): Likewise. (kept_level_p): Likewise. (innermost_scope_kind): Likewise. (template_parm_scope_p): Likewise. (push_binding): Likewise. (push_local_binding): Likewise. (add_decl_to_level): Likewise. Make extern. (push_class_binding): Move to name-lookup.c. (resume_level): Likewise. Rename to resume_scope. (begin_scope): Likewise. (indent): Likewise. (binding_depth): Likewise. (is_class_level): Likewise. (cxx_scope_descriptor): Likewise. (cxx_scope_debug): Likewise. (namespace_scope_ht_size): Likewise. (leave_scope): Likewise. (pushlevel_class): Likewise. (poplevel_class): Likewise. (clear_identifier_class_values): Likewise. (pushdecl_with_scope): Likewise. (pushdecl_namespace_level): Likewise. (pushdecl_class_level): Likewise. (push_class_level_binding): Likewise. (push_using_directive): Likewise. (identifier_global_value): Likewise. (keep_next_level_flag): Likewise. (keep_next_level): Likewise. (free_binding_level): Likewise. (set_class_shadows): Likewise. (maybe_push_cleanup_level): Likewise. (cp_namespace_decls): Likewise. (bt_print_entry): Likewise. (print_binding_level): Likewise. (print_other_binding_stack): Likewise. (print_binding_stack): Likewise. (push_namespace): Likewise. (pop_namespace): Likewise. (push_nested_namespace): Likewise. (pop_nested_namespace): Likewise. (cxx_saved_binding_make): Likewise. (struct cxx_saved_binding_make): Likewise. (store_bindings): Likewise. (maybe_push_to_top_level): Likewise. (push_to_top_level): Likewise. (pop_from_top_level): Likewise. (identifier_type_value): Likewise. (set_identifier_type_value): Likewise. (set_identifier_type_value_with_scope): Likewise. (pop_everything): Likewise. (pushtag): Likewise. (follow_tag_typedef): Likewise. (maybe_process_template_type_declaration): Likewise. (pop_binding): Likewise. * cp-tree.h: Move corresponding declarations to name-lookup.h From-SVN: r72426
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 bool handle_namespace_attrs (tree, tree);
Break out decl.c (2/n) Break out decl.c (2/n) * name-lookup.c: Include diagnostic.h (cxx_binding_free): Make static. (cxx_binding_make): Likewise. (binding_table_new): Likewise (binding_table_free): Likewise. (binding_table_insert): Likewise. (binding_table_find_anon_type): Likewise. (binding_table_reverse_maybe_remap): Likewise. (supplement_binding): Likewise. * name-lookup.h (global_scope_name): Declare extern. (global_type_node): Likewise. (cxx_binding_free): Don't export. (cxx_binding_make): Likewise. (binding_table_new): Likewise. (binding_table_free): Likewise. (binding_table_insert): Likewise. (binding_table_find_anon_type): Likewise. (binding_table_reverse_maybe_remap): Likewise. * Make-lang.in (cp/name-lookup.o): Depend on $(DIAGNOSTIC_H) * decl.c (lookup_namespace_name): Move to name-lookup.c (select_decl): Likewise. (unqualified_namespace_lookup): Likewise. (lookup_qualified_name): Likewise. (lookup_name_real): Likewise. (lookup_name_nonclass): Likewise. (lookup_function_nonclass): Likewise. (lookup_name): Likewise. (lookup_name_current_level): Likewise. (lookup_type_current_level): Likewise. (lookup_flags): Likewise. (qualify_lookup): Likewise. (lookup_tag): Likewise. (lookup_tag_reverse): Likewise. (getdecls): Likewise. (storedecls): Remove. (cxx_remember_type_decls): Likewise. (global_bindings_p): Likewise. (innermost_nonclass_level): Likewise. (toplevel_bindings_p): Likewise. (namespace_bindings_p): Likewise. (kept_level_p): Likewise. (innermost_scope_kind): Likewise. (template_parm_scope_p): Likewise. (push_binding): Likewise. (push_local_binding): Likewise. (add_decl_to_level): Likewise. Make extern. (push_class_binding): Move to name-lookup.c. (resume_level): Likewise. Rename to resume_scope. (begin_scope): Likewise. (indent): Likewise. (binding_depth): Likewise. (is_class_level): Likewise. (cxx_scope_descriptor): Likewise. (cxx_scope_debug): Likewise. (namespace_scope_ht_size): Likewise. (leave_scope): Likewise. (pushlevel_class): Likewise. (poplevel_class): Likewise. (clear_identifier_class_values): Likewise. (pushdecl_with_scope): Likewise. (pushdecl_namespace_level): Likewise. (pushdecl_class_level): Likewise. (push_class_level_binding): Likewise. (push_using_directive): Likewise. (identifier_global_value): Likewise. (keep_next_level_flag): Likewise. (keep_next_level): Likewise. (free_binding_level): Likewise. (set_class_shadows): Likewise. (maybe_push_cleanup_level): Likewise. (cp_namespace_decls): Likewise. (bt_print_entry): Likewise. (print_binding_level): Likewise. (print_other_binding_stack): Likewise. (print_binding_stack): Likewise. (push_namespace): Likewise. (pop_namespace): Likewise. (push_nested_namespace): Likewise. (pop_nested_namespace): Likewise. (cxx_saved_binding_make): Likewise. (struct cxx_saved_binding_make): Likewise. (store_bindings): Likewise. (maybe_push_to_top_level): Likewise. (push_to_top_level): Likewise. (pop_from_top_level): Likewise. (identifier_type_value): Likewise. (set_identifier_type_value): Likewise. (set_identifier_type_value_with_scope): Likewise. (pop_everything): Likewise. (pushtag): Likewise. (follow_tag_typedef): Likewise. (maybe_process_template_type_declaration): Likewise. (pop_binding): Likewise. * cp-tree.h: Move corresponding declarations to name-lookup.h From-SVN: r72426
2003-10-13 12:26:36 +02:00
extern void pushlevel_class (void);
extern void poplevel_class (void);
re PR c++/7874 (g++ finds friend functions defined in class-definition but not declared in the enclosing namespace) ./ PR g++/7874 * c.opt (ffriend-injection): New C++ option. * doc/invoke.texi (Option Summary): Mention -ffriend-injection. (C++ Dialect Options): Document -ffriend-injection. cp/ PR g++/7874 * cp-tree.h (struct lang_decl_flags): Add hidden_friend_p bitfield. Make dummy bitfield one bit smaller. (DECL_HIDDEN_FRIEND_P): Define. (pushdecl_maybe_friend): Declare. (pushdecl_top_level_maybe_friend): Declare. * decl.c (duplicate_decls): Add newdecl_is_friend parameter. Change prototype and all callers. Add assertion that a DECL_ARTIFICIAL FUNCTION_DECL is not DECL_HIDDEN_FRIEND_P. Set DECL_ANTICIPATED and DECL_HIDDEN_FRIEND_P in duplicated decl if appropriate. * name-lookup.c (supplement_binding): Don't ignore a DECL_HIDDEN_FRIEND_P. (pushdecl_maybe_friend): Break out contents of pushdecl. Add is_friend parameter. Set DECL_ANTICIPATED and DECL_HIDDEN_FRIEND_P for a friend function. (pushdecl): Just call pushdecl_maybe_friend. (pushdecl_with_scope): Add is_friend parameter. Change prototype and all callers. (pushdecl_namespace_level): Likewise. (push_overloaded_decl): Likewise. Check DECL_HIDDEN_FRIEND_P as well as DECL_ANTICIPATED when checking for a builtin. (do_nonmember_using_decl): Check DECL_HIDDEN_FRIEND_P as well as DECL_ANTICIPATED when checking for a builtin. (do_nonmember_using_decl): Likewise. (pushdecl_top_level_1): Add is_friend parameter. Change all callers. (pushdecl_top_level_maybe_friend): New function. (remove_hidden_names): New function. (struct arg_lookup): Add args field. (friend_of_associated_class_p): New static function. (arg_assoc_namespace): Ignore hidden functions which are not friends of an associated class of some argument. (lookup_arg_dependent): Remove hidden functions from list passed in. Initialize k.args. * name-lookup.h (remove_hidden_names): Declare. * friend.c (do_friend): Call pushdecl_maybe_friend instead of pushdecl. * call.c (add_function_candidate): Change DECL_ANTICIPATED test to an assertion, with a check for DECL_HIDDEN_FRIEND_P. (build_new_function_call): Add koenig_p parameter. Change prototype and callers. * pt.c (register_specialization): Add is_friend parameter. Change all callers. (push_template_decl_real): Change is_friend parameter to bool. Change prototype and all callers. (tsubst_friend_class): Call pushdecl_top_level_maybe_friend instead of pushdecl_top_level. testsuite/ PR g++/7874 * g++.dg/lookup/friend7.C: New test. * g++.dg/lookup/friend8.C: New test. * g++.dg/parse/defarg4.C: Add a parameter to the friend function, so that it will be found via argument dependent lookup. * g++.old-deja/g++.brendan/crash56.C: Don't expect errors for friend functions which will no longer be found. * g++.old-deja/g++.jason/friend.C: Add a parameter to the friend function g, so that it will be found via argument dependent lookup. * g++.old-deja/g++.jason/scoping15.C: Use -ffriend-injection. * g++.old-deja/g++.mike/net43.C: Likewise. From-SVN: r104188
2005-09-12 21:54:23 +02:00
extern tree pushdecl_with_scope (tree, cxx_scope *, bool);
extern tree lookup_name_prefer_type (tree, int);
extern tree lookup_name_real (tree, int, int, bool, int, int);
extern tree lookup_type_scope (tree, tag_scope);
extern tree namespace_binding (tree, tree);
extern void set_namespace_binding (tree, tree, tree);
Friend class name lookup 5/n PR c++/1016 Friend class name lookup 5/n PR c++/1016 * cp-tree.h (pushtag): Adjust declaration. * decl.c (lookup_and_check_tag): Call lookup_type_scope if lookup_name fails. (xref_tag): Adjust call to pushtag. Make hidden class visible. (start_enum): Adjust call to pushtag. * name-lookup.c (ambiguous_decl): Ignore hidden names. (qualify_lookup): Change return type to bool. (hidden_name_p): New function. (lookup_namespace_name, unqualified_namespace_lookup, lookup_name_real): Use it. (lookup_type_scope): Update comments. (maybe_process_template_type_declaration): Change parameter name from globalize to is_friend. (pushtag): Change globalize parameter of type int to tag_scope. Hide name if introduced by friend declaration. * name-lookup.h (hidden_name_p): Add declaration. * parser.c (cp_parser_lookup_name): Don't deal with hidden name here. * pt.c (push_template_decl_real): Make hidden class template visible. (lookup_template_class, instantiate_class_template): Adjust call to pushtag. * semantics.c (begin_class_definition): Likewise. * rtti.c (init_rtti_processing, build_dynamic_cast_1, tinfo_base_init, emit_support_tinfos): Use ts_current instead of ts_global. * g++.dg/lookup/hidden-class1.C: New test. * g++.dg/lookup/hidden-class2.C: Likewise. * g++.dg/lookup/hidden-class3.C: Likewise. * g++.dg/lookup/hidden-class4.C: Likewise. * g++.dg/lookup/hidden-class5.C: Likewise. * g++.dg/lookup/hidden-class6.C: Likewise. * g++.dg/lookup/hidden-class7.C: Likewise. * g++.dg/lookup/hidden-class8.C: Likewise. * g++.dg/lookup/hidden-class9.C: Likewise. * g++.dg/lookup/hidden-temp-class1.C: Likewise. * g++.dg/lookup/hidden-temp-class2.C: Likewise. * g++.dg/lookup/hidden-temp-class3.C: Likewise. * g++.dg/lookup/hidden-temp-class4.C: Likewise. * g++.dg/lookup/hidden-temp-class5.C: Likewise. * g++.dg/lookup/hidden-temp-class6.C: Likewise. * g++.dg/lookup/hidden-temp-class7.C: Likewise. * g++.dg/lookup/hidden-temp-class8.C: Likewise. * g++.dg/lookup/hidden-temp-class9.C: Likewise. * g++.dg/lookup/hidden-temp-class10.C: Likewise. * g++.dg/lookup/hidden-temp-class11.C: Likewise. From-SVN: r96430
2005-03-14 15:33:54 +01:00
extern bool hidden_name_p (tree);
re PR c++/7874 (g++ finds friend functions defined in class-definition but not declared in the enclosing namespace) ./ PR g++/7874 * c.opt (ffriend-injection): New C++ option. * doc/invoke.texi (Option Summary): Mention -ffriend-injection. (C++ Dialect Options): Document -ffriend-injection. cp/ PR g++/7874 * cp-tree.h (struct lang_decl_flags): Add hidden_friend_p bitfield. Make dummy bitfield one bit smaller. (DECL_HIDDEN_FRIEND_P): Define. (pushdecl_maybe_friend): Declare. (pushdecl_top_level_maybe_friend): Declare. * decl.c (duplicate_decls): Add newdecl_is_friend parameter. Change prototype and all callers. Add assertion that a DECL_ARTIFICIAL FUNCTION_DECL is not DECL_HIDDEN_FRIEND_P. Set DECL_ANTICIPATED and DECL_HIDDEN_FRIEND_P in duplicated decl if appropriate. * name-lookup.c (supplement_binding): Don't ignore a DECL_HIDDEN_FRIEND_P. (pushdecl_maybe_friend): Break out contents of pushdecl. Add is_friend parameter. Set DECL_ANTICIPATED and DECL_HIDDEN_FRIEND_P for a friend function. (pushdecl): Just call pushdecl_maybe_friend. (pushdecl_with_scope): Add is_friend parameter. Change prototype and all callers. (pushdecl_namespace_level): Likewise. (push_overloaded_decl): Likewise. Check DECL_HIDDEN_FRIEND_P as well as DECL_ANTICIPATED when checking for a builtin. (do_nonmember_using_decl): Check DECL_HIDDEN_FRIEND_P as well as DECL_ANTICIPATED when checking for a builtin. (do_nonmember_using_decl): Likewise. (pushdecl_top_level_1): Add is_friend parameter. Change all callers. (pushdecl_top_level_maybe_friend): New function. (remove_hidden_names): New function. (struct arg_lookup): Add args field. (friend_of_associated_class_p): New static function. (arg_assoc_namespace): Ignore hidden functions which are not friends of an associated class of some argument. (lookup_arg_dependent): Remove hidden functions from list passed in. Initialize k.args. * name-lookup.h (remove_hidden_names): Declare. * friend.c (do_friend): Call pushdecl_maybe_friend instead of pushdecl. * call.c (add_function_candidate): Change DECL_ANTICIPATED test to an assertion, with a check for DECL_HIDDEN_FRIEND_P. (build_new_function_call): Add koenig_p parameter. Change prototype and callers. * pt.c (register_specialization): Add is_friend parameter. Change all callers. (push_template_decl_real): Change is_friend parameter to bool. Change prototype and all callers. (tsubst_friend_class): Call pushdecl_top_level_maybe_friend instead of pushdecl_top_level. testsuite/ PR g++/7874 * g++.dg/lookup/friend7.C: New test. * g++.dg/lookup/friend8.C: New test. * g++.dg/parse/defarg4.C: Add a parameter to the friend function, so that it will be found via argument dependent lookup. * g++.old-deja/g++.brendan/crash56.C: Don't expect errors for friend functions which will no longer be found. * g++.old-deja/g++.jason/friend.C: Add a parameter to the friend function g, so that it will be found via argument dependent lookup. * g++.old-deja/g++.jason/scoping15.C: Use -ffriend-injection. * g++.old-deja/g++.mike/net43.C: Likewise. From-SVN: r104188
2005-09-12 21:54:23 +02:00
extern tree remove_hidden_names (tree);
Break out decl.c (2/n) Break out decl.c (2/n) * name-lookup.c: Include diagnostic.h (cxx_binding_free): Make static. (cxx_binding_make): Likewise. (binding_table_new): Likewise (binding_table_free): Likewise. (binding_table_insert): Likewise. (binding_table_find_anon_type): Likewise. (binding_table_reverse_maybe_remap): Likewise. (supplement_binding): Likewise. * name-lookup.h (global_scope_name): Declare extern. (global_type_node): Likewise. (cxx_binding_free): Don't export. (cxx_binding_make): Likewise. (binding_table_new): Likewise. (binding_table_free): Likewise. (binding_table_insert): Likewise. (binding_table_find_anon_type): Likewise. (binding_table_reverse_maybe_remap): Likewise. * Make-lang.in (cp/name-lookup.o): Depend on $(DIAGNOSTIC_H) * decl.c (lookup_namespace_name): Move to name-lookup.c (select_decl): Likewise. (unqualified_namespace_lookup): Likewise. (lookup_qualified_name): Likewise. (lookup_name_real): Likewise. (lookup_name_nonclass): Likewise. (lookup_function_nonclass): Likewise. (lookup_name): Likewise. (lookup_name_current_level): Likewise. (lookup_type_current_level): Likewise. (lookup_flags): Likewise. (qualify_lookup): Likewise. (lookup_tag): Likewise. (lookup_tag_reverse): Likewise. (getdecls): Likewise. (storedecls): Remove. (cxx_remember_type_decls): Likewise. (global_bindings_p): Likewise. (innermost_nonclass_level): Likewise. (toplevel_bindings_p): Likewise. (namespace_bindings_p): Likewise. (kept_level_p): Likewise. (innermost_scope_kind): Likewise. (template_parm_scope_p): Likewise. (push_binding): Likewise. (push_local_binding): Likewise. (add_decl_to_level): Likewise. Make extern. (push_class_binding): Move to name-lookup.c. (resume_level): Likewise. Rename to resume_scope. (begin_scope): Likewise. (indent): Likewise. (binding_depth): Likewise. (is_class_level): Likewise. (cxx_scope_descriptor): Likewise. (cxx_scope_debug): Likewise. (namespace_scope_ht_size): Likewise. (leave_scope): Likewise. (pushlevel_class): Likewise. (poplevel_class): Likewise. (clear_identifier_class_values): Likewise. (pushdecl_with_scope): Likewise. (pushdecl_namespace_level): Likewise. (pushdecl_class_level): Likewise. (push_class_level_binding): Likewise. (push_using_directive): Likewise. (identifier_global_value): Likewise. (keep_next_level_flag): Likewise. (keep_next_level): Likewise. (free_binding_level): Likewise. (set_class_shadows): Likewise. (maybe_push_cleanup_level): Likewise. (cp_namespace_decls): Likewise. (bt_print_entry): Likewise. (print_binding_level): Likewise. (print_other_binding_stack): Likewise. (print_binding_stack): Likewise. (push_namespace): Likewise. (pop_namespace): Likewise. (push_nested_namespace): Likewise. (pop_nested_namespace): Likewise. (cxx_saved_binding_make): Likewise. (struct cxx_saved_binding_make): Likewise. (store_bindings): Likewise. (maybe_push_to_top_level): Likewise. (push_to_top_level): Likewise. (pop_from_top_level): Likewise. (identifier_type_value): Likewise. (set_identifier_type_value): Likewise. (set_identifier_type_value_with_scope): Likewise. (pop_everything): Likewise. (pushtag): Likewise. (follow_tag_typedef): Likewise. (maybe_process_template_type_declaration): Likewise. (pop_binding): Likewise. * cp-tree.h: Move corresponding declarations to name-lookup.h From-SVN: r72426
2003-10-13 12:26:36 +02:00
extern tree lookup_qualified_name (tree, tree, bool, bool);
extern tree lookup_name_nonclass (tree);
extern tree lookup_name_innermost_nonclass_level (tree);
extern bool is_local_extern (tree);
tree.c (build_tree_list_vec_stat): New function. ./: * tree.c (build_tree_list_vec_stat): New function. (ctor_to_vec): New function. (build_nt_call_vec): New function. (build_call_array): Change args to be a const pointer. (build_call_vec): New function. * tree.h (build_nt_call_vec): Declare. (build_tree_list_vec_stat): Declare. (build_tree_list_vec): Define. (build_call_array): Update declaration. (build_call_vec): Declare. (ctor_to_vec): Declare. * c-common.c (tree_vector_cache): New static variable. (make_tree_vector): New function. (release_tree_vector): New function. (make_tree_vector_single): New function. (make_tree_vector_copy): New function. * c-common.h (tree_vector_cache, make_tree_vector): Declare. (make_tree_vector_single, make_tree_vector_copy): Declare. * c-parser.c (cached_expr_list_1, cached_expr_list_2): Remove. (c_parser_expr_list): Don't manage cache here, instead call make_tree_vector. (c_parser_release_expr_list): Remove static function. (c_parser_vec_to_tree_list): Remove static function. (c_parser_attributes): Call build_tree_list_vec instead of c_parser_vec_to_tree_list. Call release_tree_vector instead of c_parser_release_expr_list. (c_parser_postfix_expression_after_primary): Likewise. (c_parser_objc_keywordexpr): Likewise. cp/: * parser.c (cp_parser_postfix_expression): Change args to a vec. Release it when done. (tree_vector): Define typedef. Define VEC functions. (cp_parser_parenthesized_expression_list): Change return type to vec. Change all callers. (cp_parser_new_expression): Change placement and initializer to vecs. Release them when done. (cp_parser_new_placement): Change return type to vec. Change all callers. (cp_parser_new_initializer): Likewise. * typeck.c (build_function_call_vec): Just call cp_build_function_call_vec. (cp_build_function_call): Just build a vec and call cp_build_function_call_vec. (cp_build_function_call_vec): New function based on old cp_build_function_call. (convert_arguments): Remove nargs and argarray parameters. Change values to a vec. Change caller. (build_x_compound_expr_from_vec): New function. (cp_build_modify_expr): Build vec to pass to build_special_member_call. * call.c (struct z_candidate): Add first_arg field. Change args field to vec. (convert_class_to_reference): Handle first argument separately. (add_candidate): Add first_arg parameter. Change args parameter to vec. Change all callers. (add_function_candidate, add_conv_candidate): Likewise. (add_template_candidate_real, add_template_candidate): Likewise. (add_template_conv_candidate): Likewise. (build_user_type_conversion_1): Handle first argument separately. (resolve_args): Change return type and parameter type to vecs. Change all callers. (perform_overload_resolution): Change args parameter to vec. Change all callers. (build_new_function_call, build_operator_new_call): Likewise. (add_candidates): Likewise. (build_op_call): New globally visible function, built from and replacing static function build_object_call. (build_new_op): Don't handle CALL_EXPR. Build vec, not tree_list, of arguments. (build_op_delete_call): Build vec to pass to cp_build_function_call_vec. (build_temp): Build vec to pass to build_special_member_call. (convert_like_real): Likewise. (perform_direct_initialization_if_possible): Likewise. (build_over_call): Handle first_arg field. Use build_call_array rather than build_call_list. (build_special_member_call): Change args parameter to vec. Change all callers. (build_new_method_call): Likewise. * init.c (expand_default_init): Change parms to vec. (build_raw_new_expr): Change placement and init to vecs. Change all callers. (build_new_1, build_new): Likewise. * class.c (resolve_address_of_overloaded_function): Build array to pass to fn_type_unification. * pt.c (tsubst_copy_and_build): For NEW_EXPR build vecs to pass to build_new. For CALL_EXPR create a vec rather than a tree_list; expand a pack if necessary. (fn_type_unification): Change args parameter to const tree *. Add nargs parameter. Change all callers. (type_unification_real): Likewise. (unify): Build array to pass to type_unification_real. (get_bindings): Build array to pass to fn_type_unification. (any_type_dependent_arguments_p): Change args parameter to a vec. Change all callers. (make_args_non_dependent): Renamed from build_non_dependent_args. Change return type to void. Change parameter type to vec. Change all callers. (do_auto_deduction): Pass an array to type_unification_real. * semantics.c (perform_koenig_lookup): Change args to vec. Change all callers. (finish_call_expr): Change args to vec. Change all callers. Call build_op_call instead of passing CALL_EXPR to build_new_op. (cxx_omp_create_clause_info): Allocate vec to pass to build_special_member_call. * decl2.c (build_offset_ref_call_from_tree): Change args parameter to vec. Change all callers. * name-lookup.c (lookup_function_nonclass): Likewise. (struct arg_lookup): Change args to vec. (arg_assoc_namespace): Handle args as a vec. (arg_assoc_args_vec): New static function. (lookup_arg_dependent): Change args parameter to vec. Change all callers. * method.c (do_build_assign_ref): Allocate vec to pass to build_special_member_call. * except.c (build_throw): Likewise. * typeck2.c (build_functional_cast): Likewise. * cvt.c (ocp_convert): Likewise. * tree.c (build_min_non_dep_call_vec): Change last parameter to vec. Change all callers. * cp-tree.h: Update declarations. * name-lookup.h: Update declarations. objc/: * objc-act.c (objc_generate_cxx_ctor_or_dtor): Pass NULL rather than NULL_TREE to build_special_member_call. From-SVN: r147759
2009-05-21 07:58:39 +02:00
extern tree lookup_function_nonclass (tree, VEC(tree,gc) *, bool);
extern void push_local_binding (tree, tree, int);
Break out decl.c (2/n) Break out decl.c (2/n) * name-lookup.c: Include diagnostic.h (cxx_binding_free): Make static. (cxx_binding_make): Likewise. (binding_table_new): Likewise (binding_table_free): Likewise. (binding_table_insert): Likewise. (binding_table_find_anon_type): Likewise. (binding_table_reverse_maybe_remap): Likewise. (supplement_binding): Likewise. * name-lookup.h (global_scope_name): Declare extern. (global_type_node): Likewise. (cxx_binding_free): Don't export. (cxx_binding_make): Likewise. (binding_table_new): Likewise. (binding_table_free): Likewise. (binding_table_insert): Likewise. (binding_table_find_anon_type): Likewise. (binding_table_reverse_maybe_remap): Likewise. * Make-lang.in (cp/name-lookup.o): Depend on $(DIAGNOSTIC_H) * decl.c (lookup_namespace_name): Move to name-lookup.c (select_decl): Likewise. (unqualified_namespace_lookup): Likewise. (lookup_qualified_name): Likewise. (lookup_name_real): Likewise. (lookup_name_nonclass): Likewise. (lookup_function_nonclass): Likewise. (lookup_name): Likewise. (lookup_name_current_level): Likewise. (lookup_type_current_level): Likewise. (lookup_flags): Likewise. (qualify_lookup): Likewise. (lookup_tag): Likewise. (lookup_tag_reverse): Likewise. (getdecls): Likewise. (storedecls): Remove. (cxx_remember_type_decls): Likewise. (global_bindings_p): Likewise. (innermost_nonclass_level): Likewise. (toplevel_bindings_p): Likewise. (namespace_bindings_p): Likewise. (kept_level_p): Likewise. (innermost_scope_kind): Likewise. (template_parm_scope_p): Likewise. (push_binding): Likewise. (push_local_binding): Likewise. (add_decl_to_level): Likewise. Make extern. (push_class_binding): Move to name-lookup.c. (resume_level): Likewise. Rename to resume_scope. (begin_scope): Likewise. (indent): Likewise. (binding_depth): Likewise. (is_class_level): Likewise. (cxx_scope_descriptor): Likewise. (cxx_scope_debug): Likewise. (namespace_scope_ht_size): Likewise. (leave_scope): Likewise. (pushlevel_class): Likewise. (poplevel_class): Likewise. (clear_identifier_class_values): Likewise. (pushdecl_with_scope): Likewise. (pushdecl_namespace_level): Likewise. (pushdecl_class_level): Likewise. (push_class_level_binding): Likewise. (push_using_directive): Likewise. (identifier_global_value): Likewise. (keep_next_level_flag): Likewise. (keep_next_level): Likewise. (free_binding_level): Likewise. (set_class_shadows): Likewise. (maybe_push_cleanup_level): Likewise. (cp_namespace_decls): Likewise. (bt_print_entry): Likewise. (print_binding_level): Likewise. (print_other_binding_stack): Likewise. (print_binding_stack): Likewise. (push_namespace): Likewise. (pop_namespace): Likewise. (push_nested_namespace): Likewise. (pop_nested_namespace): Likewise. (cxx_saved_binding_make): Likewise. (struct cxx_saved_binding_make): Likewise. (store_bindings): Likewise. (maybe_push_to_top_level): Likewise. (push_to_top_level): Likewise. (pop_from_top_level): Likewise. (identifier_type_value): Likewise. (set_identifier_type_value): Likewise. (set_identifier_type_value_with_scope): Likewise. (pop_everything): Likewise. (pushtag): Likewise. (follow_tag_typedef): Likewise. (maybe_process_template_type_declaration): Likewise. (pop_binding): Likewise. * cp-tree.h: Move corresponding declarations to name-lookup.h From-SVN: r72426
2003-10-13 12:26:36 +02:00
extern bool pushdecl_class_level (tree);
re PR c++/7874 (g++ finds friend functions defined in class-definition but not declared in the enclosing namespace) ./ PR g++/7874 * c.opt (ffriend-injection): New C++ option. * doc/invoke.texi (Option Summary): Mention -ffriend-injection. (C++ Dialect Options): Document -ffriend-injection. cp/ PR g++/7874 * cp-tree.h (struct lang_decl_flags): Add hidden_friend_p bitfield. Make dummy bitfield one bit smaller. (DECL_HIDDEN_FRIEND_P): Define. (pushdecl_maybe_friend): Declare. (pushdecl_top_level_maybe_friend): Declare. * decl.c (duplicate_decls): Add newdecl_is_friend parameter. Change prototype and all callers. Add assertion that a DECL_ARTIFICIAL FUNCTION_DECL is not DECL_HIDDEN_FRIEND_P. Set DECL_ANTICIPATED and DECL_HIDDEN_FRIEND_P in duplicated decl if appropriate. * name-lookup.c (supplement_binding): Don't ignore a DECL_HIDDEN_FRIEND_P. (pushdecl_maybe_friend): Break out contents of pushdecl. Add is_friend parameter. Set DECL_ANTICIPATED and DECL_HIDDEN_FRIEND_P for a friend function. (pushdecl): Just call pushdecl_maybe_friend. (pushdecl_with_scope): Add is_friend parameter. Change prototype and all callers. (pushdecl_namespace_level): Likewise. (push_overloaded_decl): Likewise. Check DECL_HIDDEN_FRIEND_P as well as DECL_ANTICIPATED when checking for a builtin. (do_nonmember_using_decl): Check DECL_HIDDEN_FRIEND_P as well as DECL_ANTICIPATED when checking for a builtin. (do_nonmember_using_decl): Likewise. (pushdecl_top_level_1): Add is_friend parameter. Change all callers. (pushdecl_top_level_maybe_friend): New function. (remove_hidden_names): New function. (struct arg_lookup): Add args field. (friend_of_associated_class_p): New static function. (arg_assoc_namespace): Ignore hidden functions which are not friends of an associated class of some argument. (lookup_arg_dependent): Remove hidden functions from list passed in. Initialize k.args. * name-lookup.h (remove_hidden_names): Declare. * friend.c (do_friend): Call pushdecl_maybe_friend instead of pushdecl. * call.c (add_function_candidate): Change DECL_ANTICIPATED test to an assertion, with a check for DECL_HIDDEN_FRIEND_P. (build_new_function_call): Add koenig_p parameter. Change prototype and callers. * pt.c (register_specialization): Add is_friend parameter. Change all callers. (push_template_decl_real): Change is_friend parameter to bool. Change prototype and all callers. (tsubst_friend_class): Call pushdecl_top_level_maybe_friend instead of pushdecl_top_level. testsuite/ PR g++/7874 * g++.dg/lookup/friend7.C: New test. * g++.dg/lookup/friend8.C: New test. * g++.dg/parse/defarg4.C: Add a parameter to the friend function, so that it will be found via argument dependent lookup. * g++.old-deja/g++.brendan/crash56.C: Don't expect errors for friend functions which will no longer be found. * g++.old-deja/g++.jason/friend.C: Add a parameter to the friend function g, so that it will be found via argument dependent lookup. * g++.old-deja/g++.jason/scoping15.C: Use -ffriend-injection. * g++.old-deja/g++.mike/net43.C: Likewise. From-SVN: r104188
2005-09-12 21:54:23 +02:00
extern tree pushdecl_namespace_level (tree, bool);
Break out decl.c (2/n) Break out decl.c (2/n) * name-lookup.c: Include diagnostic.h (cxx_binding_free): Make static. (cxx_binding_make): Likewise. (binding_table_new): Likewise (binding_table_free): Likewise. (binding_table_insert): Likewise. (binding_table_find_anon_type): Likewise. (binding_table_reverse_maybe_remap): Likewise. (supplement_binding): Likewise. * name-lookup.h (global_scope_name): Declare extern. (global_type_node): Likewise. (cxx_binding_free): Don't export. (cxx_binding_make): Likewise. (binding_table_new): Likewise. (binding_table_free): Likewise. (binding_table_insert): Likewise. (binding_table_find_anon_type): Likewise. (binding_table_reverse_maybe_remap): Likewise. * Make-lang.in (cp/name-lookup.o): Depend on $(DIAGNOSTIC_H) * decl.c (lookup_namespace_name): Move to name-lookup.c (select_decl): Likewise. (unqualified_namespace_lookup): Likewise. (lookup_qualified_name): Likewise. (lookup_name_real): Likewise. (lookup_name_nonclass): Likewise. (lookup_function_nonclass): Likewise. (lookup_name): Likewise. (lookup_name_current_level): Likewise. (lookup_type_current_level): Likewise. (lookup_flags): Likewise. (qualify_lookup): Likewise. (lookup_tag): Likewise. (lookup_tag_reverse): Likewise. (getdecls): Likewise. (storedecls): Remove. (cxx_remember_type_decls): Likewise. (global_bindings_p): Likewise. (innermost_nonclass_level): Likewise. (toplevel_bindings_p): Likewise. (namespace_bindings_p): Likewise. (kept_level_p): Likewise. (innermost_scope_kind): Likewise. (template_parm_scope_p): Likewise. (push_binding): Likewise. (push_local_binding): Likewise. (add_decl_to_level): Likewise. Make extern. (push_class_binding): Move to name-lookup.c. (resume_level): Likewise. Rename to resume_scope. (begin_scope): Likewise. (indent): Likewise. (binding_depth): Likewise. (is_class_level): Likewise. (cxx_scope_descriptor): Likewise. (cxx_scope_debug): Likewise. (namespace_scope_ht_size): Likewise. (leave_scope): Likewise. (pushlevel_class): Likewise. (poplevel_class): Likewise. (clear_identifier_class_values): Likewise. (pushdecl_with_scope): Likewise. (pushdecl_namespace_level): Likewise. (pushdecl_class_level): Likewise. (push_class_level_binding): Likewise. (push_using_directive): Likewise. (identifier_global_value): Likewise. (keep_next_level_flag): Likewise. (keep_next_level): Likewise. (free_binding_level): Likewise. (set_class_shadows): Likewise. (maybe_push_cleanup_level): Likewise. (cp_namespace_decls): Likewise. (bt_print_entry): Likewise. (print_binding_level): Likewise. (print_other_binding_stack): Likewise. (print_binding_stack): Likewise. (push_namespace): Likewise. (pop_namespace): Likewise. (push_nested_namespace): Likewise. (pop_nested_namespace): Likewise. (cxx_saved_binding_make): Likewise. (struct cxx_saved_binding_make): Likewise. (store_bindings): Likewise. (maybe_push_to_top_level): Likewise. (push_to_top_level): Likewise. (pop_from_top_level): Likewise. (identifier_type_value): Likewise. (set_identifier_type_value): Likewise. (set_identifier_type_value_with_scope): Likewise. (pop_everything): Likewise. (pushtag): Likewise. (follow_tag_typedef): Likewise. (maybe_process_template_type_declaration): Likewise. (pop_binding): Likewise. * cp-tree.h: Move corresponding declarations to name-lookup.h From-SVN: r72426
2003-10-13 12:26:36 +02:00
extern bool push_class_level_binding (tree, tree);
extern tree getdecls (void);
extern int function_parm_depth (void);
Break out decl.c (2/n) Break out decl.c (2/n) * name-lookup.c: Include diagnostic.h (cxx_binding_free): Make static. (cxx_binding_make): Likewise. (binding_table_new): Likewise (binding_table_free): Likewise. (binding_table_insert): Likewise. (binding_table_find_anon_type): Likewise. (binding_table_reverse_maybe_remap): Likewise. (supplement_binding): Likewise. * name-lookup.h (global_scope_name): Declare extern. (global_type_node): Likewise. (cxx_binding_free): Don't export. (cxx_binding_make): Likewise. (binding_table_new): Likewise. (binding_table_free): Likewise. (binding_table_insert): Likewise. (binding_table_find_anon_type): Likewise. (binding_table_reverse_maybe_remap): Likewise. * Make-lang.in (cp/name-lookup.o): Depend on $(DIAGNOSTIC_H) * decl.c (lookup_namespace_name): Move to name-lookup.c (select_decl): Likewise. (unqualified_namespace_lookup): Likewise. (lookup_qualified_name): Likewise. (lookup_name_real): Likewise. (lookup_name_nonclass): Likewise. (lookup_function_nonclass): Likewise. (lookup_name): Likewise. (lookup_name_current_level): Likewise. (lookup_type_current_level): Likewise. (lookup_flags): Likewise. (qualify_lookup): Likewise. (lookup_tag): Likewise. (lookup_tag_reverse): Likewise. (getdecls): Likewise. (storedecls): Remove. (cxx_remember_type_decls): Likewise. (global_bindings_p): Likewise. (innermost_nonclass_level): Likewise. (toplevel_bindings_p): Likewise. (namespace_bindings_p): Likewise. (kept_level_p): Likewise. (innermost_scope_kind): Likewise. (template_parm_scope_p): Likewise. (push_binding): Likewise. (push_local_binding): Likewise. (add_decl_to_level): Likewise. Make extern. (push_class_binding): Move to name-lookup.c. (resume_level): Likewise. Rename to resume_scope. (begin_scope): Likewise. (indent): Likewise. (binding_depth): Likewise. (is_class_level): Likewise. (cxx_scope_descriptor): Likewise. (cxx_scope_debug): Likewise. (namespace_scope_ht_size): Likewise. (leave_scope): Likewise. (pushlevel_class): Likewise. (poplevel_class): Likewise. (clear_identifier_class_values): Likewise. (pushdecl_with_scope): Likewise. (pushdecl_namespace_level): Likewise. (pushdecl_class_level): Likewise. (push_class_level_binding): Likewise. (push_using_directive): Likewise. (identifier_global_value): Likewise. (keep_next_level_flag): Likewise. (keep_next_level): Likewise. (free_binding_level): Likewise. (set_class_shadows): Likewise. (maybe_push_cleanup_level): Likewise. (cp_namespace_decls): Likewise. (bt_print_entry): Likewise. (print_binding_level): Likewise. (print_other_binding_stack): Likewise. (print_binding_stack): Likewise. (push_namespace): Likewise. (pop_namespace): Likewise. (push_nested_namespace): Likewise. (pop_nested_namespace): Likewise. (cxx_saved_binding_make): Likewise. (struct cxx_saved_binding_make): Likewise. (store_bindings): Likewise. (maybe_push_to_top_level): Likewise. (push_to_top_level): Likewise. (pop_from_top_level): Likewise. (identifier_type_value): Likewise. (set_identifier_type_value): Likewise. (set_identifier_type_value_with_scope): Likewise. (pop_everything): Likewise. (pushtag): Likewise. (follow_tag_typedef): Likewise. (maybe_process_template_type_declaration): Likewise. (pop_binding): Likewise. * cp-tree.h: Move corresponding declarations to name-lookup.h From-SVN: r72426
2003-10-13 12:26:36 +02:00
extern tree cp_namespace_decls (tree);
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);
extern void do_toplevel_using_decl (tree, tree, tree);
extern void do_local_using_decl (tree, tree, tree);
extern tree do_class_using_decl (tree, tree);
extern void do_using_directive (tree);
extern tree lookup_arg_dependent (tree, tree, VEC(tree,gc) *, bool);
extern bool is_associated_namespace (tree, tree);
extern void parse_using_directive (tree, tree);
cp-tree.h (IDENTIFIER_VALUE): Remove. * cp-tree.h (IDENTIFIER_VALUE): Remove. (BINFO_PUSHDECLS_MARKED): Likewise. (maybe_inject_for_scope_var): Likewise. (push_class_decls): Likewise. * name-lookup.h (push_class_binding): Remove. (innermost_non_namespace_value): New function. (outer_binding): Likewise. * class.c (add_method): Push bindings before adding to TYPE_METHODS. (restore_class_cache): Do not restore class_shadowed. (pushclass): Do not add USING_DECLs. Do not call push_class_decls. * config-lang.in (gtfiles): Remove $(srcdir)/cp/search.c. * decl.c (pushdecl): Use outer_binding. (poplevel): Set the scope for an out-of-scope for-loop declaration appropriately. (cp_finish_decl): Don't call maybe_inject_for_scope_var. * name-lookup.c (new_class_binding): New function. (push_binding): Use it. (pushdecl): Use innermost_non_namespace_value. (maybe_inject_for_scope_var): Remove. (push_class_binding): Remove. (set_inherited_value_binding_p): New function. (get_class_binding): New function. (push_class_level_binding): Assert that the current_class_type is being defined. (outer_binding): New function. (innermost_non_namespace_value): Likewise. (lookup_name_real): Use outer_binding. (lookup_name_current_level): Ignore out-of-scope variables. * pt.c (check_template_shadow): Use innermost_non_namespace_value. (lookup_template_class): Likewise. * search.c (dfs_push_type_decls): Remove. (dfs_push_decls): Likewise. (setup_class_bindings): Likewise. (lookup_field_1): Handle USING_DECLs from dependent scopes. (marked_pushdecls_p): Remove. (unmarked_pushdecls_p): Remove. (marked_identifiers): Remove. (setup_class_bindings): Remove. (dfs_push_type_decls): Remove. (dfs_push_decls): Remove. (push_class_decls): Remove. From-SVN: r84689
2004-07-14 17:34:30 +02:00
extern tree innermost_non_namespace_value (tree);
extern cxx_binding *outer_binding (tree, cxx_binding *, bool);
extern void cp_emit_debug_info_for_using (tree, tree);
/* 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;
}
#endif /* GCC_CP_NAME_LOOKUP_H */