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


On 2017-11-29 22:29, Tom Tromey wrote:
"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.

Agreed.

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

I think this should be enough (the commit on top):

https://github.com/simark/binutils-gdb/commits/parser_state

Simon


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