2017-05-25 Nathan Sidwell <nathan@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.
+
Kill DECL_NAMESPACE_USERS, DECL_NAMESPACE_ASSOCIATIONS.
* cp-tree.h (lang_decl_ns): Remove ns_users field.
(DECL_NAMESPACE_USERS, DECL_NAMESPACE_ASSOCIATIONS): Delete.
(((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. */
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);
/* 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. */
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"
/* 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);
}
}