From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gateway30.websitewelcome.com (gateway30.websitewelcome.com [192.185.149.4]) by sourceware.org (Postfix) with ESMTPS id A43FB3898C46 for ; Sat, 28 Mar 2020 19:22:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org A43FB3898C46 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=tom@tromey.com Received: from cm16.websitewelcome.com (cm16.websitewelcome.com [100.42.49.19]) by gateway30.websitewelcome.com (Postfix) with ESMTP id 55E72288E9 for ; Sat, 28 Mar 2020 14:22:11 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id IH23joCMV8vkBIH23jdfeq; Sat, 28 Mar 2020 14:22:11 -0500 X-Authority-Reason: nr=8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=AYmHvjUIXXhBlIqe4yRXpq8K8qQjO4k1xbREbKQmcgU=; b=xLXWy42L8J3ebsaDyZUd1FJA1i fQ7qL6Zm9W3UMdJIcA5Hn9UOm83iLJHnpoqpJMmaBHwcNYXpsP620UE77TqPfXGFXpG48utaVMed/ ntnD2rY+URLDF3NtAOddVuaqN; Received: from 97-118-117-21.hlrn.qwest.net ([97.118.117.21]:55190 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from ) id 1jIH23-003oZR-4Z; Sat, 28 Mar 2020 13:22:11 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 05/20] Remove some uses of DW_STRING_IS_CANONICAL Date: Sat, 28 Mar 2020 13:21:53 -0600 Message-Id: <20200328192208.11324-6-tom@tromey.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20200328192208.11324-1-tom@tromey.com> References: <20200328192208.11324-1-tom@tromey.com> X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 97.118.117.21 X-Source-L: No X-Exim-ID: 1jIH23-003oZR-4Z X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-118-117-21.hlrn.qwest.net (bapiya.Home) [97.118.117.21]:55190 X-Source-Auth: tom+tromey.com X-Email-Count: 8 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-Spam-Status: No, score=-21.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, JMQ_SPF_NEUTRAL, RCVD_IN_ABUSEAT, RCVD_IN_DNSWL_NONE, RCVD_IN_SBL_CSS, SPF_HELO_PASS, SPF_NEUTRAL, TXREP, URIBL_CSS, URIBL_CSS_A autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Mar 2020 19:22:13 -0000 This removes the rvalue uses of DW_STRING_IS_CANONICAL, replacing them with an accessor method. 2020-03-28 Tom Tromey * dwarf2/read.c (anonymous_struct_prefix, dwarf2_name) (dump_die_shallow): Use canonical_p. * dwarf2/attribute.h (struct attribute) : New method. --- gdb/ChangeLog | 7 +++++++ gdb/dwarf2/attribute.h | 6 ++++++ gdb/dwarf2/read.c | 8 ++++---- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/gdb/dwarf2/attribute.h b/gdb/dwarf2/attribute.h index cefd3c5541e..f20540559aa 100644 --- a/gdb/dwarf2/attribute.h +++ b/gdb/dwarf2/attribute.h @@ -100,6 +100,12 @@ struct attribute LONGEST constant_value (int default_value) const; + /* Return true if this attribute holds a canonical string. */ + bool canonical_p () const + { + return string_is_canonical; + } + ENUM_BITFIELD(dwarf_attribute) name : 16; ENUM_BITFIELD(dwarf_form) form : 15; diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index eb5ee98de60..4b102e52e88 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -20934,7 +20934,7 @@ anonymous_struct_prefix (struct die_info *die, struct dwarf2_cu *cu) return NULL; /* dwarf2_name had to be already called. */ - gdb_assert (DW_STRING_IS_CANONICAL (attr)); + gdb_assert (attr->canonical_p ()); /* Strip the base name, keep any leading namespaces/classes. */ base = strrchr (attr->string (), ':'); @@ -21262,7 +21262,7 @@ dwarf2_name (struct die_info *die, struct dwarf2_cu *cu) /* Avoid demangling attr->string () the second time on a second call for the same DIE. */ - if (!DW_STRING_IS_CANONICAL (attr)) + if (!attr->canonical_p ()) { gdb::unique_xmalloc_ptr demangled (gdb_demangle (attr->string (), DMGL_TYPES)); @@ -21287,7 +21287,7 @@ dwarf2_name (struct die_info *die, struct dwarf2_cu *cu) break; } - if (!DW_STRING_IS_CANONICAL (attr)) + if (!attr->canonical_p ()) { DW_STRING (attr) = dwarf2_canonicalize_name (attr->string (), cu, objfile); @@ -21407,7 +21407,7 @@ dump_die_shallow (struct ui_file *f, int indent, struct die_info *die) fprintf_unfiltered (f, "string: \"%s\" (%s canonicalized)", DW_STRING (&die->attrs[i]) ? DW_STRING (&die->attrs[i]) : "", - DW_STRING_IS_CANONICAL (&die->attrs[i]) ? "is" : "not"); + die->attrs[i].canonical_p () ? "is" : "not"); break; case DW_FORM_flag: if (DW_UNSND (&die->attrs[i])) -- 2.17.2