================ @@ -1245,6 +1245,27 @@ void Sema::ActOnEndOfTranslationUnit() { } } + // Now we can decide whether the modules we're building need an initializer. + if (Module *CurrentModule = getCurrentModule(); + CurrentModule && CurrentModule->isInterfaceOrPartition()) { + auto DoesModNeedInit = [this](Module *M) { + if (!getASTContext().getModuleInitializers(M).empty()) + return false; + for (auto [Exported, _] : M->Exports) + if (!Exported->isNamedModuleInterfaceHasNoInit()) + return false; + for (Module *I : M->Imports) + if (!I->isNamedModuleInterfaceHasNoInit()) + return false; + + return true; + }; + + CurrentModule->NamedModuleHasNoInit = DoesModNeedInit(CurrentModule); + for (Module *SubModules : CurrentModule->submodules()) + CurrentModule->NamedModuleHasNoInit &= DoesModNeedInit(SubModules); ---------------- ChuanqiXu9 wrote:
Thanks for the suggestion. It is addressed in the NFC patch: https://github.com/llvm/llvm-project/commit/7e8a0e4bdc84f975772cd6d38a78c285bdd8b6cf https://github.com/llvm/llvm-project/pull/67638 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits