[clang] [RFC][C++20][Modules] Fix crash when function and lambda inside loaded from different modules (PR #104512)
Chuanqi Xu via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 11 18:48:48 PDT 2024
Valentin Clement =?utf-8?b?KOODkOODrOODsw=?=,Kyungwoo Lee <kyulee at meta.com>,Dmitry
Polukhin <dmitry.polukhin at gmail.com>,Dmitry Polukhin
<dmitry.polukhin at gmail.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/104512 at github.com>
================
@@ -1155,6 +1155,16 @@ void ASTDeclReader::VisitFunctionDecl(FunctionDecl *FD) {
for (unsigned I = 0; I != NumParams; ++I)
Params.push_back(readDeclAs<ParmVarDecl>());
FD->setParams(Reader.getContext(), Params);
+
+ // For the first decl add all lambdas inside for loading them later,
+ // otherwise skip them.
+ unsigned NumLambdas = Record.readInt();
+ if (FD->isFirstDecl()) {
+ for (unsigned I = 0; I != NumLambdas; ++I)
+ Reader.PendingLambdas.push_back(Record.readDeclID());
+ } else {
+ Record.skipInts(NumLambdas);
----------------
ChuanqiXu9 wrote:
Here is not paired with writing process. It will only write a zero if it is not the first.
https://github.com/llvm/llvm-project/pull/104512
More information about the cfe-commits
mailing list