================
@@ -1571,9 +1571,10 @@ void ASTDeclWriter::VisitCXXRecordDecl(CXXRecordDecl *D) 
{
     } else {
       Record.push_back(0);
     }
-    // For lambdas inside canonical FunctionDecl remember the mapping.
+    // For lambdas inside template functions, remember the mapping to
+    // deserialize them together.
     if (auto FD = llvm::dyn_cast_or_null<FunctionDecl>(D->getDeclContext());
-        FD && FD->isCanonicalDecl()) {
+        FD && FD->isDependentContext() && FD->isThisDeclarationADefinition()) {
----------------
hokein wrote:

> But types are different and isThisDeclarationADefinition is not a virtual 
> function.

We can use a template function.

> Moreover I'm not sure that conditions will be the same in future so 
> extracting them to a function might be a wrong hint.

OK, that makes sense.

(this change seems to be an oversight in 
https://github.com/llvm/llvm-project/pull/111992, where it was applied to 
`RecordDecl` but not to `FunctionDecl`. Extracting this into a dedicated 
function might be helpful and could potentially be reused in other parts of the 
code.)


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

Reply via email to