aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/tree.c
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@acm.org>2017-05-16 18:29:36 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2017-05-16 18:29:36 +0000
commite09ae85766973a7b5ad9f9502a8cfa0180040d4f (patch)
treef88c3f27212d6bb2bfbe0c7ef8f6ced3cc679f27 /gcc/cp/tree.c
parenta736411aca6ab397d453e4ec8613933d3b304ac2 (diff)
downloadgcc-e09ae85766973a7b5ad9f9502a8cfa0180040d4f.zip
gcc-e09ae85766973a7b5ad9f9502a8cfa0180040d4f.tar.gz
gcc-e09ae85766973a7b5ad9f9502a8cfa0180040d4f.tar.bz2
cp-tree.h (OVL_NESTED_P, [...]): New.
* cp-tree.h (OVL_NESTED_P, OVL_LOOKUP_P): New. (ovl_first): Move inline definition to end of file. (ovl_make, lookup_add): Declare. (get_fns, get_first_fn): Make pure. * tree.c (ovl_cache): New. (ovl_make, lookup_add): New. * pt.c (do_class_deduction): Don't add candidates that will be elided. From-SVN: r248121
Diffstat (limited to 'gcc/cp/tree.c')
-rw-r--r--gcc/cp/tree.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 83dd7a3..edc0120 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -2094,6 +2094,52 @@ build_ref_qualified_type (tree type, cp_ref_qualifier rqual)
return t;
}
+/* Cache of free ovl nodes. Uses OVL_FUNCTION for chaining. */
+static GTY((deletable)) tree ovl_cache;
+
+/* Make a raw overload node containing FN. */
+
+tree
+ovl_make (tree fn, tree next)
+{
+ tree result = ovl_cache;
+
+ if (result)
+ {
+ ovl_cache = OVL_FUNCTION (result);
+ /* Zap the flags. */
+ memset (result, 0, sizeof (tree_base));
+ TREE_SET_CODE (result, OVERLOAD);
+ }
+ else
+ result = make_node (OVERLOAD);
+
+ if (TREE_CODE (fn) == OVERLOAD)
+ OVL_NESTED_P (result) = true;
+
+ TREE_TYPE (result) = (next || TREE_CODE (fn) == TEMPLATE_DECL
+ ? unknown_type_node : TREE_TYPE (fn));
+ OVL_FUNCTION (result) = fn;
+ OVL_CHAIN (result) = next;
+ return result;
+}
+
+/* Add a potential overload into a lookup set. */
+
+tree
+lookup_add (tree lookup, tree ovl)
+{
+ if (lookup || TREE_CODE (ovl) == TEMPLATE_DECL)
+ {
+ lookup = ovl_make (ovl, lookup);
+ OVL_LOOKUP_P (lookup) = true;
+ }
+ else
+ lookup = ovl;
+
+ return lookup;
+}
+
/* Returns nonzero if X is an expression for a (possibly overloaded)
function. If "f" is a function or function template, "f", "c->f",
"c.f", "C::f", and "f<int>" will all be considered possibly