From patchwork Thu Jan 18 20:32:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 84393 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 00990385840D for ; Thu, 18 Jan 2024 20:38:47 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from omta036.useast.a.cloudfilter.net (omta036.useast.a.cloudfilter.net [44.202.169.35]) by sourceware.org (Postfix) with ESMTPS id C8F6C3858286 for ; Thu, 18 Jan 2024 20:32:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C8F6C3858286 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org C8F6C3858286 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=44.202.169.35 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705609952; cv=none; b=VnOiZOl7ePieA8Jpq0lWrCkL6xHSfcX9j1g+fwuqDm8SHB0lpER0PN74MQ/0QwgAPeNIrwECxLRNSA7wk3UXKy5jMmjWyGZT88fMDwGvFzlkoAc6bzn27xfjtkllc0Ta1mztcRpzP6wCXiwDnSMQDaK9ae0H7CA665bLN74JC0U= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705609952; c=relaxed/simple; bh=ABJbJcUDHmf0XlsZlHl4ZfN61QbUHa8FY6Iv9N4ygok=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=HZpVp5lN4gNwIPFamOkMmWrGgFTYQjOHMwrgybOibtlKycixpJA+WDj+cC/NO8Xg8uGvdDUK2LI0oAN/dNU0iu7oiIEL0RqKNIPerzFdPtzco26n5jKVyNOgDmRTMgJdnjm2/od5HykWZzqzjXfsudLQNQRmZpea3kjCvmAJpLQ= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-6003a.ext.cloudfilter.net ([10.0.30.151]) by cmsmtp with ESMTPS id QPLXrG21e8uLRQZ3frw3EP; Thu, 18 Jan 2024 20:32:15 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id QZ3erhTg1tzh2QZ3frbVP2; Thu, 18 Jan 2024 20:32:15 +0000 X-Authority-Analysis: v=2.4 cv=Ra6Dtnhv c=1 sm=1 tr=0 ts=65a98acf a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10 a=dEuoMetlWLkA:10 a=Qbun_eYptAEA:10 a=ABg-ZwUhIPAXn4CSIH0A:9 a=QEXdDO2ut3YA:10 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=To:In-Reply-To:References:Message-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:Subject:Date:From:Sender:Reply-To:Cc: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=MS6FMHWSJTJI/fkCAVZytNPXAy4koF9/7L00r2XSxRs=; b=k0gauXqkA8XhIL9XpMOMb25Nry sLtd7QOg5VdsyGfOITVGe83bC1rzaA6T/CAcjqaBdiDKj+oORjH1NudEs4QRuiGk4HvrKc2Z+vzsZ mwq/URjTogWNv9hG2dj7jZq+Q; Received: from 97-122-68-157.hlrn.qwest.net ([97.122.68.157]:50746 helo=[192.168.0.21]) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1rQZ3e-002DCj-2K for gdb-patches@sourceware.org; Thu, 18 Jan 2024 13:32:14 -0700 From: Tom Tromey Date: Thu, 18 Jan 2024 13:32:27 -0700 Subject: [PATCH v2 29/30] Refine search in cp_search_static_and_baseclasses MIME-Version: 1.0 Message-Id: <20240118-submit-domain-hacks-2-v2-29-aecab29fa104@tromey.com> References: <20240118-submit-domain-hacks-2-v2-0-aecab29fa104@tromey.com> In-Reply-To: <20240118-submit-domain-hacks-2-v2-0-aecab29fa104@tromey.com> To: gdb-patches@sourceware.org X-Mailer: b4 0.12.4 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.122.68.157 X-Source-L: No X-Exim-ID: 1rQZ3e-002DCj-2K X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-68-157.hlrn.qwest.net ([192.168.0.21]) [97.122.68.157]:50746 X-Source-Auth: tom+tromey.com X-Email-Count: 31 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfFBdZgFq+sciiwNlvVKMAWcR1w+3NSWFRfaznGvnRDdY13GlIP2qzeTS7O5duZqSAxLQb9wLN1UXCBqk5mWToSr9c9zNsLaV7yHthKrMpjt6zfRSs9h6 3klWAShnUzqu3Gua36kbK2pkzsF7hS2ziPj3h6ISveQB4/2rCwGrtxlSnn8YUkAOF8saSCbZ2I61c7U0ac1dlDfwjJTQvuwJXuY= X-Spam-Status: No, score=-3022.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, JMQ_SPF_NEUTRAL, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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: , Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org This changes cp_search_static_and_baseclasses to only search for types, functions, and modules. The latter two cases were discovered by regression testing. I found it somewhat surprising the Fortran name lookup ends up in this code, but did not attempt to change this. --- gdb/cp-namespace.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c index 593340af350..41ab52de54a 100644 --- a/gdb/cp-namespace.c +++ b/gdb/cp-namespace.c @@ -268,14 +268,19 @@ cp_search_static_and_baseclasses (const char *name, const char *nested = name + prefix_len + 2; /* Lookup the scope symbol. If none is found, there is nothing more - that can be done. SCOPE could be a namespace, so always look in - VAR_DOMAIN. This works for classes too because of - symbol_matches_domain (which should be replaced with something - else, but it's what we have today). */ - block_symbol scope_sym = lookup_symbol_in_static_block (scope.c_str (), - block, SEARCH_VFT); + that can be done. SCOPE could be a namespace, a class, or even a + function. This code is also used by Fortran, so modules are + included in the search as well. */ + block_symbol scope_sym + = lookup_symbol_in_static_block (scope.c_str (), block, + SEARCH_TYPE_DOMAIN + | SEARCH_FUNCTION_DOMAIN + | SEARCH_MODULE_DOMAIN); if (scope_sym.symbol == NULL) - scope_sym = lookup_global_symbol (scope.c_str (), block, SEARCH_VFT); + scope_sym = lookup_global_symbol (scope.c_str (), block, + SEARCH_TYPE_DOMAIN + | SEARCH_FUNCTION_DOMAIN + | SEARCH_MODULE_DOMAIN); if (scope_sym.symbol == NULL) return {};