diff --git a/clang/lib/CodeGen/CGDeclCXX.cpp b/clang/lib/CodeGen/CGDeclCXX.cpp index 30683ad474cd2..e10617162733b 100644 --- a/clang/lib/CodeGen/CGDeclCXX.cpp +++ b/clang/lib/CodeGen/CGDeclCXX.cpp @@ -675,7 +675,7 @@ void CodeGenModule::EmitCXXModuleInitFunc(Module *Primary) { AllImports.insert(M); // Ones that we import in the global module fragment or the private module // fragment. - llvm::for_each(Primary->submodules(), [&AllImports](Module *SubM) { + for (Module *SubM : Primary->submodules()) { assert((SubM->isGlobalModule() || SubM->isPrivateModule()) && "The sub modules of C++20 module unit should only be global module " "fragments or private module framents."); @@ -684,7 +684,7 @@ void CodeGenModule::EmitCXXModuleInitFunc(Module *Primary) { "not allowed to export import modules."); for (Module *M : SubM->Imports) AllImports.insert(M); - }); + } SmallVector ModuleInits; for (Module *M : AllImports) {