From: Daniel Berlin <dan@cgsoftware.com>
To: Keith Seitz <keiths@cygnus.com>
Cc: <gdb-patches@sources.redhat.com>
Subject: Re: [RFC] eval.c (evaluate_subexp_standard) Deal with c++ reference args
Date: Tue, 23 Oct 2001 11:46:00 -0000 [thread overview]
Message-ID: <507580B9-C7E6-11D5-9D5A-0030657B5340@cgsoftware.com> (raw)
In-Reply-To: <Pine.GSO.4.33.0110231036120.23825-100000@makita.cygnus.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)
>
>
next prev parent reply other threads:[~2001-10-23 11:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-10-23 11:40 Keith Seitz
2001-10-23 11:46 ` Daniel Berlin [this message]
2001-10-23 11:48 ` [RFC] eval.c (evaluate_subexp_standard) Deal with c++ referenceargs Keith Seitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=507580B9-C7E6-11D5-9D5A-0030657B5340@cgsoftware.com \
--to=dan@cgsoftware.com \
--cc=gdb-patches@sources.redhat.com \
--cc=keiths@cygnus.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox