Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: Keith Seitz <keiths@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFA] Add method overload resolution to expression parser
Date: Mon, 09 Nov 2009 22:22:00 -0000	[thread overview]
Message-ID: <m3bpjbe3ts.fsf@fleche.redhat.com> (raw)
In-Reply-To: <4AF88FD4.2010303@redhat.com> (Keith Seitz's message of "Mon, 09 	Nov 2009 13:55:32 -0800")

>>>>> "Keith" == Keith Seitz <keiths@redhat.com> writes:

Keith> I've attached an updated patch which I think addresses most of the
Keith> serious concerns.

Thanks.

Keith> +exp     :       exp '(' nonempty_typelist ')' const_or_volatile
Keith> +			{ int i;
Keith> +			  write_exp_elt_opcode (TYPE_INSTANCE);
Keith> +			  write_exp_elt_longcst ((LONGEST) $<ivec>3[0]);
Keith> +			  for (i = 0; i < $<ivec>3[0]; ++i)
Keith> +			    write_exp_elt_type ($<tvec>3[i + 1]);
Keith> +			  write_exp_elt_longcst((LONGEST) $<ivec>3[0]);

This is ok, because c-exp.y already does this, but the ivec/tvec
overloading still seems weird to me.

Keith> +    case TYPE_INSTANCE:
Keith> +      nargs = longest_to_int (exp->elts[pc + 1].longconst);
Keith> +      arg_types = (struct type **) alloca (nargs * sizeof (struct type *));
Keith> +      for (ix = 0; ix < nargs; ++ix)
Keith> +	arg_types[ix] = exp->elts[pc + 1 + ix + 1].type;
Keith> +
Keith> +      expect_type = make_params (nargs, arg_types);
Keith> +      *(pos) += 3 + nargs;
Keith> +      arg1 = evaluate_subexp_standard (expect_type, exp, pos, noside);
Keith> +      xfree (TYPE_FIELDS (expect_type));
Keith> +      xfree (TYPE_MAIN_TYPE (expect_type));
Keith> +      xfree (expect_type);

These frees should be done with cleanups, in case
evaluate_subexp_standard throws an exception.
I think free_param_types was ok, it was just that the cleanup was made in
a surprising place (make_params) and not run at the "right point" (just
before the end of the TYPE_INSTANCE case).

This is ok with that change.  Thanks.

Tom


  reply	other threads:[~2009-11-09 22:22 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 ` Daniel Jacobowitz
2009-10-14 18:54   ` Tom Tromey
2009-10-14 19:17     ` Daniel Jacobowitz
2009-10-14 19:29       ` Tom Tromey
2009-10-13 21:24 ` Tom Tromey
2009-11-09 21:55   ` Keith Seitz
2009-11-09 22:22     ` Tom Tromey [this message]
2009-11-09 23:35       ` Keith Seitz
2009-11-10 19:14         ` Daniel Jacobowitz
2009-11-10 22:19           ` 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=m3bpjbe3ts.fsf@fleche.redhat.com \
    --to=tromey@redhat.com \
    --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