summaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorChuanqi Xu <yedeng.yd@linux.alibaba.com>2022-08-02 11:08:41 +0800
committerChuanqi Xu <yedeng.yd@linux.alibaba.com>2022-08-02 11:09:38 +0800
commit39cfde236693a928ff6594ddc321c4550237cfaa (patch)
treea748845232dee44b4e34b8efb9316ea4b7a50c61 /clang/lib/CodeGen/CodeGenModule.cpp
parent29f852a1516bcd3928dad74835965f238de34409 (diff)
Revert "[C++20] [Modules] Handle initializer for Header Units"
This reverts commit db6152ad66d7cf48f9f5c3eb28bf54c092978773. This commit fails in ppc64. Since we want to backport it to 15.x. So revert it now to keep the patch complete.
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index dc1122f3ab67..579ebba7736d 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -521,7 +521,7 @@ static void setVisibilityFromDLLStorageClass(const clang::LangOptions &LO,
void CodeGenModule::Release() {
Module *Primary = getContext().getModuleForCodeGen();
- if (CXX20ModuleInits && Primary && !Primary->isHeaderLikeModule())
+ if (CXX20ModuleInits && Primary && !Primary->isModuleMapModule())
EmitModuleInitializers(Primary);
EmitDeferred();
DeferredDecls.insert(EmittedDeferredDecls.begin(),
@@ -2521,23 +2521,21 @@ void CodeGenModule::EmitModuleInitializers(clang::Module *Primary) {
// source, first Global Module Fragments, if present.
if (auto GMF = Primary->getGlobalModuleFragment()) {
for (Decl *D : getContext().getModuleInitializers(GMF)) {
- if (isa<ImportDecl>(D))
- continue;
- assert(isa<VarDecl>(D) && "GMF initializer decl is not a var?");
+ assert(D->getKind() == Decl::Var && "GMF initializer decl is not a var?");
EmitTopLevelDecl(D);
}
}
// Second any associated with the module, itself.
for (Decl *D : getContext().getModuleInitializers(Primary)) {
// Skip import decls, the inits for those are called explicitly.
- if (isa<ImportDecl>(D))
+ if (D->getKind() == Decl::Import)
continue;
EmitTopLevelDecl(D);
}
// Third any associated with the Privat eMOdule Fragment, if present.
if (auto PMF = Primary->getPrivateModuleFragment()) {
for (Decl *D : getContext().getModuleInitializers(PMF)) {
- assert(isa<VarDecl>(D) && "PMF initializer decl is not a var?");
+ assert(D->getKind() == Decl::Var && "PMF initializer decl is not a var?");
EmitTopLevelDecl(D);
}
}