+2019-05-13 Jason Merrill <jason@redhat.com>
+
+ Use releasing_vec more broadly.
+ * cp-tree.h (struct releasing_vec): Replace get_ref method with
+ operator&.
+ (vec_safe_push, vec_safe_reserve, vec_safe_length, vec_safe_splice):
+ Forwarding functions for releasing_vec.
+ (release_tree_vector): Declare but don't define.
+ * call.c (build_op_delete_call, build_temp, call_copy_ctor)
+ (perform_direct_initialization_if_possible): Use releasing_vec.
+ * constexpr.c (cxx_eval_vec_init_1, cxx_eval_store_expression):
+ Likewise.
+ * cp-gimplify.c (cp_fold): Likewise.
+ * cvt.c (force_rvalue, ocp_convert): Likewise.
+ * decl.c (get_tuple_decomp_init): Likewise.
+ * except.c (build_throw): Likewise.
+ * init.c (perform_member_init, expand_default_init): Likewise.
+ * method.c (do_build_copy_assign, locate_fn_flags): Likewise.
+ * parser.c (cp_parser_userdef_char_literal)
+ (cp_parser_userdef_numeric_literal)
+ (cp_parser_userdef_string_literal)
+ (cp_parser_perform_range_for_lookup)
+ (cp_parser_range_for_member_function, cp_parser_omp_for_loop)
+ (cp_parser_omp_for_loop_init): Likewise.
+ * pt.c (tsubst_copy_and_build, do_class_deduction): Likewise.
+ * semantics.c (calculate_direct_bases, calculate_bases)
+ (finish_omp_barrier, finish_omp_flush, finish_omp_taskwait)
+ (finish_omp_taskyield, finish_omp_cancel)
+ (finish_omp_cancellation_point): Likewise.
+ * tree.c (build_vec_init_elt, strip_typedefs, strip_typedefs_expr)
+ (build_min_non_dep_op_overload): Likewise.
+ * typeck.c (build_function_call_vec, cp_build_function_call_nary)
+ (cp_build_modify_expr): Likewise.
+ * typeck2.c (build_functional_cast): Likewise.
+
2019-05-11 Paolo Carlini <paolo.carlini@oracle.com>
* typeck.c (cp_build_function_call_vec): When mark_used fails
}
tree ret;
- vec<tree, va_gc> *args = make_tree_vector ();
+ releasing_vec args;
args->quick_push (addr);
if (destroying)
args->quick_push (destroying);
args->quick_push (al);
}
ret = cp_build_function_call_vec (fn, &args, complain);
- release_tree_vector (args);
return ret;
}
}
diagnostic_t *diagnostic_kind, tsubst_flags_t complain)
{
int savew, savee;
- vec<tree, va_gc> *args;
*diagnostic_kind = DK_UNSPECIFIED;
return get_target_expr_sfinae (expr, complain);
savew = warningcount + werrorcount, savee = errorcount;
- args = make_tree_vector_single (expr);
+ releasing_vec args (make_tree_vector_single (expr));
expr = build_special_member_call (NULL_TREE, complete_ctor_identifier,
&args, type, flags, complain);
- release_tree_vector (args);
if (warningcount + werrorcount > savew)
*diagnostic_kind = DK_WARNING;
else if (errorcount > savee)
tree copy = get_copy_ctor (ctype, complain);
copy = build_baselink (binfo, binfo, copy, NULL_TREE);
tree ob = build_dummy_object (ctype);
- vec<tree, va_gc>* args = make_tree_vector_single (a);
+ releasing_vec args (make_tree_vector_single (a));
tree r = build_new_method_call (ob, copy, &args, NULL_TREE,
LOOKUP_NORMAL, NULL, complain);
- release_tree_vector (args);
return r;
}
ill-formed. */
if (CLASS_TYPE_P (type))
{
- vec<tree, va_gc> *args = make_tree_vector_single (expr);
+ releasing_vec args (make_tree_vector_single (expr));
expr = build_special_member_call (NULL_TREE, complete_ctor_identifier,
&args, type, LOOKUP_NORMAL, complain);
- release_tree_vector (args);
return build_cplus_new (type, expr, complain);
}
}
else if (!init)
{
- vec<tree, va_gc> *argvec = make_tree_vector ();
+ releasing_vec argvec;
init = build_special_member_call (NULL_TREE, complete_ctor_identifier,
&argvec, elttype, LOOKUP_NORMAL,
complain);
- release_tree_vector (argvec);
init = build_aggr_init_expr (elttype, init);
pre_init = true;
}
}
/* And then find the underlying variable. */
- vec<tree,va_gc> *refs = make_tree_vector();
+ releasing_vec refs;
tree object = NULL_TREE;
for (tree probe = target; object == NULL_TREE; )
{
type = TREE_TYPE (object);
bool no_zero_init = true;
- vec<tree,va_gc> *ctors = make_tree_vector ();
+ releasing_vec ctors;
while (!refs->is_empty())
{
if (*valp == NULL_TREE)
}
valp = &cep->value;
}
- release_tree_vector (refs);
if (!preeval)
{
bool c = TREE_CONSTANT (init);
bool s = TREE_SIDE_EFFECTS (init);
if (!c || s)
- FOR_EACH_VEC_SAFE_ELT (ctors, i, elt)
+ FOR_EACH_VEC_ELT (*ctors, i, elt)
{
if (!c)
TREE_CONSTANT (elt) = false;
if (s)
TREE_SIDE_EFFECTS (elt) = true;
}
- release_tree_vector (ctors);
if (*non_constant_p)
return t;
case TREE_VEC:
{
bool changed = false;
- vec<tree, va_gc> *vec = make_tree_vector ();
+ releasing_vec vec;
int i, n = TREE_VEC_LENGTH (x);
vec_safe_reserve (vec, n);
TREE_VEC_ELT (r, i) = (*vec)[i];
x = r;
}
-
- release_tree_vector (vec);
}
break;
vec_t *operator-> () const { return v; }
vec_t *get() const { return v; }
operator vec_t *() const { return v; }
- tree& operator[] (unsigned i) const { return (*v)[i]; }
+ vec_t ** operator& () { return &v; }
- /* Necessary for use with vec** and vec*& interfaces. */
- vec_t *&get_ref () { return v; }
+ /* Breaks pointer/value consistency for convenience. */
+ tree& operator[] (unsigned i) const { return (*v)[i]; }
~releasing_vec() { release_tree_vector (v); }
private:
vec_t *v;
};
+/* Forwarding functions for vec_safe_* that might reallocate. */
+inline tree* vec_safe_push (releasing_vec& r, const tree &t CXX_MEM_STAT_INFO)
+{ return vec_safe_push (*&r, t PASS_MEM_STAT); }
+inline bool vec_safe_reserve (releasing_vec& r, unsigned n, bool e = false CXX_MEM_STAT_INFO)
+{ return vec_safe_reserve (*&r, n, e PASS_MEM_STAT); }
+inline unsigned vec_safe_length (releasing_vec &r)
+{ return r->length(); }
+inline void vec_safe_splice (releasing_vec &r, vec<tree, va_gc> *p CXX_MEM_STAT_INFO)
+{ vec_safe_splice (*&r, p PASS_MEM_STAT); }
+void release_tree_vector (releasing_vec &); // cause link error
struct GTY(()) tree_template_decl {
struct tree_decl_common common;
tree type = TREE_TYPE (expr);
if (MAYBE_CLASS_TYPE_P (type) && TREE_CODE (expr) != TARGET_EXPR)
{
- vec<tree, va_gc> *args = make_tree_vector_single (expr);
+ releasing_vec args (make_tree_vector_single (expr));
expr = build_special_member_call (NULL_TREE, complete_ctor_identifier,
&args, type, LOOKUP_NORMAL, complain);
- release_tree_vector (args);
expr = build_cplus_new (type, expr, complain);
}
else
ctor = build_user_type_conversion (type, ctor, flags, complain);
else
{
- vec<tree, va_gc> *ctor_vec = make_tree_vector_single (ctor);
+ releasing_vec ctor_vec (make_tree_vector_single (ctor));
ctor = build_special_member_call (NULL_TREE,
complete_ctor_identifier,
&ctor_vec,
type, flags, complain);
- release_tree_vector (ctor_vec);
}
if (ctor)
return build_cplus_new (type, ctor, complain);
}
else
{
- vec<tree,va_gc> *args = make_tree_vector_single (e);
+ releasing_vec args (make_tree_vector_single (e));
fns = lookup_template_function (get__identifier, targs);
fns = perform_koenig_lookup (fns, args, tf_warning_or_error);
return finish_call_expr (fns, &args, /*novirt*/false,
if (CLASS_TYPE_P (temp_type))
{
int flags = LOOKUP_NORMAL | LOOKUP_ONLYCONVERTING;
- vec<tree, va_gc> *exp_vec;
bool converted = false;
/* Under C++0x [12.8/16 class.copy], a thrown lvalue is sometimes
&& !CP_TYPE_VOLATILE_P (TREE_TYPE (exp)))
{
tree moved = move (exp);
- exp_vec = make_tree_vector_single (moved);
+ releasing_vec exp_vec (make_tree_vector_single (moved));
moved = (build_special_member_call
(object, complete_ctor_identifier, &exp_vec,
TREE_TYPE (object), flags|LOOKUP_PREFER_RVALUE,
tf_none));
- release_tree_vector (exp_vec);
if (moved != error_mark_node)
{
exp = moved;
/* Call the copy constructor. */
if (!converted)
{
- exp_vec = make_tree_vector_single (exp);
+ releasing_vec exp_vec (make_tree_vector_single (exp));
exp = (build_special_member_call
(object, complete_ctor_identifier, &exp_vec,
TREE_TYPE (object), flags, tf_warning_or_error));
- release_tree_vector (exp_vec);
}
if (exp == error_mark_node)
reference member in a constructor’s ctor-initializer (12.6.2)
persists until the constructor exits." */
unsigned i; tree t;
- vec<tree, va_gc> *cleanups = make_tree_vector ();
+ releasing_vec cleanups;
if (TREE_CODE (init) == TREE_LIST)
init = build_x_compound_expr_from_list (init, ELK_MEM_INIT,
tf_warning_or_error);
finish_expr_stmt (init);
FOR_EACH_VEC_ELT (*cleanups, i, t)
push_cleanup (decl, t, false);
- release_tree_vector (cleanups);
}
else if (type_build_ctor_call (type)
|| (init && CLASS_TYPE_P (strip_array_types (type))))
tree elt; unsigned i;
/* Unshare the arguments for the second call. */
- vec<tree, va_gc> *parms2 = make_tree_vector ();
+ releasing_vec parms2;
FOR_EACH_VEC_SAFE_ELT (parms, i, elt)
{
elt = break_out_target_exprs (elt);
&parms2, binfo, flags,
complain);
complete = fold_build_cleanup_point_expr (void_type_node, complete);
- release_tree_vector (parms2);
base = build_special_member_call (exp, base_ctor_identifier,
&parms, binfo, flags,
BINFO_BASE_ITERATE (binfo, i, base_binfo); i++)
{
tree converted_parm;
- vec<tree, va_gc> *parmvec;
/* We must convert PARM directly to the base class
explicitly since the base class may be ambiguous. */
if (move_p)
converted_parm = move (converted_parm);
/* Call the base class assignment operator. */
- parmvec = make_tree_vector_single (converted_parm);
+ releasing_vec parmvec (make_tree_vector_single (converted_parm));
finish_expr_stmt
(build_special_member_call (current_class_ref,
assign_op_identifier,
base_binfo,
flags,
tf_warning_or_error));
- release_tree_vector (parmvec);
}
/* Assign to each of the non-static data members. */
tsubst_flags_t complain)
{
tree ob, fn, fns, binfo, rval;
- vec<tree, va_gc> *args;
if (TYPE_P (type))
binfo = TYPE_BINFO (type);
}
ob = build_stub_object (cp_build_reference_type (type, false));
- args = make_tree_vector ();
+ releasing_vec args;
if (argtype)
{
if (TREE_CODE (argtype) == TREE_LIST)
fns = lookup_fnfields (binfo, name, 0);
rval = build_new_method_call (ob, fns, &args, binfo, flags, &fn, complain);
- release_tree_vector (args);
if (fn && rval == error_mark_node)
return rval;
else
/* Build up a call to the user-defined operator */
/* Lookup the name we got back from the id-expression. */
- vec<tree, va_gc> *args = make_tree_vector ();
+ releasing_vec args;
vec_safe_push (args, value);
decl = lookup_literal_operator (name, args);
if (!decl || decl == error_mark_node)
{
error ("unable to find character literal operator %qD with %qT argument",
name, TREE_TYPE (value));
- release_tree_vector (args);
return error_mark_node;
}
result = finish_call_expr (decl, &args, false, true, tf_warning_or_error);
- release_tree_vector (args);
return result;
}
tree num_string = USERDEF_LITERAL_NUM_STRING (literal);
tree name = cp_literal_operator_id (IDENTIFIER_POINTER (suffix_id));
tree decl, result;
- vec<tree, va_gc> *args;
/* Look for a literal operator taking the exact type of numeric argument
as the literal value. */
- args = make_tree_vector ();
+ releasing_vec args;
vec_safe_push (args, value);
decl = lookup_literal_operator (name, args);
if (decl && decl != error_mark_node)
"floating literal truncated to zero");
}
- release_tree_vector (args);
return result;
}
- release_tree_vector (args);
/* If the numeric argument didn't work, look for a raw literal
operator taking a const char* argument consisting of the number
in string format. */
- args = make_tree_vector ();
+ args->truncate (0);
vec_safe_push (args, num_string);
decl = lookup_literal_operator (name, args);
if (decl && decl != error_mark_node)
{
result = finish_call_expr (decl, &args, false, true,
tf_warning_or_error);
- release_tree_vector (args);
return result;
}
- release_tree_vector (args);
/* If the raw literal didn't work, look for a non-type template
function with parameter pack char.... Call the function with
template parameter characters representing the number. */
- args = make_tree_vector ();
+ args->truncate (0);
decl = lookup_literal_operator (name, args);
if (decl && decl != error_mark_node)
{
decl = lookup_template_function (decl, tmpl_args);
result = finish_call_expr (decl, &args, false, true,
tf_warning_or_error);
- release_tree_vector (args);
return result;
}
- release_tree_vector (args);
-
/* In C++14 the standard library defines complex number suffixes that
conflict with GNU extensions. Prefer them if <complex> is #included. */
bool ext = cpp_get_options (parse_in)->ext_numeric_literals;
/* Build up a call to the user-defined operator. */
/* Lookup the name we got back from the id-expression. */
- releasing_vec rargs;
- vec<tree, va_gc> *&args = rargs.get_ref();
+ releasing_vec args;
vec_safe_push (args, value);
vec_safe_push (args, build_int_cst (size_type_node, len));
decl = lookup_literal_operator (name, args);
else
{
/* Use global functions with ADL. */
- vec<tree, va_gc> *vec;
- vec = make_tree_vector ();
+ releasing_vec vec;
vec_safe_push (vec, range);
tf_warning_or_error);
*end = finish_call_expr (member_end, &vec, false, true,
tf_warning_or_error);
-
- release_tree_vector (vec);
}
/* Last common checks. */
cp_parser_range_for_member_function (tree range, tree identifier)
{
tree member, res;
- vec<tree, va_gc> *vec;
member = finish_class_member_access_expr (range, identifier,
false, tf_warning_or_error);
if (member == error_mark_node)
return error_mark_node;
- vec = make_tree_vector ();
+ releasing_vec vec;
res = finish_call_expr (member, &vec,
/*disallow_virtual=*/false,
/*koenig_p=*/false,
tf_warning_or_error);
- release_tree_vector (vec);
return res;
}
static tree
cp_parser_omp_for_loop_init (cp_parser *parser,
tree &this_pre_body,
- vec<tree, va_gc> *&for_block,
+ releasing_vec &for_block,
tree &init,
tree &orig_init,
tree &decl,
location_t loc_first;
bool collapse_err = false;
int i, collapse = 1, ordered = 0, count, nbraces = 0;
- vec<tree, va_gc> *for_block = make_tree_vector ();
+ releasing_vec for_block;
auto_vec<tree, 4> orig_inits;
bool tiling = false;
else
add_stmt (t);
}
- release_tree_vector (for_block);
return ret;
}
case CALL_EXPR:
{
tree function;
- vec<tree, va_gc> *call_args;
unsigned int nargs, i;
bool qualified_p;
bool koenig_p;
}
nargs = call_expr_nargs (t);
- call_args = make_tree_vector ();
+ releasing_vec call_args;
for (i = 0; i < nargs; ++i)
{
tree arg = CALL_EXPR_ARG (t, i);
if (CLASS_TYPE_P (TREE_TYPE (ret)))
CALL_EXPR_RETURN_SLOT_OPT (ret) = true;
- release_tree_vector (call_args);
RETURN (ret);
}
(function, args, complain, in_decl, true,
integral_constant_expression_p));
if (unq == error_mark_node)
- {
- release_tree_vector (call_args);
- RETURN (error_mark_node);
- }
+ RETURN (error_mark_node);
if (unq != function)
{
"%qD declared here, later in the "
"translation unit", fn);
if (in_lambda)
- {
- release_tree_vector (call_args);
- RETURN (error_mark_node);
- }
+ RETURN (error_mark_node);
}
function = unq;
{
if (complain & tf_error)
unqualified_name_lookup_error (function);
- release_tree_vector (call_args);
RETURN (error_mark_node);
}
}
if (function != NULL_TREE
&& DECL_P (function)
&& !mark_used (function, complain) && !(complain & tf_error))
- {
- release_tree_vector (call_args);
- RETURN (error_mark_node);
- }
+ RETURN (error_mark_node);
/* Put back tf_decltype for the actual call. */
complain |= decltype_flag;
complain, in_decl),
complain);
if (TREE_CODE (ret) == VIEW_CONVERT_EXPR)
- {
- release_tree_vector (call_args);
- RETURN (ret);
- }
+ RETURN (ret);
break;
default:
koenig_p,
complain);
- release_tree_vector (call_args);
-
if (ret != error_mark_node)
{
bool op = CALL_EXPR_OPERATOR_SYNTAX (t);
bool try_list_ctor = false;
- vec<tree,va_gc> *args;
+ releasing_vec rv_args = NULL;
+ vec<tree,va_gc> *&args = *&rv_args;
if (init == NULL_TREE
|| TREE_CODE (init) == TREE_LIST)
args = make_tree_vector_from_list (init);
"for copy-initialization");
}
- release_tree_vector (args);
-
return cp_build_qualified_type (TREE_TYPE (call), cp_type_quals (ptype));
}
|| !NON_UNION_CLASS_TYPE_P (type))
return make_tree_vec (0);
- vec<tree, va_gc> *vector = make_tree_vector ();
+ releasing_vec vector;
vec<tree, va_gc> *base_binfos = BINFO_BASE_BINFOS (TYPE_BINFO (type));
tree binfo;
unsigned i;
for (i = 0; i < vector->length (); ++i)
TREE_VEC_ELT (bases_vec, i) = BINFO_TYPE ((*vector)[i]);
- release_tree_vector (vector);
return bases_vec;
}
|| !NON_UNION_CLASS_TYPE_P (type))
return make_tree_vec (0);
- vec<tree, va_gc> *vector = make_tree_vector ();
+ releasing_vec vector;
tree bases_vec = NULL_TREE;
unsigned i;
vec<tree, va_gc> *vbases;
- vec<tree, va_gc> *nonvbases;
tree binfo;
/* First go through virtual base classes */
for (vbases = CLASSTYPE_VBASECLASSES (type), i = 0;
vec_safe_iterate (vbases, i, &binfo); i++)
{
- vec<tree, va_gc> *vbase_bases
+ releasing_vec vbase_bases
= calculate_bases_helper (BINFO_TYPE (binfo));
vec_safe_splice (vector, vbase_bases);
- release_tree_vector (vbase_bases);
}
/* Now for the non-virtual bases */
- nonvbases = calculate_bases_helper (type);
+ releasing_vec nonvbases = calculate_bases_helper (type);
vec_safe_splice (vector, nonvbases);
- release_tree_vector (nonvbases);
/* Note that during error recovery vector->length can even be zero. */
if (vector->length () > 1)
else
bases_vec = make_tree_vec (0);
- release_tree_vector (vector);
return bases_vec;
}
finish_omp_barrier (void)
{
tree fn = builtin_decl_explicit (BUILT_IN_GOMP_BARRIER);
- vec<tree, va_gc> *vec = make_tree_vector ();
+ releasing_vec vec;
tree stmt = finish_call_expr (fn, &vec, false, false, tf_warning_or_error);
- release_tree_vector (vec);
finish_expr_stmt (stmt);
}
finish_omp_flush (int mo)
{
tree fn = builtin_decl_explicit (BUILT_IN_SYNC_SYNCHRONIZE);
- vec<tree, va_gc> *vec = make_tree_vector ();
+ releasing_vec vec;
if (mo != MEMMODEL_LAST)
{
fn = builtin_decl_explicit (BUILT_IN_ATOMIC_THREAD_FENCE);
vec->quick_push (build_int_cst (integer_type_node, mo));
}
tree stmt = finish_call_expr (fn, &vec, false, false, tf_warning_or_error);
- release_tree_vector (vec);
finish_expr_stmt (stmt);
}
finish_omp_taskwait (void)
{
tree fn = builtin_decl_explicit (BUILT_IN_GOMP_TASKWAIT);
- vec<tree, va_gc> *vec = make_tree_vector ();
+ releasing_vec vec;
tree stmt = finish_call_expr (fn, &vec, false, false, tf_warning_or_error);
- release_tree_vector (vec);
finish_expr_stmt (stmt);
}
finish_omp_taskyield (void)
{
tree fn = builtin_decl_explicit (BUILT_IN_GOMP_TASKYIELD);
- vec<tree, va_gc> *vec = make_tree_vector ();
+ releasing_vec vec;
tree stmt = finish_call_expr (fn, &vec, false, false, tf_warning_or_error);
- release_tree_vector (vec);
finish_expr_stmt (stmt);
}
"%<parallel%>, %<for%>, %<sections%> or %<taskgroup%> clauses");
return;
}
- vec<tree, va_gc> *vec = make_tree_vector ();
+ releasing_vec vec;
tree ifc = omp_find_clause (clauses, OMP_CLAUSE_IF);
if (ifc != NULL_TREE)
{
vec->quick_push (build_int_cst (integer_type_node, mask));
vec->quick_push (ifc);
tree stmt = finish_call_expr (fn, &vec, false, false, tf_warning_or_error);
- release_tree_vector (vec);
finish_expr_stmt (stmt);
}
"%<parallel%>, %<for%>, %<sections%> or %<taskgroup%> clauses");
return;
}
- vec<tree, va_gc> *vec
+ releasing_vec vec
= make_tree_vector_single (build_int_cst (integer_type_node, mask));
tree stmt = finish_call_expr (fn, &vec, false, false, tf_warning_or_error);
- release_tree_vector (vec);
finish_expr_stmt (stmt);
}
\f
build_vec_init_elt (tree type, tree init, tsubst_flags_t complain)
{
tree inner_type = strip_array_types (type);
- vec<tree, va_gc> *argvec;
if (integer_zerop (array_type_nelts_total (type))
|| !CLASS_TYPE_P (inner_type))
|| (same_type_ignoring_top_level_qualifiers_p
(type, TREE_TYPE (init))));
- argvec = make_tree_vector ();
+ releasing_vec argvec;
if (init)
{
tree init_type = strip_array_types (TREE_TYPE (init));
init = build_special_member_call (NULL_TREE, complete_ctor_identifier,
&argvec, inner_type, LOOKUP_NORMAL,
complain);
- release_tree_vector (argvec);
/* For a trivial constructor, build_over_call creates a TARGET_EXPR. But
we don't want one here because we aren't creating a temporary. */
if (TREE_CODE (t) == TREE_LIST)
{
bool changed = false;
- vec<tree,va_gc> *vec = make_tree_vector ();
+ releasing_vec vec;
tree r = t;
for (; t; t = TREE_CHAIN (t))
{
}
if (changed)
r = build_tree_list_vec (vec);
- release_tree_vector (vec);
return r;
}
case TREE_LIST:
{
- vec<tree, va_gc> *vec = make_tree_vector ();
+ releasing_vec vec;
bool changed = false;
tree it;
for (it = t; it; it = TREE_CHAIN (it))
}
else
r = t;
- release_tree_vector (vec);
return r;
}
case TREE_VEC:
{
bool changed = false;
- vec<tree, va_gc> *vec = make_tree_vector ();
+ releasing_vec vec;
n = TREE_VEC_LENGTH (t);
vec_safe_reserve (vec, n);
for (i = 0; i < n; ++i)
}
else
r = t;
- release_tree_vector (vec);
return r;
}
va_list p;
int nargs, expected_nargs;
tree fn, call;
- vec<tree, va_gc> *args;
non_dep = extract_call_expr (non_dep);
expected_nargs += 1;
gcc_assert (nargs == expected_nargs);
- args = make_tree_vector ();
+ releasing_vec args;
va_start (p, overload);
if (TREE_CODE (TREE_TYPE (overload)) == FUNCTION_TYPE)
va_end (p);
call = build_min_non_dep_call_vec (non_dep, fn, args);
- release_tree_vector (args);
tree call_expr = extract_call_expr (call);
KOENIG_LOOKUP_P (call_expr) = KOENIG_LOOKUP_P (non_dep);
static tree
cp_build_function_call (tree function, tree params, tsubst_flags_t complain)
{
- vec<tree, va_gc> *vec;
tree ret;
- vec = make_tree_vector ();
+ releasing_vec vec;
for (; params != NULL_TREE; params = TREE_CHAIN (params))
vec_safe_push (vec, TREE_VALUE (params));
ret = cp_build_function_call_vec (function, &vec, complain);
- release_tree_vector (vec);
return ret;
}
tree
cp_build_function_call_nary (tree function, tsubst_flags_t complain, ...)
{
- vec<tree, va_gc> *vec;
va_list args;
tree ret, t;
- vec = make_tree_vector ();
+ releasing_vec vec;
va_start (args, complain);
for (t = va_arg (args, tree); t != NULL_TREE; t = va_arg (args, tree))
vec_safe_push (vec, t);
va_end (args);
ret = cp_build_function_call_vec (function, &vec, complain);
- release_tree_vector (vec);
return ret;
}
/* Do the default thing. */;
else
{
- vec<tree, va_gc> *rhs_vec = make_tree_vector_single (rhs);
+ releasing_vec rhs_vec = make_tree_vector_single (rhs);
result = build_special_member_call (lhs, complete_ctor_identifier,
&rhs_vec, lhstype, LOOKUP_NORMAL,
complain);
- release_tree_vector (rhs_vec);
if (result == NULL_TREE)
return error_mark_node;
goto ret;
/* The type to which we are casting. */
tree type;
- vec<tree, va_gc> *parmvec;
if (error_operand_p (exp) || parms == error_mark_node)
return error_mark_node;
}
/* Call the constructor. */
- parmvec = make_tree_vector ();
+ releasing_vec parmvec;
for (; parms != NULL_TREE; parms = TREE_CHAIN (parms))
vec_safe_push (parmvec, TREE_VALUE (parms));
exp = build_special_member_call (NULL_TREE, complete_ctor_identifier,
&parmvec, type, LOOKUP_NORMAL, complain);
- release_tree_vector (parmvec);
if (exp == error_mark_node)
return error_mark_node;