public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Simon Marchi <simon.marchi@ericsson.com>
Cc: Tom Tromey <tom@tromey.com>,  <gdb-patches@sourceware.org>
Subject: Re: [RFA] C++-ify parser_state
Date: Thu, 30 Nov 2017 03:29:00 -0000	[thread overview]
Message-ID: <878teov3zz.fsf@tromey.com> (raw)
In-Reply-To: <82650820-b9f1-c45f-2243-89b47ec00e59@ericsson.com> (Simon	Marchi's message of "Mon, 27 Nov 2017 11:40:52 -0500")

>>>>> "Simon" == Simon Marchi <simon.marchi@ericsson.com> writes:

>> +  /* Ensure that we don't free it in the destructor.  */
>> +  expout = nullptr;
>> +  return result;

Simon> If expout was an expression_up, we could just std::move it here, and
Simon> wouldn't need an explicit destructor.

I thought that looked somewhat difficult due to the use of xrealloc when
growing the expression.

Really, of course, the whole expression structure needs to be redone.
That's a big task though.

>> -  lang->la_post_parser (&ps.expout, void_context_p);
>> +  lang->la_post_parser (&result, void_context_p);

Simon> Passing a pointer or reference to the unique_ptr would allow
Simon> the implementations of la_post_parser to modify it directly,
Simon> and avoid the .release ().release ().

I'll look into it.
The realloc thing may be an issue here as well.

>> p.saved_arg = *arg;
>> p.arg = *arg;
>> p.arg_type = atype;
>> -  p.gdbarch = gdbarch;
>> -  p.inside_paren_p = 0;

Simon> Why not pass the other arguments to the constructor (*arg and atype)?

Yeah, this one I'll do for sure.

Tom

  reply	other threads:[~2017-11-30  3:29 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-26 17:40 Tom Tromey
2017-11-27 14:17 ` Sergio Durigan Junior
2017-11-27 16:41 ` Simon Marchi
2017-11-30  3:29   ` Tom Tromey [this message]
2017-11-30  3:54     ` Simon Marchi
2017-11-30  5:49       ` Simon Marchi
2017-12-09  4:41         ` Tom Tromey
2017-12-10 21:23           ` Simon Marchi
2017-12-31  0:04             ` 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=878teov3zz.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb-patches@sourceware.org \
    --cc=simon.marchi@ericsson.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).