[0/4] c++/modules: Fix missed GMF discarding

Message ID 66321257.170a0220.326c5.1f68@mx.google.com
Headers
Series c++/modules: Fix missed GMF discarding |

Message

Nathaniel Shead May 1, 2024, 9:58 a.m. UTC
  This patch series fixes a number of issues with declarations in the GMF not
correctly getting discarded, and ending up in the module CMI.  The most
noticeable outcome of this is users running very quickly into issues with
including a header after those names have already been provided by an 'import';
this should go away once we implement deduplication of textual redefinitions,
but it's still worth discarding as it otherwise inflates the size of the CMI
with unused declarations.

Nathaniel Shead (4):
  c++: Don't emit unused GMF partial specializations [PR114630]
  c++: Track module purview for deferred instantiations [PR114630]
  c++: Also track module purview from deferred vtable instantiation
    [PR114630]
  c++: Add new xtreme-header testcase for GMF discarding

 gcc/cp/cp-tree.h                              |  3 +
 gcc/cp/decl2.cc                               | 11 ++-
 gcc/cp/module.cc                              | 75 ++++++++++++-------
 gcc/cp/pt.cc                                  |  4 +
 gcc/testsuite/g++.dg/modules/gmf-3.C          | 13 ++++
 gcc/testsuite/g++.dg/modules/gmf-4.C          | 27 +++++++
 gcc/testsuite/g++.dg/modules/partial-3.C      | 20 +++++
 .../g++.dg/modules/xtreme-header-8.C          |  9 +++
 gcc/testsuite/g++.dg/modules/xtreme-header.h  | 24 ++++--
 9 files changed, 147 insertions(+), 39 deletions(-)
 create mode 100644 gcc/testsuite/g++.dg/modules/gmf-3.C
 create mode 100644 gcc/testsuite/g++.dg/modules/gmf-4.C
 create mode 100644 gcc/testsuite/g++.dg/modules/partial-3.C
 create mode 100644 gcc/testsuite/g++.dg/modules/xtreme-header-8.C