public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Nathan Sidwell <nathan@acm.org>
To: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: [C++ PATCH] Kill OVL_CURRENT, OVL_NEXT
Date: Thu, 25 May 2017 21:21:00 -0000	[thread overview]
Message-ID: <8ea31017-15c1-9e86-5b12-03f59acbc039@acm.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 282 bytes --]

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

[-- Attachment #2: ovlect.diff --]
[-- Type: text/x-patch, Size: 3508 bytes --]

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.	

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);
 		  }
 	    }
 

                 reply	other threads:[~2017-05-25 20:57 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8ea31017-15c1-9e86-5b12-03f59acbc039@acm.org \
    --to=nathan@acm.org \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).