This patch finally expunges OVL_CURRENT & OVL_NEXT. Everything's
switched over to using the new iterators.
The use in check_explicit_specialization is temporary, until I enable 2D
overload sets, and then it'll just use lookup_add on the overload set.
nathan
--
Nathan Sidwell
2017-05-25 Nathan Sidwell <nat...@acm.org>
Kill OVL_CURRENT, OVL_NEXT.
* cp-tree.h (OVL_CURRENT, OVL_NEXT): Delete.
* name-lookup.c (set_decl_namespace): Use ovl_iterator.
(consider_binding_level): Use OVL_FIRST.
(cp_emit_debug_info_for_using): Use lkp_iterator.
* pt.c (check_explicit_specialization): Use ovl_iterator.
Index: cp-tree.h
===================================================================
--- cp-tree.h (revision 248467)
+++ cp-tree.h (working copy)
@@ -659,12 +659,6 @@ typedef struct ptrmem_cst * ptrmem_cst_t
(((struct tree_overload*)OVERLOAD_CHECK (NODE))->function)
#define OVL_CHAIN(NODE) TREE_CHAIN (NODE)
-/* Polymorphic access to FUNCTION and CHAIN. */
-#define OVL_CURRENT(NODE) \
- ((TREE_CODE (NODE) == OVERLOAD) ? OVL_FUNCTION (NODE) : (NODE))
-#define OVL_NEXT(NODE) \
- ((TREE_CODE (NODE) == OVERLOAD) ? TREE_CHAIN (NODE) : NULL_TREE)
-
/* If set, this was imported in a using declaration. */
#define OVL_USING_P(NODE) TREE_LANG_FLAG_1 (OVERLOAD_CHECK (NODE))
/* If set, this overload is a hidden decl. */
Index: name-lookup.c
===================================================================
--- name-lookup.c (revision 248467)
+++ name-lookup.c (working copy)
@@ -4275,13 +4275,13 @@ set_decl_namespace (tree decl, tree scop
friends in any namespace. */
if (friendp && DECL_USE_TEMPLATE (decl))
return;
- if (is_overloaded_fn (old))
+ if (OVL_P (old))
{
tree found = NULL_TREE;
- tree elt = old;
- for (; elt; elt = OVL_NEXT (elt))
+
+ for (ovl_iterator iter (old); iter; ++iter)
{
- tree ofn = OVL_CURRENT (elt);
+ tree ofn = *iter;
/* Adjust DECL_CONTEXT first so decls_match will return true
if DECL will match a declaration in an inline namespace. */
DECL_CONTEXT (decl) = DECL_CONTEXT (ofn);
@@ -4932,10 +4932,7 @@ consider_binding_level (tree name, best_
/* OVERLOADs or decls from using declaration are wrapped into
TREE_LIST. */
if (TREE_CODE (d) == TREE_LIST)
- {
- d = TREE_VALUE (d);
- d = OVL_CURRENT (d);
- }
+ d = OVL_FIRST (TREE_VALUE (d));
/* Don't use bindings from implicitly declared functions,
as they were likely misspellings themselves. */
@@ -6290,14 +6287,18 @@ cp_emit_debug_info_for_using (tree t, tr
t = BASELINK_FUNCTIONS (t);
/* FIXME: Handle TEMPLATE_DECLs. */
- for (t = OVL_CURRENT (t); t; t = OVL_NEXT (t))
- if (TREE_CODE (t) != TEMPLATE_DECL)
- {
- if (building_stmt_list_p ())
- add_stmt (build_stmt (input_location, USING_STMT, t));
- else
- (*debug_hooks->imported_module_or_decl) (t, NULL_TREE, context, false);
- }
+ for (lkp_iterator iter (t); iter; ++iter)
+ {
+ tree fn = *iter;
+ if (TREE_CODE (fn) != TEMPLATE_DECL)
+ {
+ if (building_stmt_list_p ())
+ add_stmt (build_stmt (input_location, USING_STMT, fn));
+ else
+ debug_hooks->imported_module_or_decl (fn,
+ NULL_TREE, context, false);
+ }
+ }
}
#include "gt-cp-name-lookup.h"
Index: pt.c
===================================================================
--- pt.c (revision 248466)
+++ pt.c (working copy)
@@ -2931,8 +2931,8 @@ check_explicit_specialization (tree decl
/* Glue all these conversion functions together
with those we already have. */
- for (; ovl; ovl = OVL_NEXT (ovl))
- fns = lookup_add (OVL_CURRENT (ovl), fns);
+ for (ovl_iterator iter (ovl); iter; ++iter)
+ fns = lookup_add (*iter, fns);
}
}