[clang] [C++20][Modules] Fix crash when function and lambda inside loaded from different modules (PR #109167)

Dmitry Polukhin via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 24 04:31:17 PDT 2024


================
@@ -4351,6 +4351,15 @@ void ASTReader::loadDeclUpdateRecords(PendingUpdateRecord &Record) {
           reader::ASTDeclContextNameLookupTrait(*this, *Update.Mod));
     DC->setHasExternalVisibleStorage(true);
   }
+
+  // Load any pending lambdas for the function.
+  if (auto *FD = dyn_cast<FunctionDecl>(D); FD && FD->isCanonicalDecl()) {
+    if (auto IT = FunctionToLambdasMap.find(ID);
+        IT != FunctionToLambdasMap.end()) {
+      for (auto LID : IT->second)
+        GetDecl(LID);
----------------
dmpolukhin wrote:

Done

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


More information about the cfe-commits mailing list