Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Simon Marchi <simark@simark.ca>
To: Tom Tromey <tom@tromey.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH 1/6] Remove some manual memory management from compile interface
Date: Sun, 9 Aug 2020 18:34:05 -0400	[thread overview]
Message-ID: <6824ff00-ef2a-c1dc-8717-75111d3fd8b0@simark.ca> (raw)
In-Reply-To: <20200809135258.8207-2-tom@tromey.com>

> diff --git a/gdb/compile/compile-cplus-types.c b/gdb/compile/compile-cplus-types.c
> index 02df7ab90e6..00eaaf3fa68 100644
> --- a/gdb/compile/compile-cplus-types.c
> +++ b/gdb/compile/compile-cplus-types.c
> @@ -848,33 +848,33 @@ compile_cplus_convert_struct_or_union (compile_cplus_instance *instance,
>    gcc_type result;
>    if (type->code () == TYPE_CODE_STRUCT)
>      {
> -      struct gcc_vbase_array bases;
>        int num_baseclasses = TYPE_N_BASECLASSES (type);
> +      std::vector<gcc_type> elements (num_baseclasses);
> +      std::vector<enum gcc_cp_symbol_kind> flags (num_baseclasses);
>  
> -      memset (&bases, 0, sizeof (bases));
> +      struct gcc_vbase_array bases {};
> +      bases.elements = elements.data ();
>  
>        if (num_baseclasses > 0)

You could now remove this `if (num_baseclasses > 0)`, there's no reason for it anymore I think.

Otherwise, LGTM.

Simon


  reply	other threads:[~2020-08-09 22:34 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-09 13:52 [PATCH 0/6] Avoid manual memory management in gdb/compile/ Tom Tromey
2020-08-09 13:52 ` [PATCH 1/6] Remove some manual memory management from compile interface Tom Tromey
2020-08-09 22:34   ` Simon Marchi [this message]
2020-09-19 23:45     ` Tom Tromey
2020-09-19 23:52       ` Simon Marchi
2020-09-23 12:56         ` Tom Tromey
2020-08-09 13:52 ` [PATCH 2/6] Use new/delete for do_module_cleanup Tom Tromey
2020-08-09 22:45   ` [PP?] " Simon Marchi
2020-09-23 13:36     ` Tom Tromey
2020-08-09 13:52 ` [PATCH 3/6] Introduce and use compile_module_up Tom Tromey
2020-08-09 13:52 ` [PATCH 4/6] Transfer module ownership to do_module_cleanup Tom Tromey
2020-08-10  0:48   ` [PP?] " Simon Marchi
2020-09-23 14:55     ` Tom Tromey
2020-08-09 13:52 ` [PATCH 5/6] Simplify compile_module cleanup Tom Tromey
2020-08-09 13:52 ` [PATCH 6/6] Avoid manual memory management of argv arrays in gdb/compile Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6824ff00-ef2a-c1dc-8717-75111d3fd8b0@simark.ca \
    --to=simark@simark.ca \
    --cc=gdb-patches@sourceware.org \
    --cc=tom@tromey.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox