From patchwork Thu Sep 21 18:01:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 76540 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 949B6385CC8A for ; Thu, 21 Sep 2023 18:02:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 949B6385CC8A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1695319320; bh=vORO8vd8/a3cEcFxr6/yThA//HS+4AGgR9e+N8VzrDI=; h=Date:Subject:References:In-Reply-To:To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=b3weewNCMTd5CS86B3+pr1h5RUF1r3dz7KAiNguVF/sd86cPWnIQjumW2fo/42r4Z eoUtLrl3fzxPDt2ZTb+0vxqGbjg45UiKHMIOR3J2VGQUWbxst09CK4Uu0E6iJ7yd0l dJbgr0tkOgpxgez+1uqw0fI8XoK3ef0eQR1xQAbY= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-io1-xd32.google.com (mail-io1-xd32.google.com [IPv6:2607:f8b0:4864:20::d32]) by sourceware.org (Postfix) with ESMTPS id 596C83858407 for ; Thu, 21 Sep 2023 18:01:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 596C83858407 Received: by mail-io1-xd32.google.com with SMTP id ca18e2360f4ac-79f8b2bfb2cso27367639f.1 for ; Thu, 21 Sep 2023 11:01:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695319291; x=1695924091; h=to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vORO8vd8/a3cEcFxr6/yThA//HS+4AGgR9e+N8VzrDI=; b=u1GU1IjHCASOajCQY4MtvsbOBeIPhd7uwauarSyTIQxIuJMTyIdT28tBr5ebTPhuPX SUB7ZgeOp6sot7mbeUxZQdJwchXGFVY6W1E4+n/9TiOjYf6ctvB+yxGYN7I6HsAAb02g do2E+JLkclfZE+y7cVS9+jSlRsN5Jb6PO/ARD+/OlxptE3/679sveDczSrxnu/Px+RFm iYdKSdN96XzQvF0fZ94yBv93ge+oOea0Ogp5J193yjNtKZCmON3Wz5GbC1FRTW6TlkPo Cz4I2bOrKG/x7YwILUr84w2dNU01ACZyLLFPy9WrsnMQAWg0o2YndSwcvgljpG8YoKXM bSIw== X-Gm-Message-State: AOJu0YwqVnwBELTpXkQIngC0uAiUc47BN9a11YjX7N/peFeRoMVNzO/V /t9oO/vr0+m5unim5Hinrc3MXwIm9ZOWah34zLGKCQ== X-Google-Smtp-Source: AGHT+IEH2iikDlhj/9wi1fcX76kK7KjY+iE+Uamzrj33apkbSeEI8AQW5pYS131TIPSU16eaqA5FbA== X-Received: by 2002:a05:6602:256a:b0:780:c787:637b with SMTP id dj10-20020a056602256a00b00780c787637bmr6753901iob.0.1695319291654; Thu, 21 Sep 2023 11:01:31 -0700 (PDT) Received: from localhost.localdomain (71-211-130-31.hlrn.qwest.net. [71.211.130.31]) by smtp.gmail.com with ESMTPSA id q6-20020a02a306000000b0042b52dc77e3sm483736jai.158.2023.09.21.11.01.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 11:01:31 -0700 (PDT) Date: Thu, 21 Sep 2023 12:01:31 -0600 Subject: [PATCH 4/7] Add field::is_public MIME-Version: 1.0 Message-Id: <20230921-field-bits-v1-4-201285360900@adacore.com> References: <20230921-field-bits-v1-0-201285360900@adacore.com> In-Reply-To: <20230921-field-bits-v1-0-201285360900@adacore.com> To: gdb-patches@sourceware.org X-Mailer: b4 0.12.3 X-Spam-Status: No, score=-11.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, 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 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Tom Tromey via Gdb-patches From: Tom Tromey Reply-To: Tom Tromey Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" This adds a field::is_public convenience method, and updates one spot to use it. --- gdb/gdbtypes.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index c72512b8204..53a8f7e803c 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -668,6 +668,12 @@ struct field m_loc.dwarf_block = dwarf_block; } + /* True if this field is 'public'. */ + bool is_public () const + { + return !m_private && !m_protected; + } + /* True if this field is 'private'. */ bool is_private () const { return m_private; } @@ -1961,7 +1967,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) \