From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lndn.lancelotsix.com (lndn.lancelotsix.com [51.195.220.111]) by sourceware.org (Postfix) with ESMTPS id 8CCAF3858436 for ; Mon, 25 Sep 2023 22:32:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8CCAF3858436 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=lancelotsix.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=lancelotsix.com Received: from octopus (cust120-dsl54.idnet.net [212.69.54.120]) by lndn.lancelotsix.com (Postfix) with ESMTPSA id BE359853C0; Mon, 25 Sep 2023 22:32:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=lancelotsix.com; s=2021; t=1695681167; bh=AnI+HkV89Lx+va46rja3BEjcM9GfkLwiRGKEda7Egww=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ZhLkxQXvE2G3VkzvMUPmk8fi5r8v3zh5KI2HMLKMZU5nkRVRuYkV2NyBCphOoQAfC nUI6yAyCaOLboUwAH5dk8uDyG8uXx4gnt2YhIWv6LmIkU15QoiaMPBIUzX5YqLJJFH afLRGgMqHMLmzwNPKiTYclMO+1/MRSc+UCaNlpIZ+pi+0ZlK0aNgcUNu5Gt+8ADoHH okETYhDfANi/C8LbgJ8Y4lA4la1Es6sLt6iK9ugcE2mTl6MisEMktp6ihr4q77/lC8 keRDGTMxa+jDdFokPUGqqsSTI8yJGz/aeCUzIKkI3NYDlEe7PaewPtC8sj4BQC2guF GDJa6k02UdLwA== Date: Mon, 25 Sep 2023 23:32:41 +0100 From: Lancelot SIX To: Tom Tromey Cc: gdb-patches@sourceware.org Subject: Re: [PATCH 3/7] Remove byte vectors from cplus_struct_type Message-ID: <20230925223241.phor5lusw7jd4flf@octopus> References: <20230921-field-bits-v1-0-201285360900@adacore.com> <20230921-field-bits-v1-3-201285360900@adacore.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230921-field-bits-v1-3-201285360900@adacore.com> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.6.2 (lndn.lancelotsix.com [0.0.0.0]); Mon, 25 Sep 2023 22:32:47 +0000 (UTC) X-Spam-Status: No, score=-11.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,KAM_ASCII_DIVIDERS,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hi Tom On Thu, Sep 21, 2023 at 12:01:30PM -0600, Tom Tromey via Gdb-patches wrote: > This removes some byte vectors from cplus_struct_type, moving the > information into bitfields in holes in struct field. > --- > gdb/dwarf2/read.c | 86 +++++++------------------------------- > gdb/gdbtypes.c | 53 ----------------------- > gdb/gdbtypes.h | 118 ++++++++++++++++++++++++--------------------------- > gdb/stabsread.c | 123 +++++++++++++++++++----------------------------------- > 4 files changed, 113 insertions(+), 267 deletions(-) > > diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h > index 505c8ba12b5..c72512b8204 100644 > --- a/gdb/gdbtypes.h > +++ b/gdb/gdbtypes.h > @@ -668,6 +668,46 @@ struct field > m_loc.dwarf_block = dwarf_block; > } > > + /* True if this field is 'private'. */ > + bool is_private () const > + { return m_private; } > + > + /* Set the field's "private" flag. */ > + void set_private () > + { > + /* Can't have both. */ > + gdb_assert (!m_protected); > + m_private = true; > + } > + > + /* True if this field is 'protected'. */ > + bool is_protected () const > + { return m_protected; } > + > + /* Set the field's "protected" flag. */ > + void set_protected () > + { > + /* Can't have both. */ > + gdb_assert (!m_private); > + m_protected = true; > + } > + > + /* True if this field is 'virtual'. */ > + bool is_virtual () const > + { return m_virtual; } > + > + /* Set the field's "virtual" flag. */ > + void set_virtual () > + { m_virtual = true; } > + > + /* True if this field is 'ignored'. */ > + bool is_ignored () const > + { return m_ignored; } > + > + /* Set the field's "ignored" flag. */ > + void set_ignored () > + { m_ignored = true; } > + > union field_location m_loc; > > /* * For a function or member type, this is 1 if the argument is > @@ -677,6 +717,15 @@ struct field > > unsigned int m_artificial : 1; > > + /* Whether the field is 'private'. */ > + bool m_private : 1; > + /* Whether the field is 'protected'. */ > + bool m_protected : 1; Is there a reason I miss to not use an enum to describe the visibility? This would avoid having to verify that m_private and m_protected are mutually exclusive. Is seems to me that something similar to debug_visibility m_visibility : 2; (or a custom enum) should work. > + /* Whether the field is 'virtual'. */ > + bool m_virtual : 1; > + /* Whether the field is 'ignored'. */ > + bool m_ignored : 1; > + > /* * Discriminant for union field_location. */ > > ENUM_BITFIELD(field_loc_kind) m_loc_kind : 3; > diff --git a/gdb/stabsread.c b/gdb/stabsread.c > index 7402a26a401..9a84e5f3f80 100644 > --- a/gdb/stabsread.c > +++ b/gdb/stabsread.c > @@ -3108,11 +3115,15 @@ read_baseclasses (struct stab_field_info *fip, const char **pp, > } > ++(*pp); > > - newobj->visibility = *(*pp)++; > - switch (newobj->visibility) > + int visibility = *(*pp)++; > + switch (visibility) > { > case VISIBILITY_PRIVATE: > + newobj->field.set_private (); > + break; > case VISIBILITY_PROTECTED: > + newobj->field.set_private (); I think this should be: newobj->field.set_protected (); > + break; > case VISIBILITY_PUBLIC: > break; > default: Best, Lancelot.