]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c++/modules: Assume header bindings are global module
authorNathaniel Shead <nathanieloshead@gmail.com>
Thu, 8 Aug 2024 12:00:07 +0000 (22:00 +1000)
committerNathaniel Shead <nathanieloshead@gmail.com>
Thu, 8 Aug 2024 12:42:13 +0000 (22:42 +1000)
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 <nathanieloshead@gmail.com>
gcc/cp/module.cc

index 58ad8cbdb614b550ff21ec65bb8e759a6f5515da..f4d137b13a170551ff0c3f354cd8f9dc5a7d6be2 100644 (file)
@@ -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.  */