diff options
Diffstat (limited to 'gcc/cp/decl2.c')
| -rw-r--r-- | gcc/cp/decl2.c | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 0e050dd0cf8..3f753d18bd4 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -3680,18 +3680,18 @@ cp_write_global_declarations (void) /* FN is an OFFSET_REF, DOTSTAR_EXPR or MEMBER_REF indicating the function to call in parse-tree form; it has not yet been semantically analyzed. ARGS are the arguments to the function. - They have already been semantically analyzed. */ + They have already been semantically analyzed. This may change + ARGS. */ tree -build_offset_ref_call_from_tree (tree fn, tree args) +build_offset_ref_call_from_tree (tree fn, VEC(tree,gc) **args) { tree orig_fn; - tree orig_args; + VEC(tree,gc) *orig_args = NULL; tree expr; tree object; orig_fn = fn; - orig_args = args; object = TREE_OPERAND (fn, 0); if (processing_template_decl) @@ -3699,17 +3699,19 @@ build_offset_ref_call_from_tree (tree fn, tree args) gcc_assert (TREE_CODE (fn) == DOTSTAR_EXPR || TREE_CODE (fn) == MEMBER_REF); if (type_dependent_expression_p (fn) - || any_type_dependent_arguments_p (args)) - return build_nt_call_list (fn, args); + || any_type_dependent_arguments_p (*args)) + return build_nt_call_vec (fn, *args); + + orig_args = make_tree_vector_copy (*args); /* Transform the arguments and add the implicit "this" parameter. That must be done before the FN is transformed because we depend on the form of FN. */ - args = build_non_dependent_args (args); + make_args_non_dependent (*args); object = build_non_dependent_expr (object); if (TREE_CODE (fn) == DOTSTAR_EXPR) object = cp_build_unary_op (ADDR_EXPR, object, 0, tf_warning_or_error); - args = tree_cons (NULL_TREE, object, args); + VEC_safe_insert (tree, gc, *args, 0, object); /* Now that the arguments are done, transform FN. */ fn = build_non_dependent_expr (fn); } @@ -3726,12 +3728,16 @@ build_offset_ref_call_from_tree (tree fn, tree args) tf_warning_or_error); fn = TREE_OPERAND (fn, 1); fn = get_member_function_from_ptrfunc (&object_addr, fn); - args = tree_cons (NULL_TREE, object_addr, args); + VEC_safe_insert (tree, gc, *args, 0, object_addr); } - expr = cp_build_function_call (fn, args, tf_warning_or_error); + expr = cp_build_function_call_vec (fn, args, tf_warning_or_error); if (processing_template_decl && expr != error_mark_node) - return build_min_non_dep_call_list (expr, orig_fn, orig_args); + expr = build_min_non_dep_call_vec (expr, orig_fn, orig_args); + + if (orig_args != NULL) + release_tree_vector (orig_args); + return expr; } |

