[clang] [C++20][Modules] Fix crash/compiler error due broken AST links (PR #123648)
Haojian Wu via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 21 00:41:23 PST 2025
================
@@ -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:
This line looks identical to the one on line [807](https://github.com/llvm/llvm-project/blob/0f9e913466982b92776d6ff748df48af28631517/clang/lib/Serialization/ASTWriterDecl.cpp#L807). I guess we can pull out a small function.
https://github.com/llvm/llvm-project/pull/123648
More information about the cfe-commits
mailing list