bool is_friend = DECL_CONTEXT (space) != t;
if (is_friend)
do_friend (NULL_TREE, DECL_NAME (eq), eq,
- NULL_TREE, NO_SPECIAL, true);
+ NO_SPECIAL, true);
else
{
add_method (t, eq, false);
extern int is_friend (tree, tree);
extern void make_friend_class (tree, tree, bool);
extern void add_friend (tree, tree, bool);
-extern tree do_friend (tree, tree, tree, tree,
+extern tree do_friend (tree, tree, tree,
enum overload_flags, bool);
extern void set_global_friend (tree);
}
decl = do_friend (ctype, unqualified_id, decl,
- *attrlist, flags,
- funcdef_flag);
+ flags, funcdef_flag);
return decl;
}
else
if ((TREE_CODE (value) == FUNCTION_DECL
|| TREE_CODE (value) == TEMPLATE_DECL)
&& DECL_CONTEXT (value) != current_class_type)
- return value;
+ {
+ if (attrlist)
+ cplus_decl_attributes (&value, attrlist, 0);
+ return value;
+ }
/* Need to set this before push_template_decl. */
if (VAR_P (value))
tree old_attrs = *q;
- /* Merge the late attributes at the beginning with the attribute
+ /* Place the late attributes at the beginning of the attribute
list. */
- late_attrs = merge_attributes (late_attrs, *q);
+ late_attrs = chainon (late_attrs, *q);
if (*q != late_attrs
&& !DECL_P (*decl_p)
&& !(flags & ATTR_FLAG_TYPE_IN_PLACE))
tree
do_friend (tree ctype, tree declarator, tree decl,
- tree attrlist, enum overload_flags flags,
+ enum overload_flags flags,
bool funcdef_flag)
{
gcc_assert (TREE_CODE (decl) == FUNCTION_DECL);
error ("friend declaration %qD may not have virt-specifiers",
decl);
- /* Unfortunately, we have to handle attributes here. Normally we would
- handle them in start_decl_1, but since this is a friend decl start_decl_1
- never gets to see it. */
-
- /* Set attributes here so if duplicate decl, will have proper attributes. */
- cplus_decl_attributes (&decl, attrlist, 0);
-
if (TREE_CODE (declarator) == TEMPLATE_ID_EXPR)
{
declarator = TREE_OPERAND (declarator, 0);
apply_late_template_attributes (tree *decl_p, tree attributes, int attr_flags,
tree args, tsubst_flags_t complain, tree in_decl)
{
- tree last_dep = NULL_TREE;
tree t;
tree *p;
p = &TREE_CHAIN (*p);
}
+ /* save_template_attributes puts the dependent attributes at the beginning of
+ the list; find the non-dependent ones. */
for (t = attributes; t; t = TREE_CHAIN (t))
- if (ATTR_IS_DEPENDENT (t))
- {
- last_dep = t;
- attributes = copy_list (attributes);
- break;
- }
+ if (!ATTR_IS_DEPENDENT (t))
+ break;
+ tree nondep = t;
- *p = attributes;
- if (last_dep)
- {
- tree late_attrs = NULL_TREE;
- tree *q = &late_attrs;
+ /* Apply any non-dependent attributes. */
+ *p = nondep;
- for (; *p; )
+ /* And then any dependent ones. */
+ tree late_attrs = NULL_TREE;
+ tree *q = &late_attrs;
+ for (t = attributes; t != nondep; t = TREE_CHAIN (t))
+ {
+ *q = tsubst_attribute (t, decl_p, args, complain, in_decl);
+ if (*q == error_mark_node)
+ return false;
+ if (*q == t)
{
- t = *p;
- if (ATTR_IS_DEPENDENT (t))
- {
- *q = tsubst_attribute (t, decl_p, args, complain, in_decl);
- if (*q == error_mark_node)
- return false;
- *p = TREE_CHAIN (t);
- TREE_CHAIN (t) = NULL_TREE;
- while (*q)
- q = &TREE_CHAIN (*q);
- }
- else
- p = &TREE_CHAIN (t);
+ *q = copy_node (t);
+ TREE_CHAIN (*q) = NULL_TREE;
}
-
- cplus_decl_attributes (decl_p, late_attrs, attr_flags);
+ while (*q)
+ q = &TREE_CHAIN (*q);
}
+
+ cplus_decl_attributes (decl_p, late_attrs, attr_flags);
+
return true;
}