Kill OVL_CURRENT, OVL_NEXT.
authorNathan Sidwell <nathan@acm.org>
Thu, 25 May 2017 20:55:07 +0000 (20:55 +0000)
committerNathan Sidwell <nathan@gcc.gnu.org>
Thu, 25 May 2017 20:55:07 +0000 (20:55 +0000)
* 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.

From-SVN: r248469

gcc/cp/ChangeLog
gcc/cp/cp-tree.h
gcc/cp/name-lookup.c
gcc/cp/pt.c

index df36ce5..279bcdb 100644 (file)
@@ -1,5 +1,12 @@
 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.
index 11f8d01..514cb89 100644 (file)
@@ -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 0e3a16c..5d5f98a 100644 (file)
@@ -4275,13 +4275,13 @@ set_decl_namespace (tree decl, tree scope, bool friendp)
      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_match <tree, const char *> &bm,
       /* 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, tree context)
     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 54de34b..984961b 100644 (file)
@@ -2931,8 +2931,8 @@ check_explicit_specialization (tree declarator,
 
                    /* 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);
                  }
            }