This is the mail archive of the
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: Wed, 14 Oct 2009 12:54:15 -0600
- Subject: Re: [RFA] Add method overload resolution to expression parser
- References: <4A9D628B.email@example.com> <20091013212426.GA26169@caradoc.them.org>
- Reply-to: tromey at redhat dot com
>>>>> "Daniel" == Daniel Jacobowitz <firstname.lastname@example.org> writes:
Keith> +static struct type *
Keith> +make_params (int num_types, struct type **param_types)
Keith> + make_cleanup (free_param_types, type);
Keith> + return type;
Daniel> And this is even more confusing... how does this cleanup eventually
Daniel> get run? We shouldn't leak it back to the top level. And I suspect
Daniel> that since nothing ever copies types, if this type makes it into the
Daniel> value history we're going to have a problem.
I think this can be addressed by changing the TYPE_INSTANCE case to deal
with the cleanups.
Daniel> I also wonder why TYPE_INSTANCE is necesary. All it seems to do is
Daniel> construct the temporary type. Can't we do that in the parser,
Daniel> instead, and use UNOP_CAST?
My reading is that it has to do with the lifetime of a type.
This implementation defers creation of the temporary function type to
the point where it is used. IIUC, which I hope I do :-), this temporary
type can't really leak out of the TYPE_INSTANCE code. That is, it is
constructed and used to look up an actual function or method (which has
its own type).
If we used UNOP_CAST then we would have to make a long-lived temporary
type, not only because the type would have to live at least from parsing
through the end of the life of the parsed expression, but also because
the result of the cast would have that temporary type, and thus it would
This would not be as big a deal if the type GC work were finished, but
that is still pending.