aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Serialization/ASTWriter.cpp
diff options
context:
space:
mode:
authorChuanqi Xu <yedeng.yd@linux.alibaba.com>2024-06-04 17:05:33 +0800
committerChuanqi Xu <yedeng.yd@linux.alibaba.com>2024-06-04 17:08:21 +0800
commit99873b35da7ecb905143c8a6b8deca4d4416f1a9 (patch)
tree3fa68322fb4633438060ec1f9fa0b86a612d565d /clang/lib/Serialization/ASTWriter.cpp
parent164597616c0c9cb42536d0d112e87e616751a438 (diff)
downloadllvm-99873b35da7ecb905143c8a6b8deca4d4416f1a9.zip
llvm-99873b35da7ecb905143c8a6b8deca4d4416f1a9.tar.gz
llvm-99873b35da7ecb905143c8a6b8deca4d4416f1a9.tar.bz2
[NFC] [AST] Introduce Decl::isInAnotherModuleUnit and Decl::shouldEmitInExternalSource
Motivated by the review process in https://github.com/llvm/llvm-project/pull/75912. This can also help to simplify the code slightly.
Diffstat (limited to 'clang/lib/Serialization/ASTWriter.cpp')
-rw-r--r--clang/lib/Serialization/ASTWriter.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp
index 28eb4f4..d18dbad 100644
--- a/clang/lib/Serialization/ASTWriter.cpp
+++ b/clang/lib/Serialization/ASTWriter.cpp
@@ -6508,10 +6508,12 @@ void ASTRecordWriter::AddCXXDefinitionData(const CXXRecordDecl *D) {
// computed.
Record->push_back(D->getODRHash());
- bool ModulesDebugInfo =
- Writer->Context->getLangOpts().ModulesDebugInfo && !D->isDependentType();
- Record->push_back(ModulesDebugInfo);
- if (ModulesDebugInfo)
+ bool ModulesCodegen =
+ !D->isDependentType() &&
+ (Writer->Context->getLangOpts().ModulesDebugInfo ||
+ D->isInNamedModule());
+ Record->push_back(ModulesCodegen);
+ if (ModulesCodegen)
Writer->AddDeclRef(D, Writer->ModularCodegenDecls);
// IsLambda bit is already saved.