@@ -2328,12 +2328,11 @@ add_builtin_candidates (struct z_candidate **candidates, enum tree_code code,
{
int ref1, i;
int enum_p = 0;
- tree type, argtypes[3];
+ tree type, argtypes[3], t;
/* TYPES[i] is the set of possible builtin-operator parameter types
- we will consider for the Ith argument. These are represented as
- a TREE_LIST; the TREE_VALUE of each node is the potential
- parameter type. */
- tree types[2];
+ we will consider for the Ith argument. */
+ VEC(tree,gc) *types[2];
+ unsigned ix;
for (i = 0; i < 3; ++i)
{
@@ -2395,7 +2394,8 @@ add_builtin_candidates (struct z_candidate **candidates, enum tree_code code,
ref1 = 0;
}
- types[0] = types[1] = NULL_TREE;
+ types[0] = make_tree_vector ();
+ types[1] = make_tree_vector ();
for (i = 0; i < 2; ++i)
{
@@ -2414,11 +2414,11 @@ add_builtin_candidates (struct z_candidate **candidates, enum tree_code code,
if (code == COND_EXPR)
{
if (real_lvalue_p (args[i]))
- types[i] = tree_cons
- (NULL_TREE, build_reference_type (argtypes[i]), types[i]);
+ VEC_safe_push (tree, gc, types[i],
+ build_reference_type (argtypes[i]));
- types[i] = tree_cons
- (NULL_TREE, TYPE_MAIN_VARIANT (argtypes[i]), types[i]);
+ VEC_safe_push (tree, gc, types[i],
+ TYPE_MAIN_VARIANT (argtypes[i]));
}
else if (! convs)
@@ -2434,54 +2434,60 @@ add_builtin_candidates (struct z_candidate **candidates, enum tree_code code,
continue;
if (code == COND_EXPR && TREE_CODE (type) == REFERENCE_TYPE)
- types[i] = tree_cons (NULL_TREE, type, types[i]);
+ VEC_safe_push (tree, gc, types[i], type);
type = non_reference (type);
if (i != 0 || ! ref1)
{
type = TYPE_MAIN_VARIANT (type_decays_to (type));
if (enum_p && TREE_CODE (type) == ENUMERAL_TYPE)
- types[i] = tree_cons (NULL_TREE, type, types[i]);
+ VEC_safe_push (tree, gc, types[i], type);
if (INTEGRAL_OR_UNSCOPED_ENUMERATION_TYPE_P (type))
type = type_promotes_to (type);
}
- if (! value_member (type, types[i]))
- types[i] = tree_cons (NULL_TREE, type, types[i]);
+ if (! vec_member (type, types[i]))
+ VEC_safe_push (tree, gc, types[i], type);
}
}
else
{
if (code == COND_EXPR && real_lvalue_p (args[i]))
- types[i] = tree_cons
- (NULL_TREE, build_reference_type (argtypes[i]), types[i]);
+ VEC_safe_push (tree, gc, types[i],
+ build_reference_type (argtypes[i]));
type = non_reference (argtypes[i]);
if (i != 0 || ! ref1)
{
type = TYPE_MAIN_VARIANT (type_decays_to (type));
if (enum_p && UNSCOPED_ENUM_P (type))
- types[i] = tree_cons (NULL_TREE, type, types[i]);
+ VEC_safe_push (tree, gc, types[i], type);
if (INTEGRAL_OR_UNSCOPED_ENUMERATION_TYPE_P (type))
type = type_promotes_to (type);
}
- types[i] = tree_cons (NULL_TREE, type, types[i]);
+ VEC_safe_push (tree, gc, types[i], type);
}
}
/* Run through the possible parameter types of both arguments,
creating candidates with those parameter types. */
- for (; types[0]; types[0] = TREE_CHAIN (types[0]))
+ FOR_EACH_VEC_ELT_REVERSE (tree, types[0], ix, t)
{
- if (types[1])
- for (type = types[1]; type; type = TREE_CHAIN (type))
+ unsigned jx;
+ tree u;
+
+ if (!VEC_empty (tree, types[1]))
+ FOR_EACH_VEC_ELT_REVERSE (tree, types[1], jx, u)
add_builtin_candidate
- (candidates, code, code2, fnname, TREE_VALUE (types[0]),
- TREE_VALUE (type), args, argtypes, flags);
+ (candidates, code, code2, fnname, t,
+ u, args, argtypes, flags);
else
add_builtin_candidate
- (candidates, code, code2, fnname, TREE_VALUE (types[0]),
+ (candidates, code, code2, fnname, t,
NULL_TREE, args, argtypes, flags);
}
+
+ release_tree_vector (types[0]);
+ release_tree_vector (types[1]);
}