@@ -521,7 +521,7 @@ static void setVisibilityFromDLLStorageClass(const clang::LangOptions &LO,
521521
522522void CodeGenModule::Release () {
523523 Module *Primary = getContext ().getModuleForCodeGen ();
524- if (CXX20ModuleInits && Primary && !Primary->isHeaderLikeModule ())
524+ if (CXX20ModuleInits && Primary && !Primary->isModuleMapModule ())
525525 EmitModuleInitializers (Primary);
526526 EmitDeferred ();
527527 DeferredDecls.insert (EmittedDeferredDecls.begin (),
@@ -2521,23 +2521,21 @@ void CodeGenModule::EmitModuleInitializers(clang::Module *Primary) {
25212521 // source, first Global Module Fragments, if present.
25222522 if (auto GMF = Primary->getGlobalModuleFragment ()) {
25232523 for (Decl *D : getContext ().getModuleInitializers (GMF)) {
2524- if (isa<ImportDecl>(D))
2525- continue ;
2526- assert (isa<VarDecl>(D) && " GMF initializer decl is not a var?" );
2524+ assert (D->getKind () == Decl::Var && " GMF initializer decl is not a var?" );
25272525 EmitTopLevelDecl (D);
25282526 }
25292527 }
25302528 // Second any associated with the module, itself.
25312529 for (Decl *D : getContext ().getModuleInitializers (Primary)) {
25322530 // Skip import decls, the inits for those are called explicitly.
2533- if (isa<ImportDecl>(D) )
2531+ if (D-> getKind () == Decl::Import )
25342532 continue ;
25352533 EmitTopLevelDecl (D);
25362534 }
25372535 // Third any associated with the Privat eMOdule Fragment, if present.
25382536 if (auto PMF = Primary->getPrivateModuleFragment ()) {
25392537 for (Decl *D : getContext ().getModuleInitializers (PMF)) {
2540- assert (isa<VarDecl>(D) && " PMF initializer decl is not a var?" );
2538+ assert (D-> getKind () == Decl::Var && " PMF initializer decl is not a var?" );
25412539 EmitTopLevelDecl (D);
25422540 }
25432541 }
0 commit comments