This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA] Add method overload resolution to expression parser
- From: Tom Tromey <tromey at redhat dot com>
- To: Keith Seitz <keiths at redhat dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Tue, 13 Oct 2009 15:24:18 -0600
- Subject: Re: [RFA] Add method overload resolution to expression parser
- References: <4A9D628B.1070300@redhat.com>
- Reply-to: tromey at redhat dot com
>>>>> "Keith" == Keith Seitz <keiths@redhat.com> writes:
Keith> The attached patch is the first of several patches which will attempt
Keith> mitigate the requirement of single-quoting every single C++ expression
Keith> passed to the parser.
I have a couple of questions about this.
First, since this is an extension to C++, I wonder whether it will
introduce any parsing ambiguities once the parser is complete. I
suspect not, but I thought you might have a better view.
Keith> +exp : exp '(' nonempty_typelist ')' const_or_volatile
This is an interesting production.
I would have expected it to explicitly look for maybe-qualified
identifiers -- not an arbitrary expression. Does this let us do
something we could not otherwise do? Or, what does this do:
print (return_a_function ()) (int)
Does it work to call an explicitly-specified overload?
print overloaded(int)(5)
(I assume from reading the patch that this works as expected.)
Keith> func_mod: '(' ')'
Keith> { $$ = 0; }
Keith> | '(' nonempty_typelist ')'
Keith> - { free ($2); $$ = 0; }
Keith> + { do_cleanups (typelist_cleanup); $$ = 0; }
I'm a bit surprised that the cleanup stuff works in the parser.
Interesting.
Keith> +static void
Keith> +free_param_types (void *arg)
Needs a short intro comment.
Keith> +static struct type *
Keith> +make_params (int num_types, struct type **param_types)
[...]
Keith> + make_cleanup (free_param_types, type);
It is a little unusual to make a cleanup that isn't returned. Is it
really safe in this case? To know that, I think you'd have to examine
all callers of evaluate_subexp_standard. It seems somewhat safer to do
explicit cleanups in the TYPE_INSTANCE case, what do you think?
At the very least I think the comment for make_params should mention
this cleanup side effect.
Tom