From 39cfde236693a928ff6594ddc321c4550237cfaa Mon Sep 17 00:00:00 2001 From: Chuanqi Xu Date: Tue, 2 Aug 2022 11:08:41 +0800 Subject: 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. --- clang/lib/CodeGen/CodeGenModule.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'clang/lib/CodeGen/CodeGenModule.cpp') 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(D)) - continue; - assert(isa(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(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(D) && "PMF initializer decl is not a var?"); + assert(D->getKind() == Decl::Var && "PMF initializer decl is not a var?"); EmitTopLevelDecl(D); } } -- cgit v1.2.3