From cc656415cf740381e14cf576305ef7d7c63975f5 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Tue, 1 Nov 2016 09:41:50 -0400 Subject: [PATCH] * class.c (declared_access): Split out from handle_using_decl. From-SVN: r241739 --- gcc/cp/ChangeLog | 4 ++++ gcc/cp/class.c | 15 +++++++++++---- gcc/cp/cp-tree.h | 1 + 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 8651479909c..f9f34e8d2c8 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,7 @@ +2016-11-01 Jason Merrill + + * class.c (declared_access): Split out from handle_using_decl. + 2016-10-31 Jakub Jelinek PR c++/78089 diff --git a/gcc/cp/class.c b/gcc/cp/class.c index a2a93469151..1a379348e5f 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -1299,6 +1299,16 @@ alter_access (tree t, tree fdecl, tree access) return 0; } +/* Return the access node for DECL's access in its enclosing class. */ + +tree +declared_access (tree decl) +{ + return (TREE_PRIVATE (decl) ? access_private_node + : TREE_PROTECTED (decl) ? access_protected_node + : access_public_node); +} + /* Process the USING_DECL, which is a member of T. */ static void @@ -1306,10 +1316,7 @@ handle_using_decl (tree using_decl, tree t) { tree decl = USING_DECL_DECLS (using_decl); tree name = DECL_NAME (using_decl); - tree access - = TREE_PRIVATE (using_decl) ? access_private_node - : TREE_PROTECTED (using_decl) ? access_protected_node - : access_public_node; + tree access = declared_access (using_decl); tree flist = NULL_TREE; tree old_value; diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index c58996925c3..45224dcfc42 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -5635,6 +5635,7 @@ extern tree get_vtable_decl (tree, int); extern void resort_type_method_vec (void *, void *, gt_pointer_operator, void *); extern bool add_method (tree, tree, tree); +extern tree declared_access (tree); extern tree currently_open_class (tree); extern tree currently_open_derived_class (tree); extern tree outermost_open_class (void); -- 2.30.2