Re: [RFA 14/15] Make psymtab_storage::free_psymtabs private

Simon Marchi
2018-07-18T14:36:08Z

On 2018-05-10 06:23 PM, Tom Tromey wrote:
> This adds a new psymtab allocation method to psymtab_storage and
> changes the free_psymtabs member to be private. While not strictly
> necessary, this seems like a decent cleanup, and also makes it simpler
> to move psymtabs off of obstacks entirely, should that prove
> desirable.
>
> 2018-05-10 Tom Tromey <tom@tromey.com>
>
> * psymtab.h (psymtab_storage::allocate_psymtab): New method.
> <free_psymtabs>: Now private.
> * psymtab.c (psymtab_storage::allocate_psymtab): Implement.
> (allocate_psymtab): Use new method.
> ---
> gdb/ChangeLog | 7 +++++++
> gdb/psymtab.c | 44 +++++++++++++++++++++++++-------------------
> gdb/psymtab.h | 14 ++++++++++----
> 3 files changed, 42 insertions(+), 23 deletions(-)
>
> diff --git a/gdb/psymtab.c b/gdb/psymtab.c
> index d121eace54..f109e9f1ee 100644
> --- a/gdb/psymtab.c
> +++ b/gdb/psymtab.c
> @@ -78,6 +78,29 @@ psymtab_storage::~psymtab_storage ()
> psymbol_bcache_free (psymbol_cache);
> }
>
> +/* See psymtab.h. */
> +
> +struct partial_symtab *
> +psymtab_storage::allocate_psymtab ()
> +{
> + struct partial_symtab *psymtab;
> +
> + if (free_psymtabs)

!= nullptr

Otherwise, LGTM.

Simon