From 2e3e0cb4304527bf4623292f6f5916cd84de5887 Mon Sep 17 00:00:00 2001 From: Keith Seitz Date: Fri, 14 Oct 2011 20:22:15 +0000 Subject: PR c++/13225 * eval.c (evaluate_subexp_standard): Do not construct an array of types; pass the value array directly to find_overload_match. * gdbtypes.h (NULL_POINTER_CONVERSION_BADNESS): Declare. (rank_function): Take an array of values instead of types. (rank_one_type): Add struct value * parameter. * gdbtypes.c (NULL_POINTER_CONVERSION_BADNESS): Define. (rank_function): For each argument, pass the argument's value to rank_one_type. (rank_one_type): Add VALUE parameter. If the parameter type is a pointer and the argument type is an integer, return NULL_POINTER_CONVERSION_BADNESS if VALUE is zero. Update all calls to rank_one_type, passing NULL for new VALUE parameter. * valarith.c (value_user_defined_cpp_op): Do not construct an array of types; pass the value array directly to find_overload_match. * valops.c (find_overload_method_list): Take an array of values instead of types. Save the type of OBJP for later use. Update calls to find_oload_champ, and find_oload_champ_namespace. (find_oload_champ_namespace): Take an array of values instead of types. (find_oload_champ_namespace_loop): Likewise. (find_oload_champ): Likewise. (classify_oload_match): Inspect all arguments until INCOMPATIBLE is found. Return the worst badness found otherwise. (compare_parameters): Update call to rank_one_type. * value.h (find_overload_match): Take an array of values instead of types. --- gdb/eval.c | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) (limited to 'gdb/eval.c') diff --git a/gdb/eval.c b/gdb/eval.c index 09564498975..5d758d1ad07 100644 --- a/gdb/eval.c +++ b/gdb/eval.c @@ -1674,13 +1674,7 @@ evaluate_subexp_standard (struct type *expect_type, func_name = (char *) alloca (name_len + 1); strcpy (func_name, &exp->elts[string_pc + 1].string); - /* Prepare list of argument types for overload resolution. */ - arg_types = (struct type **) - alloca (nargs * (sizeof (struct type *))); - for (ix = 1; ix <= nargs; ix++) - arg_types[ix - 1] = value_type (argvec[ix]); - - find_overload_match (arg_types, nargs, func_name, + find_overload_match (&argvec[1], nargs, func_name, NON_METHOD, /* not method */ 0, /* strict match */ NULL, NULL, /* pass NULL symbol since @@ -1716,13 +1710,7 @@ evaluate_subexp_standard (struct type *expect_type, evaluation. */ struct value *valp = NULL; - /* Prepare list of argument types for overload resolution. */ - arg_types = (struct type **) - alloca (nargs * (sizeof (struct type *))); - for (ix = 1; ix <= nargs; ix++) - arg_types[ix - 1] = value_type (argvec[ix]); - - (void) find_overload_match (arg_types, nargs, tstr, + (void) find_overload_match (&argvec[1], nargs, tstr, METHOD, /* method */ 0, /* strict match */ &arg2, /* the object */ @@ -1793,13 +1781,7 @@ evaluate_subexp_standard (struct type *expect_type, if (op == OP_VAR_VALUE) function = exp->elts[save_pos1+2].symbol; - /* Prepare list of argument types for overload resolution. */ - arg_types = (struct type **) - alloca (nargs * (sizeof (struct type *))); - for (ix = 1; ix <= nargs; ix++) - arg_types[ix - 1] = value_type (argvec[ix]); - - (void) find_overload_match (arg_types, nargs, + (void) find_overload_match (&argvec[1], nargs, NULL, /* no need for name */ NON_METHOD, /* not method */ 0, /* strict match */ -- cgit v1.2.1