This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [RFC] eval.c (evaluate_subexp_standard) Deal with c++ reference args
- To: Keith Seitz <keiths at cygnus dot com>
- Subject: Re: [RFC] eval.c (evaluate_subexp_standard) Deal with c++ reference args
- From: Daniel Berlin <dan at cgsoftware dot com>
- Date: Tue, 23 Oct 2001 14:46:48 -0400
- Cc: <gdb-patches at sources dot redhat dot com>
>
Neither args[0], nor argvec[1], will always be the this pointer.
Try a static class method.
> + /* Before calling a c++ function, check that reference types are
> + passed as reference types and not something else. */
> + if (argvec[0] != NULL && exp->language_defn->la_language ==
> language_cplus)
> + {
> + struct type **args;
> + args = TYPE_ARG_TYPES (VALUE_TYPE (argvec[0]));
> + if (args != NULL)
> + {
> + /* args[0] = "this" pointer
> + args[1] = first arg type
> + argvec[0] = method
> + argvec[1] = "this" pointer
> + argvec[2] = first argument */
> + for (ix = 1; args[ix] != NULL
> + && TYPE_CODE (args[ix]) != TYPE_CODE_VOID; ix++)
> + {
> + if (TYPE_CODE (args[ix]) == TYPE_CODE_REF
> + && TYPE_CODE (VALUE_TYPE (argvec[2+ix-1])) != TYPE_CODE_REF)
> + {
> + struct value *v = value_addr (argvec[2+ix-1]);
> + argvec[2+ix-1] =
> + value_cast (lookup_reference_type (VALUE_TYPE (v)), v);
> + }
> + }
> + }
> + }
> +
> do_call_it:
>
> if (noside == EVAL_SKIP)
>
>