aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2024-11-25 18:02:30 -0500
committerJason Merrill <jason@redhat.com>2025-01-09 21:43:11 -0500
commitbd28244ec92b9aac082f822987818ff1e11b67fd (patch)
tree09a8ff8dafe262777a530f47aaa8cbe559fc6507 /gcc
parent6fe395025deda274f2f92b04e3e329aa53771dfe (diff)
downloadgcc-bd28244ec92b9aac082f822987818ff1e11b67fd.zip
gcc-bd28244ec92b9aac082f822987818ff1e11b67fd.tar.gz
gcc-bd28244ec92b9aac082f822987818ff1e11b67fd.tar.bz2
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.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/error.cc2
-rw-r--r--gcc/cp/module.cc6
2 files changed, 6 insertions, 2 deletions
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<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)
{