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] |
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?
ChangeLog 2009-11-09 Keith Seitz <keiths@redhat.com>
* c-exp.y: Add new rule for resolving method overloads. * eval.c (make_params): New function. (evaluate_subexp_standard): Pass expect_type to value_aggregate_elt. Handle case TYPE_INSTANCE. (evaluate_subexp_for_address): Pass expect_type to value_aggregate_elt. * expression.h (enum exp_opcode): Add TYPE_INSTANCE. (compare_parameters): Add declaration. * parse.c (operator_length_standard): Add TYPE_INSTANCE. * valops.c (value_aggregate_elt): Add new expect_type parameter. Pass expect_type to value_struct_elt_for_reference. (value_struct_elt_for_reference): Add expect_type parameter and use compare_parameters. Check for overload matches with and without artificial parameters. Skip artificial methods. (compare_parameters): New function. * value.h (value_aggregate_elt): Add new expect_type parameter.
testsuite/ChangeLog 2009-11-09 Keith Seitz <keiths@redhat.com>
* gdb.cp/overload.exp: Add tests for resolving overloaded methods in expression parsing/evaluation.
Attachment:
ovld-expr-2.patch
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |