From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id /YFZOnsUvGoGjxkAWB0awg (envelope-from ) for ; Tue, 29 Sep 2026 15:41:48 -0400 Received: by simark.ca (Postfix, from userid 112) id 82D8F1E04E; Tue, 29 Sep 2026 15:41:47 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.3 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [IPv6:2620:52:6:3111::32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 5F1E71E04E for ; Tue, 29 Sep 2026 15:41:46 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E9C744BB1C06 for ; Tue, 29 Sep 2026 19:41:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E9C744BB1C06 Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 010704BA23C0 for ; Tue, 29 Sep 2026 19:41:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 010704BA23C0 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=efficios.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=efficios.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 010704BA23C0 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=158.69.221.121 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1790710883; cv=none; b=HNnZJd93s06qvzMvTUCEZea+TCkBO1ccsVSH5gT0GLKPGM0k/CsLEc8iPqG1YRCfnMQ8kuBNMuTE2CUDb46w5i0AtSqZg0MZC3yx8dG4ciO1b08cr9CxEEBqx5X4z4fA+DZ79dvRXG5Snu72R1GS73DnM0E9sSSZ2vpT2WsM2Es= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1790710883; c=relaxed/simple; bh=r5m/bDC+tK671dsbcpIHh34HMEse3YhpRJXFiff2S94=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=so9gMQ+pvv8tvxNSbdBWQs5UEaXcHG9aNfJcaDX/l+bWtqX4tw4rxFkhQW4Tgmm/O6t4QpRCh4h4UDxK08H44oHp2VsTLhz7alWcihq+lmbvOYMFcPm+AEB0vpi4ftMEAEgRGSS1bd6QRHNaSwUZsE30uDbZSEwDUZ5Md6I2gMw= ARC-Authentication-Results: i=1; sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 010704BA23C0 Received: by simark.ca (Postfix) id 156551E090; Tue, 29 Sep 2026 15:41:21 -0400 (EDT) From: Simon Marchi To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 3/9] gdb: simplify insertion in global_symbol_searcher::add_matching_symbols Date: Tue, 29 Sep 2026 15:39:24 -0400 Message-ID: <20260929194119.155169-4-simon.marchi@efficios.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260929194119.155169-1-simon.marchi@efficios.com> References: <20260929194119.155169-1-simon.marchi@efficios.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org std::set::insert does nothing if an equivalent element is already in the set, so checking with find first is redundant. Replace find+insert with emplace. Change-Id: I869284407cfefb9b2d7ad7305fe04fbdaee25f1f --- gdb/symtab.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/gdb/symtab.c b/gdb/symtab.c index c4f76a494abd..4b2c4be8d117 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -4880,13 +4880,9 @@ global_symbol_searcher::add_matching_symbols if (sym->domain () == MODULE_DOMAIN && sym->line () == 0) continue; + /* Match, insert if not already in the results. */ if (result_set->size () < m_max_search_results) - { - /* Match, insert if not already in the results. */ - symbol_search ss (block, sym); - if (result_set->find (ss) == result_set->end ()) - result_set->insert (ss); - } + result_set->emplace (block, sym); else return false; } -- 2.55.0