summaryrefslogtreecommitdiff
path: root/clang/lib/Serialization/ASTWriterDecl.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2024-08-25 10:56:24 +0000
committerDimitry Andric <dim@FreeBSD.org>2024-08-25 10:56:24 +0000
commitadf62863f35c84e4c5708f3dc5a1589ce958a238 (patch)
tree924e88089bbec100de08015b4e496261eb6f2d66 /clang/lib/Serialization/ASTWriterDecl.cpp
parent9b9503334fa856ed4ed6823d35b6f52546296f77 (diff)
Vendor import of llvm-project branch release/19.x llvmorg-19.1.0-rc3-0-g437434df21d8.vendor/llvm-project/llvmorg-19.1.0-rc3-0-g437434df21d8
Diffstat (limited to 'clang/lib/Serialization/ASTWriterDecl.cpp')
-rw-r--r--clang/lib/Serialization/ASTWriterDecl.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/Serialization/ASTWriterDecl.cpp b/clang/lib/Serialization/ASTWriterDecl.cpp
index 17c774038571..8a4ca54349e3 100644
--- a/clang/lib/Serialization/ASTWriterDecl.cpp
+++ b/clang/lib/Serialization/ASTWriterDecl.cpp
@@ -1529,8 +1529,14 @@ void ASTDeclWriter::VisitCXXRecordDecl(CXXRecordDecl *D) {
if (D->isThisDeclarationADefinition())
Record.AddCXXDefinitionData(D);
+ if (D->isCompleteDefinition() && D->isInNamedModule())
+ Writer.AddDeclRef(D, Writer.ModularCodegenDecls);
+
// Store (what we currently believe to be) the key function to avoid
// deserializing every method so we can compute it.
+ //
+ // FIXME: Avoid adding the key function if the class is defined in
+ // module purview since in that case the key function is meaningless.
if (D->isCompleteDefinition())
Record.AddDeclRef(Context.getCurrentKeyFunction(D));