From patchwork Thu Aug 8 12:06:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathaniel Shead X-Patchwork-Id: 1970520 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=UVSqgCoY; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Wfm4K714tz1ybS for ; Thu, 8 Aug 2024 22:06:57 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A202F3858D34 for ; Thu, 8 Aug 2024 12:06:55 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by sourceware.org (Postfix) with ESMTPS id 03B673858D34 for ; Thu, 8 Aug 2024 12:06:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 03B673858D34 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 03B673858D34 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::635 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1723118796; cv=none; b=WKLO5/t2UTKNB7CWwaeqj4e7v/gTamWCCWrLIyckcN/Smce2Xhyisksi74kMp6iSKxga/nZpvQBvcPw4WTOw1F60RplhfpDzZt0+toXSFdabnXWe9gWt1shYKNozrDjuOfGuzjxGqT71JHojL79GYuDiqX4J2HYsFBSiatnGOgY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1723118796; c=relaxed/simple; bh=XzGg6sacMIGHvAac+WYZiTPrOa2/To4mMdYyTWNMk7E=; h=DKIM-Signature:Message-ID:Date:From:To:Subject:MIME-Version; b=tdMsQ0IzJWDEvgVPUPoCGWL1wNp4uYIyCWRgOF0SsBB1U00RuHsdayDiZ7ePwCj1GaEoxN3ApQoWJdRKbF4c5Qm2ryNxdXonpr7HwzvmBWgjcHrr3w4MzLu5njg/yuxhJVKxYqNERrBd7j1djCRGbl6AQ4Bxg71ArFjETKG9lWg= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-1fee6435a34so8281545ad.0 for ; Thu, 08 Aug 2024 05:06:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723118794; x=1723723594; darn=gcc.gnu.org; h=content-disposition:mime-version:subject:cc:to:from:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=LFSwqCODUDfG4uplRPjRGZ12+F+n3j0GM0RN/zJe6mE=; b=UVSqgCoYk/oQxHbnCw/rqE9YorV5H3YU/dt896SsoeYTfFWwpDArmQFrA4aOT4/VhG 5l+gJoFiHefQ0vb3GTjBF8OFacCq3T3zeuqfv4WNQaKOgTeJkOLgUVizqyvUah8HkPwB CaYCUcBB/GxTuGCbbqGitzu6kNQlRHanVQrj2KxfaQLb0ieZXFNlvDIdpiLvXKbDMkbx OQ+jFLtZv8Nf11gAO7ELNIB2pf0aBbbklRXk97KLuadq2xEa+ALs6ujl/SQLB4mfkf1Y qT7WvZ+0P1PSmQEizUYPBqyiGYj8JCAr+S/NUL1UO9ib4s/VLJhBQdvMyR55SuZ8mQmW d9kQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723118794; x=1723723594; h=content-disposition:mime-version:subject:cc:to:from:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=LFSwqCODUDfG4uplRPjRGZ12+F+n3j0GM0RN/zJe6mE=; b=i8urn/ci0KuXFaw2w3xvcFriPztokMrY85l3eAA020R8KXasbcO6hxRicP7Dz4yQrw 8pnKGV9iJdLTv5GSTwwtzfbmEkRIQEgMdDMBF7QdPOxFHEbluHNqIlYY3r+wRLqRBWyX i3QShfISxPkpaV4IFMO5u7PUIYcyED9D9Y05MrJdAXo4ubdk4AsiURjdED20x4z56w/a 9PJM8TvgY4xCvL2lUVctbjHGvOMD1Q6LBQkhwyJf+MWxH8l6daCNi3oMVNn0eFPQFsWJ wEWrdunJ4PL/gw6rWfdBrZDutVC7Ah8iszwVUWAZmwgchf7q7u1qP+FYulBYpmIJuY50 Hjkw== X-Gm-Message-State: AOJu0YwOXppTqBdVnHL1UG2kVbiv0ybjd7JmckfJd+okDW+H0YulhjWA IUHL/vnrinS7+rkwHpYZ6v5voXdk/F8zB48md/xKForH7g8Fp9bwyebK7w== X-Google-Smtp-Source: AGHT+IEkipOsXSHxHKkBhPnSvuwoXqwquW0bFcHjGJwF6mABBt41oNrjGjGTzaSCM6Az8leNLtBBkg== X-Received: by 2002:a17:902:fc8d:b0:200:9535:cf13 with SMTP id d9443c01a7336-2009535d539mr19168955ad.1.1723118793584; Thu, 08 Aug 2024 05:06:33 -0700 (PDT) Received: from Thaum. (110-174-164-242.static.tpgi.com.au. [110.174.164.242]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1ff592aee19sm122730425ad.282.2024.08.08.05.06.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 05:06:33 -0700 (PDT) Message-ID: <66b4b4c9.170a0220.28c5d.5f4f@mx.google.com> X-Google-Original-Message-ID: Date: Thu, 8 Aug 2024 22:06:27 +1000 From: Nathaniel Shead To: gcc-patches@gcc.gnu.org Cc: Jason Merrill , Nathan Sidwell Subject: [PATCH] c++/modules: Assume header bindings are global module MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, URIBL_BLACK 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: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org Bootstrapped and regtested on x86_64-pc-linux-gnu, OK for trunk? -- >8 -- While stepping through some code I noticed that we do some extra work (finding the originating module decl, stripping the template, and inspecting the attached-ness) for every declaration taken from a header unit. This doesn't seem necessary though since no declaration in a header unit can be attached to anything but the global module, so we can just assume that global_p will be true. This was the original behaviour before I removed this assumption while refactoring for r15-2807-gc592310d5275e0. gcc/cp/ChangeLog: * module.cc (module_state::read_cluster): Assume header module declarations will require GM merging. Signed-off-by: Nathaniel Shead --- gcc/cp/module.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc index 58ad8cbdb61..f4d137b13a1 100644 --- a/gcc/cp/module.cc +++ b/gcc/cp/module.cc @@ -15361,7 +15361,7 @@ module_state::read_cluster (unsigned snum) tree visible = NULL_TREE; tree type = NULL_TREE; bool dedup = false; - bool global_p = false; + bool global_p = is_header (); /* We rely on the bindings being in the reverse order of the resulting overload set. */