Revert "make -fmodules-codegen and -fmodules-debuginfo work also with PCHs"
This caused PR44953. See also the discussion on D74846.
This reverts commit cbc9d22e49b434b6ceb2eb94b67079d02e0a7b74.
diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp
index 159ebe1..6f77d4f 100644
--- a/clang/lib/Serialization/ASTWriter.cpp
+++ b/clang/lib/Serialization/ASTWriter.cpp
@@ -5596,8 +5596,8 @@
// getODRHash will compute the ODRHash if it has not been previously computed.
Record->push_back(D->getODRHash());
- bool ModulesDebugInfo =
- Writer->Context->getLangOpts().ModulesDebugInfo && !D->isDependentType();
+ bool ModulesDebugInfo = Writer->Context->getLangOpts().ModulesDebugInfo &&
+ Writer->WritingModule && !D->isDependentType();
Record->push_back(ModulesDebugInfo);
if (ModulesDebugInfo)
Writer->ModularCodegenDecls.push_back(Writer->GetDeclRef(D));