This patch * changes a few uses of top_level_bindings_p to namespace_bindings_p. * moves some pushdecl_* declarations from cp-tree.h to name-lookup.h. * renames pushdecl_top_level_and_finish to pushdecl_top_level_with_init.
nathan -- Nathan Sidwell
2017-05-11 Nathan Sidwell <nat...@acm.org> * cp-tree.h (pushdecl, pushdecl_maybe_friend, pushtag, pushtag_top_level_maybe_friend, pushdecl_top_level_and_finish): Move declarations to ... * name-lookup.h: ... here. Group pushdecl variants. (pushdecl_top_level_and_finish): Rename to ... (pushdecl_top_level_with_init): ... here. * decl.c (cp_make_fname_decl): Use pushdecl_top_level_with_init. * decl2.c (get_guard, handle_tls_init): Likewise. * rtti.c (get_tinfo_decl, tinfo_base_init): Likewise. * lambda.c (maybe_add_lambda_conv_op): Use namespace_bindings_p. * method.c (implicitly_declare_fn): Likewise. * searchc (node_debug_info_needed): Likewise. * name-lookup.c (pushdecl_top_level_and_finish): Rename to ... (pushdecl_top_level_with_init): ... here. (pop_everything): Use namespace_bindings_p. Index: cp-tree.h =================================================================== --- cp-tree.h (revision 247900) +++ cp-tree.h (working copy) @@ -5820,13 +5820,8 @@ extern bool fnptr_conv_p (tree, tree); extern tree strip_fnptr_conv (tree); /* in name-lookup.c */ -extern tree pushdecl (tree); -extern tree pushdecl_maybe_friend (tree, bool); extern void maybe_push_cleanup_level (tree); -extern tree pushtag (tree, tree, tag_scope); extern tree make_anon_name (void); -extern tree pushdecl_top_level_maybe_friend (tree, bool); -extern tree pushdecl_top_level_and_finish (tree, tree); extern tree check_for_out_of_scope_variable (tree); extern void dump (cp_binding_level &ref); extern void dump (cp_binding_level *ptr); Index: decl.c =================================================================== --- decl.c (revision 247901) +++ decl.c (working copy) @@ -4342,7 +4342,7 @@ cp_make_fname_decl (location_t loc, tree else { DECL_THIS_STATIC (decl) = true; - pushdecl_top_level_and_finish (decl, init); + pushdecl_top_level_with_init (decl, init); } return decl; Index: decl2.c =================================================================== --- decl2.c (revision 247900) +++ decl2.c (working copy) @@ -3021,7 +3021,7 @@ get_guard (tree decl) DECL_ARTIFICIAL (guard) = 1; DECL_IGNORED_P (guard) = 1; TREE_USED (guard) = 1; - pushdecl_top_level_and_finish (guard, NULL_TREE); + pushdecl_top_level_with_init (guard, NULL_TREE); } return guard; } @@ -4261,7 +4261,7 @@ handle_tls_init (void) TREE_USED (guard) = true; CP_DECL_THREAD_LOCAL_P (guard) = true; set_decl_tls_model (guard, decl_default_tls_model (guard)); - pushdecl_top_level_and_finish (guard, NULL_TREE); + pushdecl_top_level_with_init (guard, NULL_TREE); tree fn = get_local_tls_init_fn (); start_preparsed_function (fn, NULL_TREE, SF_PRE_PARSED); Index: lambda.c =================================================================== --- lambda.c (revision 247900) +++ lambda.c (working copy) @@ -1098,7 +1098,7 @@ maybe_add_lambda_conv_op (tree type) SET_OVERLOADED_OPERATOR_CODE (fn, TYPE_EXPR); grokclassfn (type, fn, NO_SPECIAL); set_linkage_according_to_type (type, fn); - rest_of_decl_compilation (fn, toplevel_bindings_p (), at_eof); + rest_of_decl_compilation (fn, namespace_bindings_p (), at_eof); DECL_IN_AGGR_P (fn) = 1; DECL_ARTIFICIAL (fn) = 1; DECL_NOT_REALLY_EXTERN (fn) = 1; @@ -1128,7 +1128,7 @@ maybe_add_lambda_conv_op (tree type) DECL_SOURCE_LOCATION (fn) = DECL_SOURCE_LOCATION (callop); grokclassfn (type, fn, NO_SPECIAL); set_linkage_according_to_type (type, fn); - rest_of_decl_compilation (fn, toplevel_bindings_p (), at_eof); + rest_of_decl_compilation (fn, namespace_bindings_p (), at_eof); DECL_IN_AGGR_P (fn) = 1; DECL_ARTIFICIAL (fn) = 1; DECL_NOT_REALLY_EXTERN (fn) = 1; Index: method.c =================================================================== --- method.c (revision 247900) +++ method.c (working copy) @@ -2096,7 +2096,7 @@ implicitly_declare_fn (special_function_ set_linkage_according_to_type (type, fn); if (TREE_PUBLIC (fn)) DECL_COMDAT (fn) = 1; - rest_of_decl_compilation (fn, toplevel_bindings_p (), at_eof); + rest_of_decl_compilation (fn, namespace_bindings_p (), at_eof); gcc_assert (!TREE_USED (fn)); /* Propagate constraints from the inherited constructor. */ Index: name-lookup.c =================================================================== --- name-lookup.c (revision 247901) +++ name-lookup.c (working copy) @@ -4588,7 +4588,7 @@ pushdecl_top_level_maybe_friend (tree x, initializing it with INIT. */ tree -pushdecl_top_level_and_finish (tree x, tree init) +pushdecl_top_level_with_init (tree x, tree init) { return pushdecl_top_level_1 (x, &init, false); } @@ -6618,7 +6618,7 @@ pop_everything (void) { if (ENABLE_SCOPE_CHECKING) verbatim ("XXX entering pop_everything ()\n"); - while (!toplevel_bindings_p ()) + while (!namespace_bindings_p ()) { if (current_binding_level->kind == sk_class) pop_nested_class (); Index: name-lookup.h =================================================================== --- name-lookup.h (revision 247901) +++ name-lookup.h (working copy) @@ -282,29 +282,22 @@ struct GTY(()) cp_binding_level { extern cp_binding_level *leave_scope (void); extern bool kept_level_p (void); extern bool global_bindings_p (void); -extern bool toplevel_bindings_p (void); +extern bool toplevel_bindings_p (void); extern bool namespace_bindings_p (void); extern bool local_bindings_p (void); extern bool template_parm_scope_p (void); extern scope_kind innermost_scope_kind (void); extern cp_binding_level *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 bool is_ancestor (tree ancestor, tree descendant); 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 (cp_binding_level *); -extern tree pushdecl_outermost_localscope (tree); -extern bool 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); extern void pushlevel_class (void); extern void poplevel_class (void); @@ -342,6 +335,18 @@ extern tree innermost_non_namespace_valu extern cxx_binding *outer_binding (tree, cxx_binding *, bool); extern void cp_emit_debug_info_for_using (tree, tree); -extern tree pushdecl_top_level (tree); +extern tree pushdecl_maybe_friend (tree, bool is_friend); +extern tree pushdecl (tree); +extern tree pushdecl_outermost_localscope (tree); +extern tree pushdecl_top_level_maybe_friend (tree, bool is_friend); +extern tree pushdecl_top_level (tree); +extern tree pushdecl_top_level_with_init (tree, tree); +extern tree pushtag (tree, tree, tag_scope); +extern bool push_namespace (tree); +extern void pop_namespace (void); +extern void push_nested_namespace (tree); +extern void pop_nested_namespace (tree); +extern void push_to_top_level (void); +extern void pop_from_top_level (void); #endif /* GCC_CP_NAME_LOOKUP_H */ Index: rtti.c =================================================================== --- rtti.c (revision 247900) +++ rtti.c (working copy) @@ -445,7 +445,7 @@ get_tinfo_decl (tree type) DECL_NOT_REALLY_EXTERN (d) = 1; set_linkage_according_to_type (type, d); - d = pushdecl_top_level_and_finish (d, NULL_TREE); + d = pushdecl_top_level_with_init (d, NULL_TREE); if (CLASS_TYPE_P (type)) CLASSTYPE_TYPEINFO_VAR (TYPE_MAIN_VARIANT (type)) = d; @@ -911,7 +911,7 @@ tinfo_base_init (tinfo_s *ti, tree targe name_string = tinfo_name (target, !TREE_PUBLIC (name_decl)); DECL_INITIAL (name_decl) = name_string; mark_used (name_decl); - pushdecl_top_level_and_finish (name_decl, name_string); + pushdecl_top_level_with_init (name_decl, name_string); } vtable_ptr = ti->vtable; Index: search.c =================================================================== --- search.c (revision 247900) +++ search.c (working copy) @@ -2365,7 +2365,7 @@ note_debug_info_needed (tree type) if (TYPE_DECL_SUPPRESS_DEBUG (TYPE_NAME (type))) { TYPE_DECL_SUPPRESS_DEBUG (TYPE_NAME (type)) = 0; - rest_of_type_compilation (type, toplevel_bindings_p ()); + rest_of_type_compilation (type, namespace_bindings_p ()); } dfs_walk_all (TYPE_BINFO (type), dfs_debug_mark, NULL, 0);