]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c++: improve some modules comments
authorJason Merrill <jason@redhat.com>
Mon, 25 Nov 2024 23:02:30 +0000 (18:02 -0500)
committerJason Merrill <jason@redhat.com>
Fri, 10 Jan 2025 02:43:11 +0000 (21:43 -0500)
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
gcc/cp/module.cc

index cc4cc4a7eb467b437b1a329e0df61194ef7fb92f..615ae0d1b65ae799991af183cf80111dc2126e51 100644 (file)
@@ -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)
index 0533a2bcf2c1f972c78ec66337d9238dd331ad8c..fec820603521f7c2aad7027afe07f3b91e8efefa 100644 (file)
@@ -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)
 {