[clang] [C++20][Modules] Fix crash/compiler error due broken AST links (PR #123648)

Haojian Wu via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 22 04:26:25 PST 2025


================
@@ -539,11 +539,12 @@ class ASTReader
 
   /// Mapping from main decl ID to the related decls IDs.
   ///
-  /// These related decls have to be loaded right after the main decl.
-  /// It is required to have canonical declaration for related decls from the
-  /// same module as the enclosing main decl. Without this, due to lazy
-  /// deserialization, canonical declarations for the main decl and related can
-  /// be selected from different modules.
+  /// The key is the main decl ID, and the value is a vector of related decls
+  /// that must be loaded immediately after the main decl. This is necessary
+  /// to ensure that the definition for related decls comes from the same module
+  /// as the enclosing main decl. Without this, due to lazy deserialization,
+  /// the definition for the main decl and related decls may come from different
+  /// modules.
----------------
hokein wrote:

Thanks for confirming.

I think it would be worth documenting this (it took me some time to fully understand what `RelatedDeclsMap` is and how it's used). Clear documentation could help others in the future.


https://github.com/llvm/llvm-project/pull/123648


More information about the cfe-commits mailing list