cp-tree.h (ovl_skip_hidden): Declare.
[gcc.git] / gcc / cp / tree.c
index 5ae9601aaef784b2205c423be146dd32bded1e5d..29e3256c8711fbf0eac9524f5a116ac944fb4994 100644 (file)
@@ -2204,6 +2204,27 @@ ovl_insert (tree fn, tree maybe_ovl, bool using_p)
   return result;
 }
 
+/* Skip any hidden names at the beginning of OVL.   */
+
+tree
+ovl_skip_hidden (tree ovl)
+{
+  for (;
+       ovl && TREE_CODE (ovl) == OVERLOAD && OVL_HIDDEN_P (ovl);
+       ovl = OVL_CHAIN (ovl))
+    gcc_checking_assert (DECL_HIDDEN_P (OVL_FUNCTION (ovl)));
+
+  if (ovl && TREE_CODE (ovl) != OVERLOAD && DECL_HIDDEN_P (ovl))
+    {
+      /* Any hidden functions should have been wrapped in an
+        overload, but injected friend classes will not.  */
+      gcc_checking_assert (!DECL_DECLARES_FUNCTION_P (ovl));
+      ovl = NULL_TREE;
+    }
+
+  return ovl;
+}
+
 /* NODE is an OVL_HIDDEN_P node which is now revealed.  */
 
 tree