Valentin Clement =?utf-8?b?KOODkOODrOODsw=?=,Kyungwoo Lee 
<kyu...@meta.com>,Dmitry
 Polukhin <dmitry.poluk...@gmail.com>,Dmitry Polukhin
 <dmitry.poluk...@gmail.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/104...@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);
----------------
dmpolukhin wrote:

@ChuanqiXu9 could you please elaborate why you think it may not be paired? Code 
in ASTDeclWriter looks like this:
```
  if (D->isCanonicalDecl()) {
    llvm::SmallVector<const Decl *, 2> Lambdas = collectLambdas(D);
    Record.push_back(Lambdas.size());
    for (const auto *L : Lambdas)
      Record.AddDeclRef(L);
  } else {
    Record.push_back(0);
  }
```
So in the first case it writes size + following decls, in the second case it 
writes 0. I looked the implementation of skipInts for `skipInts(0)` it does 
nothing.

https://github.com/llvm/llvm-project/pull/104512
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to