https://gcc.gnu.org/g:bd28244ec92b9aac082f822987818ff1e11b67fd
commit r15-6757-gbd28244ec92b9aac082f822987818ff1e11b67fd Author: Jason Merrill <ja...@redhat.com> Date: Mon Nov 25 18:02:30 2024 -0500 c++: improve some modules comments gcc/cp/ChangeLog: * error.cc (cxx_initialize_diagnostics): Improve comment. * module.cc (modules): Improve comment. (get_originating_module): Add function comment. Diff: --- gcc/cp/error.cc | 2 +- gcc/cp/module.cc | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/gcc/cp/error.cc b/gcc/cp/error.cc index cc4cc4a7eb46..615ae0d1b65a 100644 --- a/gcc/cp/error.cc +++ b/gcc/cp/error.cc @@ -285,7 +285,7 @@ cxx_initialize_diagnostics (diagnostic_context *context) context->m_adjust_diagnostic_info = cp_adjust_diagnostic_info; } -/* Dump an '@module' name suffix for DECL, if any. */ +/* Dump an '@module' name suffix for DECL, if it's attached to an import. */ static void dump_module_suffix (cxx_pretty_printer *pp, tree decl) diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc index 0533a2bcf2c1..fec820603521 100644 --- a/gcc/cp/module.cc +++ b/gcc/cp/module.cc @@ -4076,7 +4076,8 @@ static unsigned lazy_hard_limit; /* Hard limit on open modules. */ pass, but ICBW. */ #define LAZY_HEADROOM 15 /* File descriptor headroom. */ -/* Vector of module state. Indexed by OWNER. Has at least 2 slots. */ +/* Vector of module state. Indexed by OWNER. Index 0 is reserved for the + current TU; imports start at 1. */ static GTY(()) vec<module_state *, va_gc> *modules; /* Hash of module state, findable by {name, parent}. */ @@ -19947,6 +19948,9 @@ get_originating_module (tree decl, bool for_mangle) return mod; } +/* DECL is imported, return which module imported it. + If FLEXIBLE, return -1 if not found, otherwise checking ICE. */ + unsigned get_importing_module (tree decl, bool flexible) {