On 05/08/2017 08:56 AM, Jason Merrill wrote:
On Fri, May 5, 2017 at 4:07 PM, Nathan Sidwell <nat...@acm.org> wrote:
This cleanup patch kills IDENTIFIER_NAMESPACE_VALUE and replaces
{get,set}_namespace_binding with get_namespace_value and set_global_value
respectively.
I'd prefer to stick with the _binding naming, as "value" is more ambiguous.
I've reverted that bit of the change.
nathan
--
Nathan Sidwell
2017-05-08 Nathan Sidwell <nat...@acm.org>
Revert _binding -> _value change.
* name-lookup.h (get_namespace_value, set_global_value): Rename to ...
(get_namespace_binding, set_global_binding): ... these.
* name-lookup.c (get_namespace_value, set_global_value): Rename to ...
(get_namespace_binding, set_global_binding): ... these.
(arg_assoc_namespace, pushdecl_maybe_friend_1,
check_for_out_of_scope_variable, push_overloaded_decl_1,
lookup_name_innermost_nonclass_level, push_namespace): Adjust.
* cp-tree.h (IDENTIFIER_GLOBAL_VALUE,
SET_IDENTIFIER_GLOBAL_VALUE): Adjust.
* decl.c (poplevel): Adjust.
* pt.c (make_constrained_auto): Likewise.
Index: cp-tree.h
===================================================================
--- cp-tree.h (revision 247739)
+++ cp-tree.h (working copy)
@@ -554,9 +554,9 @@ struct GTY(()) ptrmem_cst {
typedef struct ptrmem_cst * ptrmem_cst_t;
#define IDENTIFIER_GLOBAL_VALUE(NODE) \
- get_namespace_value (NULL_TREE, (NODE))
+ get_namespace_binding (NULL_TREE, (NODE))
#define SET_IDENTIFIER_GLOBAL_VALUE(NODE, VAL) \
- set_global_value ((NODE), (VAL))
+ set_global_binding ((NODE), (VAL))
#define CLEANUP_P(NODE) TREE_LANG_FLAG_0 (TRY_BLOCK_CHECK (NODE))
Index: decl.c
===================================================================
--- decl.c (revision 247739)
+++ decl.c (working copy)
@@ -693,7 +693,7 @@ poplevel (int keep, int reverse, int fun
/*class_p=*/true);
tree ns_binding = NULL_TREE;
if (!ob)
- ns_binding = get_namespace_value (current_namespace, name);
+ ns_binding = get_namespace_binding (current_namespace, name);
if (ob && ob->scope == current_binding_level->level_chain)
/* We have something like:
Index: name-lookup.c
===================================================================
--- name-lookup.c (revision 247739)
+++ name-lookup.c (working copy)
@@ -215,7 +215,7 @@ arg_assoc_namespace (struct arg_lookup *
if (arg_assoc_namespace (k, TREE_PURPOSE (value)))
return true;
- value = get_namespace_value (scope, k->name);
+ value = get_namespace_binding (scope, k->name);
if (!value)
return false;
@@ -1250,7 +1250,7 @@ pushdecl_maybe_friend_1 (tree x, bool is
/* In case this decl was explicitly namespace-qualified, look it
up in its namespace context. */
if (DECL_NAMESPACE_SCOPE_P (x) && namespace_bindings_p ())
- t = get_namespace_value (DECL_CONTEXT (x), name);
+ t = get_namespace_binding (DECL_CONTEXT (x), name);
else
t = lookup_name_innermost_nonclass_level (name);
@@ -1267,7 +1267,7 @@ pushdecl_maybe_friend_1 (tree x, bool is
t = innermost_non_namespace_value (name);
/* Or in the innermost namespace. */
if (! t)
- t = get_namespace_value (DECL_CONTEXT (x), name);
+ t = get_namespace_binding (DECL_CONTEXT (x), name);
/* Does it have linkage? Note that if this isn't a DECL, it's an
OVERLOAD, which is OK. */
if (t && DECL_P (t) && ! (TREE_STATIC (t) || DECL_EXTERNAL (t)))
@@ -1521,7 +1521,7 @@ pushdecl_maybe_friend_1 (tree x, bool is
{
tree decl;
- decl = get_namespace_value (current_namespace, name);
+ decl = get_namespace_binding (current_namespace, name);
if (decl && TREE_CODE (decl) == OVERLOAD)
decl = OVL_FUNCTION (decl);
@@ -1568,7 +1568,7 @@ pushdecl_maybe_friend_1 (tree x, bool is
else
{
/* Here to install a non-global value. */
- tree oldglobal = get_namespace_value (current_namespace, name);
+ tree oldglobal = get_namespace_binding (current_namespace, name);
tree oldlocal = NULL_TREE;
cp_binding_level *oldscope = NULL;
cxx_binding *oldbinding = outer_binding (name, NULL, true);
@@ -1608,7 +1608,7 @@ pushdecl_maybe_friend_1 (tree x, bool is
if (oldlocal == NULL_TREE)
oldlocal
- = get_namespace_value (current_namespace, DECL_NAME (d));
+ = get_namespace_binding (current_namespace, DECL_NAME (d));
}
/* If this is an extern function declaration, see if we
@@ -1972,7 +1972,7 @@ check_for_out_of_scope_variable (tree de
shadowed = DECL_HAS_SHADOWED_FOR_VAR_P (shadowed)
? DECL_SHADOWED_FOR_VAR (shadowed) : NULL_TREE;
if (!shadowed)
- shadowed = get_namespace_value (current_namespace, DECL_NAME (decl));
+ shadowed = get_namespace_binding (current_namespace, DECL_NAME (decl));
if (shadowed)
{
if (!DECL_ERROR_REPORTED (decl))
@@ -2934,7 +2934,7 @@ push_overloaded_decl_1 (tree decl, int f
int doing_global = (namespace_bindings_p () || !(flags & PUSH_LOCAL));
if (doing_global)
- old = get_namespace_value (DECL_CONTEXT (decl), name);
+ old = get_namespace_binding (DECL_CONTEXT (decl), name);
else
old = lookup_name_innermost_nonclass_level (name);
@@ -4023,7 +4023,7 @@ namespace_binding_1 (tree name, tree sco
global_namespace. */
tree
-get_namespace_value (tree ns, tree name)
+get_namespace_binding (tree ns, tree name)
{
bool subtime = timevar_cond_start (TV_NAME_LOOKUP);
if (!ns)
@@ -4052,11 +4052,11 @@ set_namespace_binding (tree name, tree s
supplement_binding (b, val);
}
-/* Set NAME in the global namespace to VAL. Does not add it to the
- list of things in the namespace. */
+/* Set value binding og NAME in the global namespace to VAL. Does not
+ add it to the list of things in the namespace. */
void
-set_global_value (tree name, tree val)
+set_global_binding (tree name, tree val)
{
bool subtime = timevar_cond_start (TV_NAME_LOOKUP);
@@ -5823,7 +5823,7 @@ lookup_name_innermost_nonclass_level_1 (
if (b->kind == sk_namespace)
{
- t = get_namespace_value (current_namespace, name);
+ t = get_namespace_binding (current_namespace, name);
/* extern "C" function() */
if (t != NULL_TREE && TREE_CODE (t) == TREE_LIST)
@@ -6475,7 +6475,7 @@ push_namespace (tree name)
if (anon)
{
name = anon_identifier;
- d = get_namespace_value (current_namespace, name);
+ d = get_namespace_binding (current_namespace, name);
if (d)
/* Reopening anonymous namespace. */
need_new = false;
@@ -6484,7 +6484,7 @@ push_namespace (tree name)
else
{
/* Check whether this is an extended namespace definition. */
- d = get_namespace_value (current_namespace, name);
+ d = get_namespace_binding (current_namespace, name);
if (d != NULL_TREE && TREE_CODE (d) == NAMESPACE_DECL)
{
tree dna = DECL_NAMESPACE_ALIAS (d);
Index: name-lookup.h
===================================================================
--- name-lookup.h (revision 247739)
+++ name-lookup.h (working copy)
@@ -311,8 +311,8 @@ extern tree pushdecl_with_scope (tree, c
extern tree lookup_name_prefer_type (tree, int);
extern tree lookup_name_real (tree, int, int, bool, int, int);
extern tree lookup_type_scope (tree, tag_scope);
-extern tree get_namespace_value (tree ns, tree id);
-extern void set_global_value (tree id, tree val);
+extern tree get_namespace_binding (tree ns, tree id);
+extern void set_global_binding (tree id, tree val);
extern bool hidden_name_p (tree);
extern tree remove_hidden_names (tree);
extern tree lookup_qualified_name (tree, tree, int, bool, /*hidden*/bool = false);
Index: pt.c
===================================================================
--- pt.c (revision 247739)
+++ pt.c (working copy)
@@ -24731,7 +24731,7 @@ make_constrained_auto (tree con, tree ar
static tree
listify (tree arg)
{
- tree std_init_list = get_namespace_value (std_node, init_list_identifier);
+ tree std_init_list = get_namespace_binding (std_node, init_list_identifier);
tree argvec;
if (!std_init_list || !DECL_CLASS_TEMPLATE_P (std_init_list))
{