parse.y (frob_specs): Split out...
* parse.y (frob_specs): Split out... (parse_decl): From here. (fn.def2): Call initial_deferred_type_access_control. (after_type_component_declarator0): Call frob_specs. (notype_component_declarator0): Likewise. * search.c (friend_accessible_p): Nested classes are friends of their enclosing classes. From-SVN: r31957
This commit is contained in:
parent
564e43cdf1
commit
445ab4438d
5 changed files with 892 additions and 881 deletions
|
@ -1,3 +1,13 @@
|
|||
2000-02-13 Jason Merrill <jason@casey.cygnus.com>
|
||||
|
||||
* parse.y (frob_specs): Split out...
|
||||
(parse_decl): From here.
|
||||
(fn.def2): Call initial_deferred_type_access_control.
|
||||
(after_type_component_declarator0): Call frob_specs.
|
||||
(notype_component_declarator0): Likewise.
|
||||
* search.c (friend_accessible_p): Nested classes are friends of their
|
||||
enclosing classes.
|
||||
|
||||
2000-02-10 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
* ir.texi (ADDR_EXPR): Document the fact that an ADDR_EXPR can be
|
||||
|
|
|
@ -101,7 +101,7 @@ is_friend (type, supplicant)
|
|||
else
|
||||
/* It's a type. */
|
||||
{
|
||||
/* The type and its nested classes are implicitly friends, as
|
||||
/* Nested classes are implicitly friends of their enclosing types, as
|
||||
per core issue 45 (this is a change from the standard). */
|
||||
for (context = supplicant;
|
||||
context && TYPE_P (context);
|
||||
|
|
1711
gcc/cp/parse.c
1711
gcc/cp/parse.c
File diff suppressed because it is too large
Load diff
|
@ -314,6 +314,18 @@ static tree current_enum_type;
|
|||
extern void yyprint PARAMS ((FILE *, int, YYSTYPE));
|
||||
extern tree combine_strings PARAMS ((tree));
|
||||
|
||||
static void
|
||||
frob_specs (specs_attrs, lookups)
|
||||
tree specs_attrs;
|
||||
tree lookups;
|
||||
{
|
||||
initial_deferred_type_access_control (lookups);
|
||||
split_specs_attrs (specs_attrs, ¤t_declspecs, &prefix_attributes);
|
||||
if (current_declspecs
|
||||
&& TREE_CODE (current_declspecs) != TREE_LIST)
|
||||
current_declspecs = build_decl_list (NULL_TREE, current_declspecs);
|
||||
}
|
||||
|
||||
static void
|
||||
parse_decl (declarator, specs_attrs, lookups, attributes, initialized, decl)
|
||||
tree declarator;
|
||||
|
@ -323,12 +335,8 @@ parse_decl (declarator, specs_attrs, lookups, attributes, initialized, decl)
|
|||
int initialized;
|
||||
tree* decl;
|
||||
{
|
||||
initial_deferred_type_access_control (lookups);
|
||||
frob_specs (specs_attrs, lookups);
|
||||
|
||||
split_specs_attrs (specs_attrs, ¤t_declspecs, &prefix_attributes);
|
||||
if (current_declspecs
|
||||
&& TREE_CODE (current_declspecs) != TREE_LIST)
|
||||
current_declspecs = build_decl_list (NULL_TREE, current_declspecs);
|
||||
if (have_extern_spec && !used_extern_spec)
|
||||
{
|
||||
current_declspecs = decl_tree_cons (NULL_TREE,
|
||||
|
@ -747,6 +755,7 @@ fn.def2:
|
|||
{ tree specs, attrs;
|
||||
split_specs_attrs ($1.t, &specs, &attrs);
|
||||
attrs = build_tree_list (attrs, NULL_TREE);
|
||||
initial_deferred_type_access_control ($1.lookups);
|
||||
$$ = start_method (specs, $2, attrs); goto rest_of_mdef; }
|
||||
| declmods notype_declarator
|
||||
{ tree specs, attrs;
|
||||
|
@ -2543,42 +2552,30 @@ component_declarator:
|
|||
|
||||
after_type_component_declarator0:
|
||||
after_type_declarator maybeasm maybe_attribute maybe_init
|
||||
{ split_specs_attrs ($<ttype>0, ¤t_declspecs,
|
||||
&prefix_attributes);
|
||||
$<ttype>0 = current_declspecs;
|
||||
{ frob_specs ($<ftype>0.t, $<ftype>0.lookups);
|
||||
$$ = grokfield ($$, current_declspecs, $4, $2,
|
||||
build_tree_list ($3, prefix_attributes)); }
|
||||
| TYPENAME ':' expr_no_commas maybe_attribute
|
||||
{ split_specs_attrs ($<ttype>0, ¤t_declspecs,
|
||||
&prefix_attributes);
|
||||
$<ttype>0 = current_declspecs;
|
||||
{ frob_specs ($<ftype>0.t, $<ftype>0.lookups);
|
||||
$$ = grokbitfield ($$, current_declspecs, $3);
|
||||
cplus_decl_attributes ($$, $4, prefix_attributes); }
|
||||
;
|
||||
|
||||
notype_component_declarator0:
|
||||
notype_declarator maybeasm maybe_attribute maybe_init
|
||||
{ split_specs_attrs ($<ttype>0, ¤t_declspecs,
|
||||
&prefix_attributes);
|
||||
$<ttype>0 = current_declspecs;
|
||||
{ frob_specs ($<ftype>0.t, $<ftype>0.lookups);
|
||||
$$ = grokfield ($$, current_declspecs, $4, $2,
|
||||
build_tree_list ($3, prefix_attributes)); }
|
||||
| constructor_declarator maybeasm maybe_attribute maybe_init
|
||||
{ split_specs_attrs ($<ttype>0, ¤t_declspecs,
|
||||
&prefix_attributes);
|
||||
$<ttype>0 = current_declspecs;
|
||||
{ frob_specs ($<ftype>0.t, $<ftype>0.lookups);
|
||||
$$ = grokfield ($$, current_declspecs, $4, $2,
|
||||
build_tree_list ($3, prefix_attributes)); }
|
||||
| IDENTIFIER ':' expr_no_commas maybe_attribute
|
||||
{ split_specs_attrs ($<ttype>0, ¤t_declspecs,
|
||||
&prefix_attributes);
|
||||
$<ttype>0 = current_declspecs;
|
||||
{ frob_specs ($<ftype>0.t, $<ftype>0.lookups);
|
||||
$$ = grokbitfield ($$, current_declspecs, $3);
|
||||
cplus_decl_attributes ($$, $4, prefix_attributes); }
|
||||
| ':' expr_no_commas maybe_attribute
|
||||
{ split_specs_attrs ($<ttype>0, ¤t_declspecs,
|
||||
&prefix_attributes);
|
||||
$<ttype>0 = current_declspecs;
|
||||
{ frob_specs ($<ftype>0.t, $<ftype>0.lookups);
|
||||
$$ = grokbitfield (NULL_TREE, current_declspecs, $2);
|
||||
cplus_decl_attributes ($$, $3, prefix_attributes); }
|
||||
;
|
||||
|
|
|
@ -1052,6 +1052,13 @@ friend_accessible_p (scope, type, decl, binfo)
|
|||
if (protected_accessible_p (type, decl, TREE_VALUE (t), binfo))
|
||||
return 1;
|
||||
|
||||
/* Nested classes are implicitly friends of their enclosing types, as
|
||||
per core issue 45 (this is a change from the standard). */
|
||||
if (TYPE_P (scope))
|
||||
for (t = TYPE_CONTEXT (scope); t && TYPE_P (t); t = TYPE_CONTEXT (t))
|
||||
if (protected_accessible_p (type, decl, t, binfo))
|
||||
return 1;
|
||||
|
||||
if (TREE_CODE (scope) == FUNCTION_DECL
|
||||
|| DECL_FUNCTION_TEMPLATE_P (scope))
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue