[clang] [clang][modules] Deserialize submodules lazily (PR #194968)

Jan Svoboda via cfe-commits cfe-commits at lists.llvm.org
Wed May 6 14:02:29 PDT 2026


================
@@ -3101,6 +3098,19 @@ void ASTWriter::WriteSubmodules(Module *WritingModule, ASTContext *Context) {
     Module *Mod = Q.front();
     Q.pop();
     unsigned ID = getSubmoduleID(Mod);
+    if (ID < FirstSubmoduleID) {
+      assert(0 && "Loaded submodule entered WritingModule ?");
----------------
jansvoboda11 wrote:

That was inspired by the logic used when writing `MacroInfosToEmit`. I think unreachable has stronger semantics in that the branch can be optimized out in non-assert builds, while I'd like to preserve the defensiveness of the current scheme.

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


More information about the cfe-commits mailing list