This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA] Add parsing support for C++ operators
- 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, 11 Nov 2009 08:11:59 -0700
- Subject: Re: [RFA] Add parsing support for C++ operators
- References: <4AFA0A93.7040709@redhat.com>
- Reply-to: tromey at redhat dot com
>>>>> "Keith" == Keith Seitz <keiths@redhat.com> writes:
Keith> 2009-11-10 Keith Seitz <keiths@redhat.com>
Keith> * c-expy. (operator_stoken): New function.
Keith> (OPERATOR): New token.
Keith> (NEW): New token.
Keith> (DELETE): New token.
Keith> (operator): New rule.
Keith> (name): Add operator.
Keith> (ident_tokens): Add "new", "delete", and "operator".
Keith> * gdbtypes.c (rank_one_type): Don't complain about
Keith> void pointer conversion badness if both types are
Keith> void pointers.
Keith> + | OPERATOR ptype
Keith> + { char *name;
Keith> + long length;
Keith> + struct ui_file *buf = mem_fileopen ();
Keith> +
Keith> + c_print_type ($2, NULL, buf, -1, 0);
Keith> + name = ui_file_xstrdup (buf, &length);
Keith> + ui_file_delete (buf);
Keith> + $$ = operator_stoken (name);
This leaks 'name', you need a free after the call to operator_stoken.
Keith> + /* The toplevel (c_parse) will free the memory allocated here. */
Keith> + make_cleanup (free, st.ptr);
Keith> + return st;
On irc you expressed some doubt about this approach. It is fine.
This is ok with the above change. Thanks.
Tom