/* 2. Types we need to define or look up. */
tree fr_name = get_fn_local_identifier (orig, "frame");
- tree coro_frame_type = xref_tag (record_type, fr_name, ts_current, false);
+ tree coro_frame_type = xref_tag (record_type, fr_name);
DECL_CONTEXT (TYPE_NAME (coro_frame_type)) = current_scope ();
tree coro_frame_ptr = build_pointer_type (coro_frame_type);
tree act_des_fn_type
extern void determine_local_discriminator (tree);
extern int decls_match (tree, tree, bool = true);
extern bool maybe_version_functions (tree, tree, bool);
-extern tree duplicate_decls (tree, tree, bool);
+extern tree duplicate_decls (tree, tree,
+ bool is_friend = false);
extern tree declare_local_label (tree);
extern tree define_label (location_t, tree);
extern void check_goto (tree);
extern void grok_special_member_properties (tree);
extern bool grok_ctor_properties (const_tree, const_tree);
extern bool grok_op_properties (tree, bool);
-extern tree xref_tag (enum tag_types, tree, tag_scope, bool);
+extern tree xref_tag (tag_types, tree,
+ tag_scope = ts_current,
+ bool tpl_header_p = false);
extern void xref_basetypes (tree, tree);
extern tree start_enum (tree, tree, tree, tree, bool, bool *);
extern void finish_enum_value_list (tree);
extern void end_template_decl (void);
extern tree maybe_update_decl_type (tree, tree);
extern bool check_default_tmpl_args (tree, tree, bool, bool, int);
-extern tree push_template_decl (tree);
-extern tree push_template_decl_real (tree, bool);
+extern tree push_template_decl (tree, bool is_friend = false);
extern tree add_inherited_template_parms (tree, tree);
extern void template_parm_level_and_index (tree, int*, int*);
extern bool redeclare_class_template (tree, tree, tree);
about this situation, and so we check here. */
if (initialized && DECL_INITIALIZED_IN_CLASS_P (field))
error ("duplicate initialization of %qD", decl);
- field = duplicate_decls (decl, field,
- /*newdecl_is_friend=*/false);
+ field = duplicate_decls (decl, field);
if (field == error_mark_node)
return error_mark_node;
else if (field)
? current_template_parms
: NULL_TREE);
if (field && field != error_mark_node
- && duplicate_decls (decl, field,
- /*newdecl_is_friend=*/false))
+ && duplicate_decls (decl, field))
decl = field;
}
|| TREE_CODE (enumtype) != ENUMERAL_TYPE)
{
enumtype = cxx_make_type (ENUMERAL_TYPE);
- enumtype = pushtag (name, enumtype, /*tag_scope=*/ts_current);
+ enumtype = pushtag (name, enumtype);
/* std::byte aliases anything. */
if (enumtype != error_mark_node
TYPE_ALIAS_SET (enumtype) = 0;
}
else
- enumtype = xref_tag (enum_type, name, /*tag_scope=*/ts_current,
- false);
+ enumtype = xref_tag (enum_type, name);
if (enumtype == error_mark_node)
return error_mark_node;
by push_nested_class.) */
if (processing_template_decl)
{
- tree newdecl1 = push_template_decl (decl1);
+ tree newdecl1 = push_template_decl (decl1, DECL_FRIEND_P (decl1));
if (newdecl1 == error_mark_node)
{
if (ctype || DECL_STATIC_FUNCTION_P (decl1))
/* We process method specializations in finish_struct_1. */
if (processing_template_decl && !DECL_TEMPLATE_SPECIALIZATION (fndecl))
{
- fndecl = push_template_decl (fndecl);
+ fndecl = push_template_decl (fndecl, DECL_FRIEND_P (fndecl));
if (fndecl == error_mark_node)
return fndecl;
}
else if (class_template_depth)
/* We rely on tsubst_friend_function to check the
validity of the declaration later. */
- decl = push_template_decl_real (decl, /*is_friend=*/true);
+ decl = push_template_decl (decl, /*is_friend=*/true);
else
decl = check_classfn (ctype, decl,
template_member_p
general, such a declaration depends on template
parameters. Instead, we call pushdecl when the class
is instantiated. */
- decl = push_template_decl_real (decl, /*is_friend=*/true);
+ decl = push_template_decl (decl, /*is_friend=*/true);
else if (current_function_decl)
/* pushdecl will check there's a local decl already. */
decl = pushdecl (decl, /*is_friend=*/true);
IDENTIFIER_LAMBDA_P (name) = true;
/* Create the new RECORD_TYPE for this lambda. */
- tree type = xref_tag (/*tag_code=*/record_type, name,
- /*scope=*/ts_current, /*template_header_p=*/false);
+ tree type = xref_tag (/*tag_code=*/record_type, name);
if (type == error_mark_node)
return error_mark_node;
static tree
vla_capture_type (tree array_type)
{
- tree type = xref_tag (record_type, make_anon_name (), ts_current, false);
+ tree type = xref_tag (record_type, make_anon_name ());
xref_basetypes (type, NULL_TREE);
type = begin_class_definition (type);
if (!ptr_id)
if (processing_template_decl)
{
- /* This may change after the call to
- push_template_decl_real, but we want the original value. */
+ /* This may change after the call to push_template_decl, but
+ we want the original value. */
tree name = DECL_NAME (decl);
- decl = push_template_decl_real (decl, is_friend);
+ decl = push_template_decl (decl, is_friend);
if (decl == error_mark_node)
return error_mark_node;
{
bool subtime = timevar_cond_start (TV_NAME_LOOKUP);
do_push_to_top_level ();
- x = pushdecl_namespace_level (x, false);
+ x = pushdecl_namespace_level (x);
cp_finish_decl (x, init, false, NULL_TREE, 0);
do_pop_from_top_level ();
timevar_cond_stop (TV_NAME_LOOKUP, subtime);
bool = true);
extern bool is_local_extern (tree);
extern bool pushdecl_class_level (tree);
-extern tree pushdecl_namespace_level (tree, bool);
+extern tree pushdecl_namespace_level (tree, bool is_friend = false);
extern bool push_class_level_binding (tree, tree);
extern tree get_local_decls ();
extern int function_parm_depth (void);
extern tree pushdecl_outermost_localscope (tree);
extern tree pushdecl_top_level (tree, bool is_friend = false);
extern tree pushdecl_top_level_and_finish (tree, tree);
-extern tree pushtag (tree, tree, tag_scope);
+extern tree pushtag (tree, tree, tag_scope = ts_current);
extern int push_namespace (tree, bool make_inline = false);
extern void pop_namespace (void);
extern void push_nested_namespace (tree);
If IS_FRIEND is true, DECL is a friend declaration. */
tree
-push_template_decl_real (tree decl, bool is_friend)
+push_template_decl (tree decl, bool is_friend)
{
tree tmpl;
tree args;
&& DECL_TEMPLATE_SPECIALIZATION (decl)
&& TINFO_USED_TEMPLATE_ID (DECL_TEMPLATE_INFO (decl))));
- if (TREE_CODE (decl) == FUNCTION_DECL && DECL_FRIEND_P (decl))
- is_friend = true;
+ /* No surprising friend functions. */
+ gcc_checking_assert (is_friend
+ || !(TREE_CODE (decl) == FUNCTION_DECL
+ && DECL_FRIEND_P (decl)));
if (is_friend)
/* For a friend, we want the context of the friend, not
return DECL_TEMPLATE_RESULT (tmpl);
}
-tree
-push_template_decl (tree decl)
-{
- return push_template_decl_real (decl, false);
-}
-
/* FN is an inheriting constructor that inherits from the constructor
template INHERITED; turn FN into a constructor template with a matching
template header. */
/* A local class. Make sure the decl gets registered properly. */
if (context == current_function_decl)
- if (pushtag (DECL_NAME (gen_tmpl), t, /*tag_scope=*/ts_current)
+ if (pushtag (DECL_NAME (gen_tmpl), t)
== error_mark_node)
return error_mark_node;
tsubst_enum. */
if (name)
SET_IDENTIFIER_TYPE_VALUE (name, newtag);
- pushtag (name, newtag, /*tag_scope=*/ts_current);
+ pushtag (name, newtag);
}
}
else if (DECL_DECLARES_FUNCTION_P (t))
/* friend class C<T>; */
friend_type = tsubst (friend_type, args,
tf_warning_or_error, NULL_TREE);
+
/* Otherwise it's
friend class C;
tree decl = *iter;
auto xloc = expand_location (DECL_SOURCE_LOCATION (decl));
auto fullname = decl_as_string (decl, 0);
+ bool using_p = iter.using_p ();
+ bool hidden_p = iter.hidden_p ();
- fprintf (file, "%p: %s:%d:%d \"%s\"\n", (void *)decl,
+ fprintf (file, "%p:%c%c %s:%d:%d \"%s\"\n", (void *)decl,
+ hidden_p ? 'H' : '-',
+ using_p ? 'U' : '-',
xloc.file, xloc.line, xloc.column, fullname);
}
}
tree type_info_type;
push_nested_namespace (std_node);
- type_info_type = xref_tag (class_type, get_identifier ("type_info"),
- /*tag_scope=*/ts_current, false);
+ type_info_type = xref_tag (class_type, get_identifier ("type_info"));
pop_nested_namespace (std_node);
const_type_info_type_node
= cp_build_qualified_type (type_info_type, TYPE_QUAL_CONST);
push_abi_namespace ();
tinfo_ptr = xref_tag (class_type,
- get_identifier ("__class_type_info"),
- /*tag_scope=*/ts_current, false);
-
+ get_identifier ("__class_type_info"));
tinfo_ptr = build_pointer_type
(cp_build_qualified_type
(tinfo_ptr, TYPE_QUAL_CONST));
vtable_ptr = ti->vtable;
if (!vtable_ptr)
{
- tree real_type;
push_abi_namespace ();
- real_type = xref_tag (class_type, ti->name,
- /*tag_scope=*/ts_current, false);
+ tree real_type = xref_tag (class_type, ti->name);
pop_abi_namespace ();
if (!COMPLETE_TYPE_P (real_type))
if (t == error_mark_node || ! MAYBE_CLASS_TYPE_P (t))
{
t = make_class_type (RECORD_TYPE);
- pushtag (make_anon_name (), t, /*tag_scope=*/ts_current);
+ pushtag (make_anon_name (), t);
}
if (TYPE_BEING_DEFINED (t))
{
t = make_class_type (TREE_CODE (t));
- pushtag (TYPE_IDENTIFIER (t), t, /*tag_scope=*/ts_current);
+ pushtag (TYPE_IDENTIFIER (t), t);
}
maybe_process_partial_specialization (t);
pushclass (t);
if (!name)
name = make_anon_name ();
- s = xref_tag (record_type, name, ts_global, 0);
+ s = xref_tag (record_type, name, ts_global);
CLASSTYPE_DECLARED_CLASS (s) = 0; /* this is a 'struct', not a 'class'. */
xref_basetypes (s, NULL_TREE); /* no base classes here! */
tree
objcp_xref_tag (enum tree_code code ATTRIBUTE_UNUSED, tree name)
{
- return xref_tag (record_type, name, ts_global, false);
+ return xref_tag (record_type, name, ts_global);
}
int
&& DECL_EXTERNAL (target_decl) && DECL_EXTERNAL (target_bval)
&& !DECL_CLASS_SCOPE_P (target_decl))
{
- duplicate_decls (decl, binding->value, /*newdecl_is_friend=*/false);
+ duplicate_decls (decl, binding->value);
ok = false;
}
else if (TREE_CODE (decl) == NAMESPACE_DECL
}
static inline tree
-safe_pushtag (tree name, tree type, tag_scope scope)
+safe_pushtag (tree name, tree type)
{
void (*save_oracle) (enum cp_oracle_request, tree identifier);
save_oracle = cp_binding_oracle;
cp_binding_oracle = NULL;
- tree ret = pushtag (name, type, scope);
+ tree ret = pushtag (name, type);
cp_binding_oracle = save_oracle;
}
static inline tree
-safe_pushdecl_maybe_friend (tree decl, bool is_friend)
+safe_pushdecl (tree decl)
{
void (*save_oracle) (enum cp_oracle_request, tree identifier);
save_oracle = cp_binding_oracle;
cp_binding_oracle = NULL;
- tree ret = pushdecl (decl, is_friend);
+ tree ret = pushdecl (decl);
cp_binding_oracle = save_oracle;
if (template_decl_p)
{
if (RECORD_OR_UNION_CODE_P (code))
- safe_pushtag (identifier, TREE_TYPE (decl), ts_current);
+ safe_pushtag (identifier, TREE_TYPE (decl));
else
decl = safe_push_template_decl (decl);
finish_member_declaration (tdecl);
}
else if (RECORD_OR_UNION_CODE_P (code))
- safe_pushtag (identifier, TREE_TYPE (decl), ts_current);
+ safe_pushtag (identifier, TREE_TYPE (decl));
else if (class_member_p)
finish_member_declaration (decl);
else
- decl = safe_pushdecl_maybe_friend (decl, false);
+ decl = safe_pushdecl (decl);
if ((ctor || dtor)
/* Don't crash after a duplicate declaration of a cdtor. */
TREE_STATIC (decl) = 1;
TREE_READONLY (decl) = 1;
cp_finish_decl (decl, cst, true, NULL, LOOKUP_ONLYCONVERTING);
- safe_pushdecl_maybe_friend (decl, false);
+ safe_pushdecl (decl);
return 1;
}