llunak updated this revision to Diff 246122.
llunak retitled this revision from "fix -fcodegen-modules code when used with
PCH (PR44958)" to "fix -fcodegen-modules code when used with PCH (PR44953)".
llunak edited the summary of this revision.
llunak added a comment.
Upon further investigation it turns out I probably should not have enabled
those two places for PCH in D69778 <https://reviews.llvm.org/D69778> at all,
since they do not deal with -fmodules-codegen. So reverting those two places
should be the right fix. That also makes a test irrelevant (not much point in
testing a rare corner-case for a code path never taken).
Repository:
rC Clang
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D74846/new/
https://reviews.llvm.org/D74846
Files:
clang/lib/Serialization/ASTWriterDecl.cpp
Index: clang/lib/Serialization/ASTWriterDecl.cpp
===================================================================
--- clang/lib/Serialization/ASTWriterDecl.cpp
+++ clang/lib/Serialization/ASTWriterDecl.cpp
@@ -1011,16 +1011,15 @@
if (D->getStorageDuration() == SD_Static) {
bool ModulesCodegen = false;
- if (!D->getDescribedVarTemplate() && !D->getMemberSpecializationInfo() &&
+ if (Writer.WritingModule &&
+ !D->getDescribedVarTemplate() && !D->getMemberSpecializationInfo() &&
!isa<VarTemplateSpecializationDecl>(D)) {
// When building a C++ Modules TS module interface unit, a strong
// definition in the module interface is provided by the compilation of
// that module interface unit, not by its users. (Inline variables are
// still emitted in module users.)
ModulesCodegen =
- (((Writer.WritingModule &&
- Writer.WritingModule->Kind == Module::ModuleInterfaceUnit) ||
- Writer.Context->getLangOpts().BuildingPCHWithObjectFile) &&
+ (Writer.WritingModule->Kind == Module::ModuleInterfaceUnit &&
Writer.Context->GetGVALinkageForVariable(D) == GVA_StrongExternal);
}
Record.push_back(ModulesCodegen);
@@ -2451,9 +2450,8 @@
bool ModulesCodegen = false;
if (!FD->isDependentContext()) {
Optional<GVALinkage> Linkage;
- if ((Writer->WritingModule &&
- Writer->WritingModule->Kind == Module::ModuleInterfaceUnit) ||
- Writer->Context->getLangOpts().BuildingPCHWithObjectFile) {
+ if (Writer->WritingModule &&
+ Writer->WritingModule->Kind == Module::ModuleInterfaceUnit) {
// When building a C++ Modules TS module interface unit, a strong
// definition in the module interface is provided by the compilation of
// that module interface unit, not by its users. (Inline functions are
Index: clang/lib/Serialization/ASTWriterDecl.cpp
===================================================================
--- clang/lib/Serialization/ASTWriterDecl.cpp
+++ clang/lib/Serialization/ASTWriterDecl.cpp
@@ -1011,16 +1011,15 @@
if (D->getStorageDuration() == SD_Static) {
bool ModulesCodegen = false;
- if (!D->getDescribedVarTemplate() && !D->getMemberSpecializationInfo() &&
+ if (Writer.WritingModule &&
+ !D->getDescribedVarTemplate() && !D->getMemberSpecializationInfo() &&
!isa<VarTemplateSpecializationDecl>(D)) {
// When building a C++ Modules TS module interface unit, a strong
// definition in the module interface is provided by the compilation of
// that module interface unit, not by its users. (Inline variables are
// still emitted in module users.)
ModulesCodegen =
- (((Writer.WritingModule &&
- Writer.WritingModule->Kind == Module::ModuleInterfaceUnit) ||
- Writer.Context->getLangOpts().BuildingPCHWithObjectFile) &&
+ (Writer.WritingModule->Kind == Module::ModuleInterfaceUnit &&
Writer.Context->GetGVALinkageForVariable(D) == GVA_StrongExternal);
}
Record.push_back(ModulesCodegen);
@@ -2451,9 +2450,8 @@
bool ModulesCodegen = false;
if (!FD->isDependentContext()) {
Optional<GVALinkage> Linkage;
- if ((Writer->WritingModule &&
- Writer->WritingModule->Kind == Module::ModuleInterfaceUnit) ||
- Writer->Context->getLangOpts().BuildingPCHWithObjectFile) {
+ if (Writer->WritingModule &&
+ Writer->WritingModule->Kind == Module::ModuleInterfaceUnit) {
// When building a C++ Modules TS module interface unit, a strong
// definition in the module interface is provided by the compilation of
// that module interface unit, not by its users. (Inline functions are
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits