From: Nathan Sidwell Date: Thu, 11 May 2017 11:57:01 +0000 (+0000) Subject: cp-tree.h (pushdecl, [...]): Move declarations to ... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=056a17ee6ca8f0fcd318d0dfba18f277e05a3579;p=gcc.git cp-tree.h (pushdecl, [...]): Move declarations to ... * 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. (--This line, and those below, will be ignored-- M cp/ChangeLog M cp/method.c M cp/cp-tree.h M cp/decl.c M cp/lambda.c M cp/rtti.c M cp/name-lookup.c M cp/decl2.c M cp/name-lookup.h M cp/search.c From-SVN: r247902 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 78695f7cea1..c4afd41e981 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,21 @@ 2017-05-11 Nathan Sidwell + * 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. + * name-lookup.h (pop_binding): Rename to pop_local_binding. (getdecls): Rename to get_local_decls. * name-lookup.c (pop_binding): Rename to ... diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 09b136467ff..9596886226f 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -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); diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 9e913f399d6..9291b9618bc 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -4342,7 +4342,7 @@ cp_make_fname_decl (location_t loc, tree id, int type_dep) else { DECL_THIS_STATIC (decl) = true; - pushdecl_top_level_and_finish (decl, init); + pushdecl_top_level_with_init (decl, init); } return decl; diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 46959ec77f7..758c6985fe9 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -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); diff --git a/gcc/cp/lambda.c b/gcc/cp/lambda.c index 66b5312567e..80643ea2bbc 100644 --- a/gcc/cp/lambda.c +++ b/gcc/cp/lambda.c @@ -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; diff --git a/gcc/cp/method.c b/gcc/cp/method.c index 99e98cce807..6a2f18ce0fd 100644 --- a/gcc/cp/method.c +++ b/gcc/cp/method.c @@ -2096,7 +2096,7 @@ implicitly_declare_fn (special_function_kind kind, tree type, 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. */ diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c index 041a5f6e7ed..0392651fd68 100644 --- a/gcc/cp/name-lookup.c +++ b/gcc/cp/name-lookup.c @@ -4588,7 +4588,7 @@ pushdecl_top_level_maybe_friend (tree x, bool is_friend) 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 (); diff --git a/gcc/cp/name-lookup.h b/gcc/cp/name-lookup.h index 97501966e77..f24461c8506 100644 --- a/gcc/cp/name-lookup.h +++ b/gcc/cp/name-lookup.h @@ -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_value (tree); 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 */ diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c index 89d18914adf..c5a110ced9f 100644 --- a/gcc/cp/rtti.c +++ b/gcc/cp/rtti.c @@ -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 target) 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; diff --git a/gcc/cp/search.c b/gcc/cp/search.c index 09c1b4e6456..fa72c47d4f7 100644 --- a/gcc/cp/search.c +++ b/gcc/cp/search.c @@ -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);