From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gateway21.websitewelcome.com (gateway21.websitewelcome.com [192.185.45.43]) by sourceware.org (Postfix) with ESMTPS id 70C743858018 for ; Sat, 15 May 2021 15:19:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 70C743858018 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 cm10.websitewelcome.com (cm10.websitewelcome.com [100.42.49.4]) by gateway21.websitewelcome.com (Postfix) with ESMTP id D8677400C97C9 for ; Sat, 15 May 2021 10:19:17 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id hw4TlGfwA8uM0hw4TlZKRU; Sat, 15 May 2021 10:19:17 -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=Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Subject: Cc:To:From:Sender:Reply-To:Content-Type:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=KdMRhHETvWqW+shLMcUIoIwma42Y+nP40XeLP97r26I=; b=Q0Z2Rq53x9JN+afl7Hmc5VzSnz 4idpFd8Rcy1XDt4BT+z9BqHWNB461WzvD+GCPG1ehlf8ce59nz8s8gOCKDVTopIr5iCx+Dc86KxBr MQZE9dHGv7mvLy94mHZFnUO1K; Received: from 75-166-134-27.hlrn.qwest.net ([75.166.134.27]:34894 helo=localhost.localdomain) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1lhw4T-001jTs-K0; Sat, 15 May 2021 09:19:17 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH] Replace sort_tu_by_abbrev_offset with operator< Date: Sat, 15 May 2021 09:19:15 -0600 Message-Id: <20210515151915.990795-1-tom@tromey.com> X-Mailer: git-send-email 2.26.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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: 75.166.134.27 X-Source-L: No X-Exim-ID: 1lhw4T-001jTs-K0 X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 75-166-134-27.hlrn.qwest.net (localhost.localdomain) [75.166.134.27]:34894 X-Source-Auth: tom+tromey.com X-Email-Count: 1 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-Spam-Status: No, score=-3032.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, JMQ_SPF_NEUTRAL, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_NEUTRAL, TXREP 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, 15 May 2021 15:19:21 -0000 I noticed that sort_tu_by_abbrev_offset only has a single caller. It seemed simpler to replace it with an implementation of operator< instead. gdb/ChangeLog 2021-05-15 Tom Tromey * dwarf2/read.c (tu_abbrev_offset::operator<): New method. (sort_tu_by_abbrev_offset): Remove. (build_type_psymtabs): Update. --- gdb/ChangeLog | 6 ++++++ gdb/dwarf2/read.c | 18 +++++++----------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index ac786abf6d2..f1bb9b2f3df 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -7351,19 +7351,16 @@ struct tu_abbrev_offset : sig_type (sig_type_), abbrev_offset (abbrev_offset_) {} + /* This is used when sorting. */ + bool operator< (const tu_abbrev_offset &other) + { + return abbrev_offset < other.abbrev_offset; + } + signatured_type *sig_type; sect_offset abbrev_offset; }; -/* Helper routine for build_type_psymtabs, passed to std::sort. */ - -static bool -sort_tu_by_abbrev_offset (const struct tu_abbrev_offset &a, - const struct tu_abbrev_offset &b) -{ - return a.abbrev_offset < b.abbrev_offset; -} - /* Efficiently read all the type units. The efficiency is because we sort TUs by the abbrev table they use and @@ -7431,8 +7428,7 @@ build_type_psymtabs (dwarf2_per_objfile *per_objfile) } } - std::sort (sorted_by_abbrev.begin (), sorted_by_abbrev.end (), - sort_tu_by_abbrev_offset); + std::sort (sorted_by_abbrev.begin (), sorted_by_abbrev.end ()); abbrev_offset = (sect_offset) ~(unsigned) 0; -- 2.26.3