Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@false.org>
To: Keith Seitz <keiths@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFA] Add method overload resolution to expression parser
Date: Tue, 13 Oct 2009 21:24:00 -0000	[thread overview]
Message-ID: <20091013212426.GA26169@caradoc.them.org> (raw)
In-Reply-To: <4A9D628B.1070300@redhat.com>

On Tue, Sep 01, 2009 at 11:06:03AM -0700, Keith Seitz wrote:
> +/* Cleanup for 'nonempty_typelist' */
> +static struct cleanup *typelist_cleanup;

Does this cleanup get more complicated uses?  As it stands after this
patch, it's just a more confusing way to write a call to free.  IMO
having cleanups created inside the parser is confusing.

> +/* Constructs a fake method with the given parameter types.  This is
> +   used to do overload resolution by the expression parser.  The
> +   logical counterpart is compare_parameters in valops.c.  */
> +
> +static struct type *
> +make_params (int num_types, struct type **param_types)
> +{
> +  struct type *type = XZALLOC (struct type);
> +  TYPE_MAIN_TYPE (type) = XZALLOC (struct main_type);
> +  TYPE_LENGTH (type) = 1;
> +  TYPE_CODE (type) = TYPE_CODE_METHOD;
> +  TYPE_VPTR_FIELDNO (type) = -1;
> +  TYPE_CHAIN (type) = type;
> +  TYPE_NFIELDS (type) = num_types;
> +  TYPE_FIELDS (type) = (struct field *)
> +    TYPE_ZALLOC (type, sizeof (struct field) * num_types);
> +
> +  while (num_types-- > 0)
> +    TYPE_FIELD_TYPE (type, num_types) = param_types[num_types];
> +
> +  make_cleanup (free_param_types, type);
> +  return type;
> +}

And this is even more confusing... how does this cleanup eventually
get run?  We shouldn't leak it back to the top level.  And I suspect
that since nothing ever copies types, if this type makes it into the
value history we're going to have a problem.

I also wonder why TYPE_INSTANCE is necesary.  All it seems to do is
construct the temporary type.  Can't we do that in the parser,
instead, and use UNOP_CAST?

-- 
Daniel Jacobowitz
CodeSourcery


  parent reply	other threads:[~2009-10-13 21:24 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-01 18:06 Keith Seitz
2009-09-24 19:30 ` Keith Seitz
2009-10-13 21:24 ` Tom Tromey
2009-11-09 21:55   ` Keith Seitz
2009-11-09 22:22     ` Tom Tromey
2009-11-09 23:35       ` Keith Seitz
2009-11-10 19:14         ` Daniel Jacobowitz
2009-11-10 22:19           ` Keith Seitz
2009-10-13 21:24 ` Daniel Jacobowitz [this message]
2009-10-14 18:54   ` Tom Tromey
2009-10-14 19:17     ` Daniel Jacobowitz
2009-10-14 19:29       ` Tom Tromey

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=20091013212426.GA26169@caradoc.them.org \
    --to=drow@false.org \
    --cc=gdb-patches@sourceware.org \
    --cc=keiths@redhat.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