]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Add field::is_public
authorTom Tromey <tromey@adacore.com>
Thu, 21 Sep 2023 16:24:35 +0000 (10:24 -0600)
committerTom Tromey <tromey@adacore.com>
Tue, 21 Nov 2023 21:52:05 +0000 (14:52 -0700)
This adds a field::is_public convenience method, and updates one spot
to use it.

Acked-By: Simon Marchi <simon.marchi@efficios.com>
Reviewed-by: Keith Seitz <keiths@redhat.com>
gdb/gdbtypes.h

index a815834bfc30df35a0b30505837f967a6e239957..6a11f58737cdb76d9f5c13db7f8af463ae2308e0 100644 (file)
@@ -686,6 +686,10 @@ struct field
   enum accessibility accessibility () const
   { return m_accessibility; }
 
+  /* True if this field is 'public'.  */
+  bool is_public () const
+  { return m_accessibility == accessibility::PUBLIC; }
+
   /* True if this field is 'private'.  */
   bool is_private () const
   { return m_accessibility == accessibility::PRIVATE; }
@@ -1964,7 +1968,7 @@ extern void set_type_vptr_basetype (struct type *, struct type *);
 #define TYPE_BASECLASS_NAME(thistype,index) (thistype->field (index).name ())
 #define TYPE_BASECLASS_BITPOS(thistype,index) (thistype->field (index).loc_bitpos ())
 #define BASETYPE_VIA_PUBLIC(thistype, index) \
-  ((!TYPE_FIELD_PRIVATE(thistype, index)) && (!TYPE_FIELD_PROTECTED(thistype, index)))
+  ((thistype)->field (index).is_public ())
 #define TYPE_CPLUS_DYNAMIC(thistype) TYPE_CPLUS_SPECIFIC (thistype)->is_dynamic
 
 #define BASETYPE_VIA_VIRTUAL(thistype, index) \