mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-10-18 05:12:33 +08:00
Add new argument NOSIDE to find_overload_match.
This is a fix for PR c++/17132. If this new argument is set to EVAL_AVOID_SIDE_EFFECTS, then the object's memory will not be read while picking the best overload match. gdb/ * eval.c: Update all calls to find_overload_match. * valarith.c: Likewise. (value_user_defined_cpp_op, value_user_defined_op): New argument NOSIDE. Update all callers. * valops.c (find_overload_match): New argument NOSIDE. * value.h (find_overload_match): Update signature. gdb/testsuite * gdb.cp/pr17132.cc: New file. * gdb.cp/pr17132.exp: New file.
This commit is contained in:
@ -286,7 +286,7 @@ unop_user_defined_p (enum exp_opcode op, struct value *arg1)
|
||||
|
||||
static struct value *
|
||||
value_user_defined_cpp_op (struct value **args, int nargs, char *operator,
|
||||
int *static_memfuncp)
|
||||
int *static_memfuncp, enum noside noside)
|
||||
{
|
||||
|
||||
struct symbol *symp = NULL;
|
||||
@ -295,7 +295,7 @@ value_user_defined_cpp_op (struct value **args, int nargs, char *operator,
|
||||
find_overload_match (args, nargs, operator, BOTH /* could be method */,
|
||||
&args[0] /* objp */,
|
||||
NULL /* pass NULL symbol since symbol is unknown */,
|
||||
&valp, &symp, static_memfuncp, 0);
|
||||
&valp, &symp, static_memfuncp, 0, noside);
|
||||
|
||||
if (valp)
|
||||
return valp;
|
||||
@ -317,12 +317,15 @@ value_user_defined_cpp_op (struct value **args, int nargs, char *operator,
|
||||
|
||||
static struct value *
|
||||
value_user_defined_op (struct value **argp, struct value **args, char *name,
|
||||
int *static_memfuncp, int nargs)
|
||||
int *static_memfuncp, int nargs, enum noside noside)
|
||||
{
|
||||
struct value *result = NULL;
|
||||
|
||||
if (current_language->la_language == language_cplus)
|
||||
result = value_user_defined_cpp_op (args, nargs, name, static_memfuncp);
|
||||
{
|
||||
result = value_user_defined_cpp_op (args, nargs, name, static_memfuncp,
|
||||
noside);
|
||||
}
|
||||
else
|
||||
result = value_struct_elt (argp, args, name, static_memfuncp,
|
||||
"structure");
|
||||
@ -471,7 +474,7 @@ value_x_binop (struct value *arg1, struct value *arg2, enum exp_opcode op,
|
||||
}
|
||||
|
||||
argvec[0] = value_user_defined_op (&arg1, argvec + 1, tstr,
|
||||
&static_memfuncp, 2);
|
||||
&static_memfuncp, 2, noside);
|
||||
|
||||
if (argvec[0])
|
||||
{
|
||||
@ -582,7 +585,7 @@ value_x_unop (struct value *arg1, enum exp_opcode op, enum noside noside)
|
||||
}
|
||||
|
||||
argvec[0] = value_user_defined_op (&arg1, argvec + 1, tstr,
|
||||
&static_memfuncp, nargs);
|
||||
&static_memfuncp, nargs, noside);
|
||||
|
||||
if (argvec[0])
|
||||
{
|
||||
|
Reference in New Issue
Block a user