This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA] C++-ify parser_state


>>>>> "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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]