aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/semantics.c
diff options
context:
space:
mode:
authorJason Merrill <jason@gcc.gnu.org>2000-02-07 15:36:36 -0500
committerJason Merrill <jason@gcc.gnu.org>2000-02-07 15:36:36 -0500
commit70adf8a937ecf00e12362bbe93ad7468d182920e (patch)
treeb5ba1f06fdf738a4df46fbd5008f64ebb0936d5a /gcc/cp/semantics.c
parentdd8216e19ee0c8f16303b8e412b8f30df82d4f42 (diff)
downloadgcc-70adf8a937ecf00e12362bbe93ad7468d182920e.zip
gcc-70adf8a937ecf00e12362bbe93ad7468d182920e.tar.gz
gcc-70adf8a937ecf00e12362bbe93ad7468d182920e.tar.bz2
cp-tree.h (struct saved_scope): Add incomplete field.
* cp-tree.h (struct saved_scope): Add incomplete field. (namespace_scope_incomplete): New macro. * decl.c (pushdecl): Use it. (hack_incomplete_structures): Use it. See through artificial binding levels. (mark_saved_scope): Mark it. Implement access control for nested types. * search.c (type_access_control): New fn. (accessible_p): Now we do perform access control for types. * semantics.c (deferred_type_access_control): New fn. (initial_deferred_type_access_control): New fn. (begin_function_definition): Call it. Add lookups parm. * decl.c (struct binding_level): Add this_class field. (pushlevel_class): Set it. (mark_binding_level): Mark it. (lookup_name_real): Use it. Call type_access_control. (mark_saved_scope): Mark lookups field. * cp-tree.h (flagged_type_tree): Add lookups field. (struct saved_scope): Add lookups field. (type_lookups): New macro. * parse.y (declmods): Now <ftype>. (parse_decl): Add lookups parm. Call initial_deferred_type_access_control. (lang_extdef): Clear type_lookups. (typed_declspecs, declmods, typespec): Set lookups field. (initdcl): Call deferred_type_access_control. (fn.def1, fn.def2, typed_declspecs1, initdcl0_innards, nomods_initdcl0, component_decl_1, named_parm): Adjust. * friend.c (is_friend): Nested classes are friends of their enclosing classes. * class.c (currently_open_derived_class): New fn. * method.c (hack_identifier): Use it. * lex.c (do_identifier): Remove obsolete code. * parse.y (typed_typespecs): Propagate new_type_flag properly. From-SVN: r31837
Diffstat (limited to 'gcc/cp/semantics.c')
-rw-r--r--gcc/cp/semantics.c46
1 files changed, 44 insertions, 2 deletions
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index d85a710..abe9fb1 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -1690,17 +1690,59 @@ finish_id_expr (expr)
return expr;
}
-/* Begin a function defniition declared with DECL_SPECS and
+static tree current_type_lookups;
+
+/* Perform deferred access control for types used in the type of a
+ declaration. */
+
+void
+deferred_type_access_control ()
+{
+ tree lookup = current_type_lookups;
+
+ if (lookup == error_mark_node)
+ return;
+
+ for (; lookup; lookup = TREE_CHAIN (lookup))
+ enforce_access (TREE_PURPOSE (lookup), TREE_VALUE (lookup));
+}
+
+/* Perform deferred access control for types used in the type of a
+ declaration. Called for the first declarator in a declaration. */
+
+void
+initial_deferred_type_access_control (lookups)
+ tree lookups;
+{
+ tree lookup = type_lookups;
+
+ /* First perform the checks for the current declarator; they will have
+ been added to type_lookups since typed_declspecs saved the copy that
+ we have been passed. */
+ if (lookup != error_mark_node)
+ for (; lookup != lookups; lookup = TREE_CHAIN (lookup))
+ enforce_access (TREE_PURPOSE (lookup), TREE_VALUE (lookup));
+
+ current_type_lookups = lookups;
+ type_lookups = error_mark_node;
+ deferred_type_access_control ();
+}
+
+/* Begin a function definition declared with DECL_SPECS and
DECLARATOR. Returns non-zero if the function-declaration is
legal. */
int
-begin_function_definition (decl_specs, declarator)
+begin_function_definition (decl_specs, lookups, declarator)
tree decl_specs;
+ tree lookups;
tree declarator;
{
tree specs;
tree attrs;
+
+ initial_deferred_type_access_control (lookups);
+
split_specs_attrs (decl_specs, &specs, &attrs);
if (!start_function (specs, declarator, attrs, SF_DEFAULT))
return 0;