From bd28244ec92b9aac082f822987818ff1e11b67fd Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Mon, 25 Nov 2024 18:02:30 -0500 Subject: 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. --- gcc/cp/error.cc | 2 +- gcc/cp/module.cc | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'gcc') diff --git a/gcc/cp/error.cc b/gcc/cp/error.cc index cc4cc4a..615ae0d 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 0533a2b..fec8206 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 *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) { -- cgit v1.1