aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/name-lookup.h
AgeCommit message (Collapse)AuthorFilesLines
2010-02-12re PR c++/43024 (ICE on template code with -O2 or -O3, regression from 4.4.2)Jason Merrill1-1/+1
PR c++/43024 * name-lookup.h (current_binding_level): Check for null cp_function_chain. From-SVN: r156741
2009-08-10Implement DR 757...Jason Merrill1-0/+1
Implement DR 757: It's OK for a decl to use a type without linkage so long as the decl is defined in the current translation unit. * decl2.c (no_linkage_decls): New vector. (mark_used): Add decls that use types with no linkage. (cp_write_global_declarations): Check that they are defined. (decl_defined_p, no_linkage_error): New fns. * cp-tree.h (DECL_NO_LINKAGE_CHECKED): New macro. (struct lang_decl_base): Add flag. * decl.c (grokfndecl): Don't check type linkage. (grokvardecl): If the type has no linkage, just make sure DECL_LANG_SPECIFIC is set. * pt.c (check_instantiated_arg): Don't check type linkage. * name-lookup.c (is_local_extern): New fn. * name-lookup.h: Declare it. From-SVN: r150634
2009-05-21tree.c (build_tree_list_vec_stat): New function.Ian Lance Taylor1-3/+4
./: * 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-04-22hashtab.h: Update GTY annotations to new syntaxTaras Glek1-10/+5
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-02-20Update Copyright years for files modified in 2008 and/or 2009.Jakub Jelinek1-1/+1
From-SVN: r144324
2008-08-26c-common.c (do_switch_warnings): Look through the CONST_DECLs in the ↵Douglas Gregor1-0/+2
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-01-22re PR c++/34912 (ICE with friend in local class)Jason Merrill1-0/+1
PR c++/34912 * friend.c (do_friend): Check for prior declaration of a friend function of a local class. * name-lookup.c (lookup_name_innermost_nonclass_level): No longer static. * name-lookup.h: Declare it. From-SVN: r131740
2007-10-04re PR c++/32470 (fvisibility=hidden without effect in some cases)Jason Merrill1-6/+2
PR c++/32470 * name-lookup.c (push_namespace_with_attrs): Fold back into... (push_namespace): Here. (handle_namespace_attrs): New fn for the attr code. (leave_scope): Don't pop_visibility. * name-lookup.h (struct cp_binding_level): Remove has_visibility. * parser.c (cp_parser_namespace_definition): Call handle_namespace_attrs and pop_visibility as appropriate. From-SVN: r129003
2007-08-24name-lookup.c (add_decl_to_level): Remove addition to vtables chain.Ollie Wild1-3/+0
gcc/cp/ * name-lookup.c (add_decl_to_level): Remove addition to vtables chain. * name-lookup.h (cp_binding_level): Remove vtables member. From-SVN: r127765
2007-08-02typeck.c: Change copyright header to refer to version 3 of the GNU General ↵Nick Clifton1-5/+4
Public... * typeck.c: Change copyright header to refer to version 3 of the GNU General Public License and to point readers at the COPYING3 file and the FSF's license web page. * optimize.c, lang-specs.h, init.c, class.c, repo.c, decl.c, config-lang.in, cp-tree.def, call.c, decl.h, ptree.c, Make-lang.in, method.c, rtti.c, cp-objcp-common.c, g++spec.c, cp-objcp-common.h, except.c, error.c, operators.def, cvt.c, tree.c, mangle.c, cp-tree.h, dump.c, search.c, friend.c, expr.c, cp-gimplify.c, cxx-pretty-print.c, cp-lang.c, typeck2.c, pt.c, cxx-pretty-print.h, semantics.c, name-lookup.c, lex.c, decl2.c, name-lookup.h, parser.c: Likewise. From-SVN: r127154
2006-06-06Fix up whitespacingMike Stump1-1/+1
From-SVN: r114428
2006-03-20re PR c++/21764 (visibility attributes on namespace scope)Jason Merrill1-1/+6
PR c++/21764 * c-pragma.c (visstack): Move out of handle_pragma_visibility. (push_visibility, pop_visibility): Likewise. * c-pragma.h: Declare them. * cp/name-lookup.h (struct cp_binding_level): Add has_visibility bitfield. * cp/name-lookup.c: Include c-pragma.h. (push_namespace_with_attribs): Split out from push_namespace. Push visibility if appropriate. Set TREE_PUBLIC on namespaces. (leave_scope): Pop visibility if appropriate. * cp/parser.c (cp_parser_declaration, cp_parser_namespace_name): Allow attributes on namespace declarations. PR c++/19238 * cp/decl.c (cp_finish_decl): Call determine_visibility later. (start_preparsed_function): Likewise. * cp/cp-tree.h (CP_TYPE_CONTEXT, TYPE_NAMESPACE_SCOPE_P): New macros. (TYPE_CLASS_SCOPE_P, TYPE_FUNCTION_SCOPE_P): New macros. * cp/decl2.c (determine_visibility_from_class): Split out from... (determine_visibility): ...here. Handle function scope and nested classes. (import_export_decl): Move visibility handling to determine_visibility_from_class. From-SVN: r112239
2006-03-09Merge C++ from gomp-20050608-branch.Richard Henderson1-2/+3
From-SVN: r111867
2006-01-17name-lookup.c (lookup_namespace_name): Remove.Kazu Hirata1-1/+0
* name-lookup.c (lookup_namespace_name): Remove. * name-lookup.h: Remove the prototype for lookup_namespace_name. From-SVN: r109821
2005-11-21c-common.c, [...]: Revert 2005-11-18 lookup_name patch.Richard Henderson1-2/+1
gcc/ * c-common.c, config/darwin-c.c, c-decl.c, c-tree.h, c-objc-common.h, langhooks-def.h, langhooks.h: Revert 2005-11-18 lookup_name patch. * c-tree.h (lookup_name): Move declaration ... * c-common.h (lookup_name): ... here. * config/darwin-c.c: Include c-common.h. * config/t-darwin: Update dependencies. gcc/cp/ * cp-objcp-common.h, name-lookup.c, name-lookup.h: Revert 11-18 patch. * name-lookup.c (lookup_name): Remove prefer_type argument. (lookup_name_prefer_type): New. * decl.c (lookup_and_check_tag): Use them. * pt.c (tsubst_friend_class): Likewise. (lookup_template_class): Likewise. (tsubst_copy_and_build): Likewise. * name-lookup.h (lookup_name_prefer_type): New. (lookup_name): Remove declaration. From-SVN: r107325
2005-11-18c-common.c (handle_cleanup_attribute): Use a lang hook for lookup_name.Mike Stump1-1/+1
* c-common.c (handle_cleanup_attribute): Use a lang hook for lookup_name. * config/darwin-c.c (darwin_pragma_unused): Likewise. * c-decl.c (lookup_name_two) Remove. * c-tree.h (lookup_name_two): Remove. * c-objc-common.h (LANG_HOOKS_LOOKUP_NAME): Add. * langhooks-def.h (LANG_HOOKS_LOOKUP_NAME): Add. (LANG_HOOKS_DECLS): Add initializer for LANG_HOOKS_LOOKUP_NAME. * langhooks.h (lang_hooks_for_decls): Add lookup_name. cp: * cp-objcp-common.h (LANG_HOOKS_LOOKUP_NAME): Add. * name-lookup.c (lookup_name_two): Remove. (lookup_name_one): Add. * name-lookup.h (lookup_name_two): Remove. (lookup_name_one): Add. From-SVN: r107196
2005-11-16c-decl.c (lookup_name_two): Add.Mike Stump1-0/+1
* c-decl.c (lookup_name_two): Add. * c-tree.h (lookup_name_two): Likewise. * c-common.c (handle_cleanup_attribute): Use lookup_name_two instead. * config/darwin-c.c (darwin_pragma_unused): Likewise. cp: * name-lookup.c (lookup_name_two): Add. * name-lookup.h: Likewise. testsuite: * g++.old-deja/g++.mike/unused.C: Add. From-SVN: r107062
2005-09-12re PR c++/7874 (g++ finds friend functions defined in class-definition but ↵Ian Lance Taylor1-2/+3
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-06-25Update FSF address.Kelley Cook1-2/+2
From-SVN: r101312
2005-06-15Canonicalize whitespace.Mike Stump1-12/+12
From-SVN: r100965
2005-06-14Remove extra white spacing at end of lines.Mike Stump1-1/+1
From-SVN: r100952
2005-06-08re PR c++/19497 (Invalid declaration in template diagnosed too late)Nathan Sidwell1-0/+1
cp: PR c++/19497 * cp-tree.def (USING_DECL): Update documentation. * cp-tree.h (DECL_DEPENDENT_P): New. (USING_DECL_DECLS, USING_DECL_SCOPE): New. * class.c (handle_using_decl): Move most of the processing to ... * name-lookup.c (do_class_using_decl): ... here. Make stricter. (push_using_decl): Use USING_DECL_SCOPE. (cp_emit_debug_info_for_using): Make extern. * cxx-pretty-print.c (pp_cxx_statement) <USING_DECL case>: Adjust. * name-lookup.h (cp_emit_debug_info_for_using): Declare. * pt.c (tsubst_decl) <USING_DECL case>: Use do_class_using_decl when tsubsting. (tsubst_expr): Use USING_DECL_SCOPE. * search.c (lookup_field_1): Use DECL_DEPENDENT_P. * semantics.c (finish_member_declaration): Likewise. testsuite: PR c++/19497 * g++.dg/inherit/using5.C: New. * g++.dg/inherit/using6.C: New. From-SVN: r100757
2005-05-07decl.c (wrapup_globals_for_namespace): Use VEC instead of VARRAY.Kazu Hirata1-1/+1
* decl.c (wrapup_globals_for_namespace): Use VEC instead of VARRAY. * name-lookup.c (add_decl_to_level, begin_scope): Likewise. * name-lookup.h (cp_binding_level): Change the type of static_decls to VEC(tree,gc)*. From-SVN: r99346
2005-04-21vec.h: Update API to separate allocation mechanism from type.Nathan Sidwell1-3/+5
* 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-03-14Friend class name lookup 5/n PR c++/1016Kriang Lerdsuwanakij1-0/+1
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-01-25name-lookup.c (print_binding_level): Make static.Volker Reichelt1-3/+0
* name-lookup.c (print_binding_level): Make static. (constructor_name_full): Make static inline. (current_decl_namespace): Make static. * name-lookup.h (constructor_name_full): Remove prototype. (print_binding_level): Likewise. (storetags): Likewise. (current_decl_namespace): Likewise. From-SVN: r94209
2005-01-19* cp-tree.h, name-lookup.h: Remove unused prototypes.Kazu Hirata1-1/+0
From-SVN: r93920
2005-01-05re PR c++/19030 (ice on tree check)Nathan Sidwell1-2/+2
cp: PR c++/19030 * cp-tree.h (start_decl): Take pointer to pushed scope, not bool. * name-lookup.h (push_scope): Return pushed scope, not flag. * name-lookup.c (push_scope): Return scope that should be popped, not a flag. * decl.c (start_decl): Adjust. (grokfndecl): Adjust scope push and pop. * decl2.c (check_classfn): Likewise. * parser.c (cp_parser_condition, cp_parser_conversion_function_id, cp_parser_init_declarator, cp_parser_direct_declarator, cp_parser_class_specifier, cp_parser_class_head, cp_parser_lookup_name, cp_parser_constructor_declarator_p): Likewise. * pt.c (instantiate_class_template, resolve_typename_type): Likewise. testsuite: PR c++/19030 * g++.dg/parse/crash22.C: New From-SVN: r92946
2004-12-30cp-tree.h (cp_declarator): Split "name" field into qualifying_scope and ↵Mark Mitchell1-1/+1
unqualified_name. * cp-tree.h (cp_declarator): Split "name" field into qualifying_scope and unqualified_name. * decl.c (get_scope_of_declarator): Adjust accordingly. (grokdeclarator): Likewise. * decl2.c (grokfield): Likewise, and adjust call to do_class_using_decl. * name-lookup.c (do_class_using_decl): Split "decl" into "scope" and "name". Remove unnecessary code. * name-lookup.h (do_class_using_decl): Adjust declaration. * parser.c (make_id_declarator): Split "id" into qualifying_scope and unqualified_name. (cp_parser_using_declaration): Adjust call to do_class_using_decl. (cp_parser_direct_declarator): Adjust to handle the fact that cp_parser_declarator_id no longer returns a SCOPE_REF. (cp_parser_direct_declarator): Likewise. (cp_parser_declarator_id): Do not create a SCOPE_REF for qualified names. (cp_parser_member_declaration): Adjust call to make_id_declarator. (cp_parser_check_declarator_template_parameters): Do not expect a SCOPE_REF. * decl.c (duplicate_decls): Call ggc_free on declarations we will not be needing any longer. From-SVN: r92746
2004-11-26Friend class name lookup 4/nKriang Lerdsuwanakij1-7/+0
Friend class name lookup 4/n * class.c (pushclass): Don't call cxx_remember_type_decls. * cp-tree.h (clear_anon_tags): Remove declaration. * decl.c (grokdeclarator): Don't call lookup_tag_reverse. * name-lookup.c (binding_entry_free, binding_table_free): Comment out functions. (binding_table_find_anon_type, binding_table_reverse_maybe_remap, binding_table_remove_anonymous_types, cxx_remember_type_decls, bt_print_entry, clear_anon_tags, follow_tag_typedef, lookup_tag, lookup_tag_reverse): Remove (begin_scope, leave_scope, kept_level_p, print_binding_level): Don't use type_decls field in cp_binding_level. (maybe_process_template_type_declaration, pushtag): Set CLASSTYPE_NESTED_UTDS directly. * name-lookup.h (binding_table_remove_anonymous_types, cxx_remember_type_decls, lookup_tag, lookup_tag_reverse): Remove declaration. (cp_binding_level): Remove type_decls field. From-SVN: r91342
2004-11-25Friend class name lookup 3/n, PR c++/3332Kriang Lerdsuwanakij1-0/+2
Friend class name lookup 3/n, PR c++/3332 * name-lookup.c (push_inner_scope, pop_inner_scope): New functions. (lookup_type_scope): Don't deal with name from user declaration specially. * name-lookup.h (push_inner_scope, pop_inner_scope): Add declarations. * parser.c (cp_parser_class_specifier): Use push_inner_scope and pop_inner_scope. * g++.dg/lookup/friend3.C: New test. * g++.dg/lookup/friend4.C: Likewise. * g++.dg/lookup/friend5.C: Likewise. From-SVN: r91300
2004-11-25Friend class name lookup 2/n, PR c++/14513, c++/15410Kriang Lerdsuwanakij1-1/+17
Friend class name lookup 2/n, PR c++/14513, c++/15410 * name-lookup.c (lookup_name_real): Simplify. (lookup_type_scope): Add SCOPE parameter. Handle friend class lookup. * name-lookup.h (tag_scope): New enum type. (lookup_type_scope): Adjust declaration. * decl.c (lookup_and_check_tag, xref_tag, xref_tag_from_type): Change bool parameter GLOBALIZED to TAG_SCOPE parameter SCOPE. (start_enum): Likewise. Add assertion test that NAME is IDENTIFIER_NODE. Use anonymous name for dummy ENUMERAL_TYPE in case of error. * cp-tree.h (xref_tag, xref_tag_from_type): Adjust declarations. * parser.c (cp_parser_elaborated_type_specifier, cp_parser_class_head): Adjust call to xref_tag. * pt.c (lookup_template_class, instantiate_class_template): Likewise. * rtti.c (init_rtti_processing, build_dynamic_cast_1, tinfo_base_init, emit_support_tinfos): Likewise. * g++.dg/lookup/friend2.C: New test. * g++.dg/template/friend31.C: Likewise. From-SVN: r91299
2004-11-15Friend class name lookup 1/n, PR c++/18471Kriang Lerdsuwanakij1-0/+1
Friend class name lookup 1/n, PR c++/18471 * decl.c (lookup_and_check_tag): New function. (xref_tag, start_enum): Use it. (check_elaborated_type_specifier): Move TEMPLATE_TYPE_PARM check before !DECL_IMPLICIT_TYPEDEF_P. Also display previously declared location. * name-lookup.c (lookup_name_current_level): Rename to ... (lookup_name_innermost_nonclass_level): ... this. (lookup_type_scope): New function. * name-lookup.h (lookup_name_current_level): Rename to ... (lookup_name_innermost_nonclass_level): ... this. (lookup_type_scope): Add declaration. * g++.dg/lookup/struct1.C: Adjust expected error. * g++.dg/parse/elab1.C: Likewise. * g++.dg/parse/elab2.C: Likewise. * g++.dg/parse/int-as-enum1.C: Likewise. * g++.dg/parse/struct-as-enum1.C: Likewise. * g++.dg/parse/typedef1.C: Likewise. * g++.dg/parse/typedef3.C: Likewise. * g++.dg/parse/typedef4.C: Likewise. * g++.dg/parse/typedef5.C: Likewise. * g++.dg/template/nontype4.C: Likewise. * g++.old-deja/g++.benjamin/typedef01.C: Likewise. * g++.old-deja/g++.other/elab1.C: Likewise. * g++.old-deja/g++.other/syntax4.C: Likewise. From-SVN: r90657
2004-09-10class.c, [...]: Fix comment typos.Kazu Hirata1-1/+1
* class.c, cp-tree.h, decl.c, decl2.c, mangle.c, name-lookup.h, parser.c, search.c, semantics.c, typeck2.c: Fix comment typos. From-SVN: r87292
2004-09-08vec.c (vec_p_reserve, [...]): Rename to ...Nathan Sidwell1-2/+2
* vec.c (vec_p_reserve, vec_o_reserve): Rename to ... (vec_gc_p_reserve, vec_gc_o_reserve): ... here. Clone to (vec_heap_p_reserve, vec_heap_o_reserve): ... here, adjust. (vec_gc_free, vec_heap_free): New. * vec.h (DEF_VEC_GC_P, DEF_VEC_MALLOC_P): New. (DEF_VEC_P): Add allocator argument. Adjust. (DEF_VEC_GC_O, DEF_VEC_MALLOC_O): New. (DEF_VEC_O): Add allocator argument. Adjust. (VEC(free)): New. * tree.h (tree): Define a GC'd vector. * lamba-code.c (lambda_loop): Likewise. * value-prof.h (histogram_value): Likewise. * cp/cp-tree.h (tree_pair_s): Likewise. * cp/name-lookup.h (cxx_saved_binding, cp_class_binding): Likewise. * cp/semantics.c (deferred_access): Likewise. From-SVN: r87179
2004-07-14cp-tree.h (IDENTIFIER_VALUE): Remove.Mark Mitchell1-2/+2
* 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-13cp-tree.h (lang_identifier): Remove class_value.Mark Mitchell1-2/+0
* cp-tree.h (lang_identifier): Remove class_value. (IDENTIFIER_CLASS_VALUE): Remove. (pop_class_decls): Likewise. (init_search_processing): Likewise. * class.c (handle_using_decl): Use lookup_member, not IDENTIFIER_CLASS_VALUE. (restore_class_cache): New function, split out from ... (pushclass): ... here. Do not call clear_identifier_class_values. (invalidate_class_lookup_cache): Do not clear IDENTIFIER_CLASS_VALUE. (popclass): Do not call pop_class_decls. (maybe_note_name_used_in_class): Do not save names looked up after the class is complete. Use lookup_member, not IDENTIFIER_CLASS_VALUE. * config-lang.in (gtfiles): Add $(srcdir)/cp/search.c. * decl.c (cxx_init_decl_processing): Do not call init_search_processing. * method.c (do_build_copy_constructor): Remove unnecessary code. (do_build_assign_ref): Likewise. * name-lookup.c (pushdecl): Use lookup_member, not IDENTIFIER_CLASS_VALUE. (set_identifier_type_value_with_scope): Set TREE_TYPE on the type_shadowed list. (poplevel_class): Do not restore IDENTIFIER_CLASS_VALUE. (push_class_binding): Do not set it. (clear_identifier_class_values): Remove. (push_class_level_binding): Do not set IDENTIFIER_CLASS_VALUE. (store_binding): Do not save it. (pop_from_top_level): Do not restore it. * name-lookup.h (cxx_saved_binding): Remove class_value. (clear_identifier_class_values): Remove. * ptree.c (cxx_print_identifier): Do not print IDENTIFIER_CLASS_VALUE. * search.c (search_obstack): Remove. (push_stack_level): Remove. (pop_stack_level): Remove. (search_level): Remove. (search_stack): Remove. (lookup_member): Don't check IDENTIFIER_CLASS_VALUE. (setup_class_bindings): Use IDENTIFIER_MARKED, not IDENTIFIER_CLASS_VALUE. (marked_identifiers): New variable. (push_class_decls): Clear IDENTIFIER_MARKED. (pop_class_decls): Don't call pop_search_level. (init_search_processing): Remove. From-SVN: r84629
2004-07-12call.c (build_operator_new_call): Avoid using push_to_top_level.Mark Mitchell1-2/+2
* call.c (build_operator_new_call): Avoid using push_to_top_level. (build_new_op): Adjust call to lookup_function_nonclass. * name-lookup.c (identifier_type_value): Adjust call to lookup_name_real. (lookup_name_real): Add block_p parameter. (lookup_name_nonclass): Adjust call to lookup_name_real. (lookup_function_nonclass): Likewise. (lookup_name): Likewise. * name-lookup.h (lookup_name_real): Change prototype. (lookup_name_nonclass): Likewise. * parser.c (cp_parser_lookup_name): Likewise. From-SVN: r84543
2004-07-11cp-tree.h (saved_scope): Make old_bindings a vector.Mark Mitchell1-4/+14
* cp-tree.h (saved_scope): Make old_bindings a vector. (unuse_fields): Remove. * name-lookup.h (cxx_saved_binding): Define it. * class.c (pushclass): Don't use unuse_fields. * name-lookup.c (cxx_saved_binding_make): Remove. (store_binding): Add new bindings to a vector, using an accumulator style, rather than adding them to a list. (store_bindings): Adjust accordingly. (store_class_bindings): Likewise. (push_to_top_level): Likewise. (pop_from_top_level): Likewise. * optimize.c (maybe_clone_body): Must push_to_top_level and pop_from_top_level calls outside of loop. * parser.c (cp_parser_class_specifier): Move push_scope/pop_scope calls here from cp_parser_late_parsing_default_args. (cp_parser_save_default_args): Record the class type in which the function is declared. (cp_parser_late_parsing_default_args): Do not call push_nested_class/pop_nested_class. * search.c (dfs_unuse_fields): Remove. (unuse_fields): Remove. * g++.dg/parse/defarg8.C: New test. From-SVN: r84530
2004-07-08name-lookup.h (struct cp_binding_level): Update documentation for ↵Mark Mitchell1-6/+6
class_shadowed. * name-lookup.h (struct cp_binding_level): Update documentation for class_shadowed. From-SVN: r84291
2004-07-08cp-tree.h (saved_scope): Remove x_previous_class_type and ↵Mark Mitchell1-2/+11
x_previous_class_values... * cp-tree.h (saved_scope): Remove x_previous_class_type and x_previous_class_values; add x_previous_class_level. (previous_class_type): Remove. (previous_class_values): Remove. (previous_class_level): New macro. * class.c (pushclass): Restore the identifier cache more expeditiously. (invalidate_class_lookup_cache): Use vector for class_shadowed and previous_class_values. * decl.c (poplevel): Likewise. * name-lookup.c (cxx_binding_init): New function. (cxx_binding_make): Use it. (push_binding): For a binding in a class level, use a vector of cp_class_binding nodes. (push_binding_level): New function. (begin_scope): Use it. (leave_scope): Do not put class binding levels on the free list. (print_binding_level): Adjust for the fact that class_shadowed is a vector. (poplevel_class): Likewise. (clear_identifier_class_values): Likewise. (push_class_level_binding): Likewise. (set_class_shadows): Remove. (store_binding): New function. (store_class_bindings): New function. (push_to_top_level): Use store_class_bindings as appropriate. (pop_from_top_level): Use previous_class_level, not previous_class_type. * name-lookup.h (cp_class_binding): New type. (cp_binding_level): Use a vector object for class_shadowed. (push_binding_level): Declare. (set_class_shadows): Remove. From-SVN: r84259
2004-06-15c-common.c (lang_gimplify_stmt): Remove next_p argument.Richard Henderson1-0/+4
* 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-05-13Merge tree-ssa-20020619-branch into mainline.Diego Novillo1-1/+0
From-SVN: r81764
2004-03-09re PR c++/14401 (Uninitialized reference error not reported.)Mark Mitchell1-0/+1
PR c++/14401 * class.c (check_field_decls): Complain about non-static data members of reference type in unions. Propagate CLASSTYPE_REF_FIELDS_NEED_INIT and CLASSTYPE_READONLY_FIELDS_NEED_INIT from the types of non-static data members. * init.c (perform_member_init): Complain about mbmers with const type that are not explicitly initialized. PR c++/14401 * g++.dg/init/ctor3.C: New test. * g++.dg/init/union1.C: New test. * g++.dg/ext/anon-struct4.C: New test. From-SVN: r79158
2004-03-01re PR c++/14138 (100x -O0 C++ Compile Time Regression {3.2,3.3} -> {3.4,4.0})Mark Mitchell1-1/+1
PR c++/14138 * name-lookup.h (push_scope): Change prototype. * name-lookup.c (push_scope): Do not reenter the current class scope. * decl.c (grokfndecl): Check return code from push_scope before calling pop_scope. * decl2.c (check_classfn): Likewise. * parser.c (cp_parser_conversion_function_id): Likewise. (cp_parser_init_declarator): Likewise. (cp_parser_direct_declarator): Likewise. (cp_parser_class_specifier): Likewise. (cp_parser_class_head): Likewise. (cp_parser_lookup_name): Likewise. (cp_parser_constructor_declarator_p): Likewise. * pt.c (instantiate_class_template): Likewise. (resolve_typename_type): Likewise. From-SVN: r78696
2004-01-27system.h (CHAR_BITFIELD): Delete.Kaveh R. Ghazi1-1/+1
* system.h (CHAR_BITFIELD): Delete. (BOOL_BITFIELD): New. * c-decl.c (c_scope): Use BOOL_BITFIELD. * gengtype-lex.l: Recognize BOOL_BITFIELD instead of CHAR_BITFIELD. cp: * cp-tree.h (language_function, lang_type_header): Use BOOL_BITFIELD. * name-lookup.h (cp_binding_level): Likewise. From-SVN: r76686
2004-01-26class.c (add_method): Just check processing_template_decl to determine ↵Mark Mitchell1-1/+0
whether or not we are within a... * class.c (add_method): Just check processing_template_decl to determine whether or not we are within a template. * decl2.c (maybe_retrofit_in_chrg): Likewise. * init.c (decl_constant_value): Check the type of the declaration, not TREE_READONLY. * name-lookup.c (maybe_push_to_top_level): Rename to ... (push_to_top_level): ... this. * name-lookup.h (maybe_push_to_top_level): Do not declare it. * pt.c (push_template_decl_real): Reorder condition for speed. (convert_template_argument): Use dependency-checking functions in place of uses_template_parms. (lookup_template_class): Avoid calling uses_template_parms more than once. (uses_template_parms): Reimplement, using dependency-checking functions. (instantiate_class_template): Use push_to_top_level, not maybe_push_to_top_level. (type_unification_real): Simplify. (type_dependent_expression_p): Handle OFFSET_REFs and TEMPLATE_DECLs. (any_dependent_template_arguments_p): Handle multiple levels of template argument. * semantics.c (expand_or_defer_fn): Do not check uses_template_parms for template instantiations. * typeck.c (comptypes): Avoid calling cp_type_quals. From-SVN: r76647
2004-01-15add copyright 2004Alexandre Oliva1-1/+1
From-SVN: r75925
2004-01-15re PR c++/13659 (error: no matching function for call to)Alexandre Oliva1-2/+2
PR c++/13659 * name-lookup.c (validate_nonmember_using_decl): Take scope and name by value, instead of computing them. (do_local_using_decl, do_toplevel_using_decl): Add scope and name arguments. Pass them to validate_nonmember_using_decl. * name-lookup.h (do_local_using_decl): Adjust. (do_toplevel_using_decl): Likewise. * parser.c (cp_parser_using_declaration): Likewise. * pt.c (tsubst_expr): Likewise. From-SVN: r75923
2003-12-02name-lookup.h (struct cp_binding_level): Use ENUM_BITFIELD.Richard Henderson1-1/+1
* name-lookup.h (struct cp_binding_level): Use ENUM_BITFIELD. * parser.c (struct cp_token): Likewise. (struct cp_parser_token_tree_map_node): Likewise. * lex.c (struct resword): Move const after ENUM_BITFIELD. From-SVN: r74169