2017-05-11 Nathan Sidwell <nathan@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.
+
* name-lookup.h (pop_binding): Rename to pop_local_binding.
(getdecls): Rename to get_local_decls.
* name-lookup.c (pop_binding): Rename to ...
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);
else
{
DECL_THIS_STATIC (decl) = true;
- pushdecl_top_level_and_finish (decl, init);
+ pushdecl_top_level_with_init (decl, init);
}
return 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;
}
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);
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;
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;
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. */
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);
}
{
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 ();
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 *);
\f
-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);
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 */
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;
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;
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);