diff options
Diffstat (limited to 'gcc/cp/typeck.c')
-rw-r--r-- | gcc/cp/typeck.c | 57 |
1 files changed, 28 insertions, 29 deletions
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 5d8c27d534c..1cbab617167 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -59,7 +59,7 @@ static bool casts_away_constness (tree, tree, tsubst_flags_t); static void maybe_warn_about_returning_address_of_local (tree); static tree lookup_destructor (tree, tree, tree); static void warn_args_num (location_t, tree, bool); -static int convert_arguments (tree, VEC(tree,gc) **, tree, int, +static int convert_arguments (tree, vec<tree, va_gc> **, tree, int, tsubst_flags_t); /* Do `exp = require_complete_type (exp);' to make sure exp @@ -3270,10 +3270,10 @@ build_function_call (location_t /*loc*/, /* Used by the C-common bits. */ tree build_function_call_vec (location_t /*loc*/, - tree function, VEC(tree,gc) *params, - VEC(tree,gc) * /*origtypes*/) + tree function, vec<tree, va_gc> *params, + vec<tree, va_gc> * /*origtypes*/) { - VEC(tree,gc) *orig_params = params; + vec<tree, va_gc> *orig_params = params; tree ret = cp_build_function_call_vec (function, ¶ms, tf_warning_or_error); @@ -3290,12 +3290,12 @@ build_function_call_vec (location_t /*loc*/, tree cp_build_function_call (tree function, tree params, tsubst_flags_t complain) { - VEC(tree,gc) *vec; + vec<tree, va_gc> *vec; tree ret; vec = make_tree_vector (); for (; params != NULL_TREE; params = TREE_CHAIN (params)) - VEC_safe_push (tree, gc, vec, TREE_VALUE (params)); + vec_safe_push (vec, TREE_VALUE (params)); ret = cp_build_function_call_vec (function, &vec, complain); release_tree_vector (vec); return ret; @@ -3306,14 +3306,14 @@ cp_build_function_call (tree function, tree params, tsubst_flags_t complain) tree cp_build_function_call_nary (tree function, tsubst_flags_t complain, ...) { - VEC(tree,gc) *vec; + vec<tree, va_gc> *vec; va_list args; tree ret, t; vec = make_tree_vector (); va_start (args, complain); for (t = va_arg (args, tree); t != NULL_TREE; t = va_arg (args, tree)) - VEC_safe_push (tree, gc, vec, t); + vec_safe_push (vec, t); va_end (args); ret = cp_build_function_call_vec (function, &vec, complain); release_tree_vector (vec); @@ -3325,7 +3325,7 @@ cp_build_function_call_nary (tree function, tsubst_flags_t complain, ...) PARAMS. */ tree -cp_build_function_call_vec (tree function, VEC(tree,gc) **params, +cp_build_function_call_vec (tree function, vec<tree, va_gc> **params, tsubst_flags_t complain) { tree fntype, fndecl; @@ -3334,14 +3334,13 @@ cp_build_function_call_vec (tree function, VEC(tree,gc) **params, int nargs; tree *argarray; tree parm_types; - VEC(tree,gc) *allocated = NULL; + vec<tree, va_gc> *allocated = NULL; tree ret; /* For Objective-C, convert any calls via a cast to OBJC_TYPE_REF expressions, like those used for ObjC messenger dispatches. */ - if (params != NULL && !VEC_empty (tree, *params)) - function = objc_rewrite_function_call (function, - VEC_index (tree, *params, 0)); + if (params != NULL && !vec_safe_is_empty (*params)) + function = objc_rewrite_function_call (function, (**params)[0]); /* build_c_cast puts on a NOP_EXPR to make the result not an lvalue. Strip such NOP_EXPRs, since FUNCTION is used in non-lvalue context. */ @@ -3421,7 +3420,7 @@ cp_build_function_call_vec (tree function, VEC(tree,gc) **params, if (nargs < 0) return error_mark_node; - argarray = VEC_address (tree, *params); + argarray = (*params)->address (); /* Check for errors in format strings and inappropriately null parameters. */ @@ -3499,7 +3498,7 @@ warn_args_num (location_t loc, tree fndecl, bool too_many_p) default arguments, if such were specified. Do so here. */ static int -convert_arguments (tree typelist, VEC(tree,gc) **values, tree fndecl, +convert_arguments (tree typelist, vec<tree, va_gc> **values, tree fndecl, int flags, tsubst_flags_t complain) { tree typetail; @@ -3509,11 +3508,11 @@ convert_arguments (tree typelist, VEC(tree,gc) **values, tree fndecl, flags |= LOOKUP_ONLYCONVERTING; for (i = 0, typetail = typelist; - i < VEC_length (tree, *values); + i < vec_safe_length (*values); i++) { tree type = typetail ? TREE_VALUE (typetail) : 0; - tree val = VEC_index (tree, *values, i); + tree val = (**values)[i]; if (val == error_mark_node || type == error_mark_node) return -1; @@ -3575,7 +3574,7 @@ convert_arguments (tree typelist, VEC(tree,gc) **values, tree fndecl, if (parmval == error_mark_node) return -1; - VEC_replace (tree, *values, i, parmval); + (**values)[i] = parmval; } else { @@ -3588,7 +3587,7 @@ convert_arguments (tree typelist, VEC(tree,gc) **values, tree fndecl, else val = convert_arg_to_ellipsis (val, complain); - VEC_replace (tree, *values, i, val); + (**values)[i] = val; } if (typetail) @@ -3617,7 +3616,7 @@ convert_arguments (tree typelist, VEC(tree,gc) **values, tree fndecl, if (parmval == error_mark_node) return -1; - VEC_safe_push (tree, gc, *values, parmval); + vec_safe_push (*values, parmval); typetail = TREE_CHAIN (typetail); /* ends with `...'. */ if (typetail == NULL_TREE) @@ -5880,13 +5879,13 @@ build_x_compound_expr_from_list (tree list, expr_list_kind exp, /* Like build_x_compound_expr_from_list, but using a VEC. */ tree -build_x_compound_expr_from_vec (VEC(tree,gc) *vec, const char *msg, +build_x_compound_expr_from_vec (vec<tree, va_gc> *vec, const char *msg, tsubst_flags_t complain) { - if (VEC_empty (tree, vec)) + if (vec_safe_is_empty (vec)) return NULL_TREE; - else if (VEC_length (tree, vec) == 1) - return VEC_index (tree, vec, 0); + else if (vec->length () == 1) + return (*vec)[0]; else { tree expr; @@ -5903,8 +5902,8 @@ build_x_compound_expr_from_vec (VEC(tree,gc) *vec, const char *msg, return error_mark_node; } - expr = VEC_index (tree, vec, 0); - for (ix = 1; VEC_iterate (tree, vec, ix, t); ++ix) + expr = (*vec)[0]; + for (ix = 1; vec->iterate (ix, &t); ++ix) expr = build_x_compound_expr (EXPR_LOCATION (t), expr, t, complain); @@ -7090,7 +7089,7 @@ cp_build_modify_expr (tree lhs, enum tree_code modifycode, tree rhs, /* Do the default thing. */; else { - VEC(tree,gc) *rhs_vec = make_tree_vector_single (rhs); + vec<tree, va_gc> *rhs_vec = make_tree_vector_single (rhs); result = build_special_member_call (lhs, complete_ctor_identifier, &rhs_vec, lhstype, LOOKUP_NORMAL, complain); @@ -7457,7 +7456,7 @@ build_ptrmemfunc1 (tree type, tree delta, tree pfn) tree u = NULL_TREE; tree delta_field; tree pfn_field; - VEC(constructor_elt, gc) *v; + vec<constructor_elt, va_gc> *v; /* Pull the FIELD_DECLs out of the type. */ pfn_field = TYPE_FIELDS (type); @@ -7470,7 +7469,7 @@ build_ptrmemfunc1 (tree type, tree delta, tree pfn) pfn = fold_convert (TREE_TYPE (pfn_field), pfn); /* Finish creating the initializer. */ - v = VEC_alloc(constructor_elt, gc, 2); + vec_alloc (v, 2); CONSTRUCTOR_APPEND_ELT(v, pfn_field, pfn); CONSTRUCTOR_APPEND_ELT(v, delta_field, delta); u = build_constructor (type, v); |