This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 1/9] Change `file_symtabs' to std::vector
>>>>> "Keith" == Keith Seitz <keiths@redhat.com> writes:
Keith> This patch changes the `file_symtabs' members in linespec.c structures from
Keith> a VEC to a std::vector, eliminating a cleanup in the process.
Thank you for doing this.
As you know, cleanup removal is something I'm very fond of.
Keith> +typedef std::unique_ptr<std::vector<symtab *>> symtab_vector_up;
Keith> + std::vector<symtab *> *file_symtabs;
It took me a while to figure out why these were pointers and not just
ordinary vectors. But in the end I agree with the decision -- we can
always do later passes to clean things up even more, and my own
experience C++-ifying linespec was that it's all too tangled to do in
one big go.
Keith> -static VEC (symtab_ptr) *
Keith> +static std::vector<symtab *> *
Keith> collect_symtabs_from_filename (const char *file,
Keith> struct program_space *pspace);
IIUC, this transfers ownership of the symtab_vector_up from the
collector to the caller. So how about having this,
symtabs_from_filename, and symtab_collector::release_symbols return a
symtab_vector_up instead? That would make the ownership transfer part
of the API.
Tom