diff --git a/clang-tools-extra/clangd/GlobalCompilationDatabase.cpp b/clang-tools-extra/clangd/GlobalCompilationDatabase.cpp --- a/clang-tools-extra/clangd/GlobalCompilationDatabase.cpp +++ b/clang-tools-extra/clangd/GlobalCompilationDatabase.cpp @@ -285,9 +285,12 @@ /*ErrorMsg*/ std::string &)> Parser; }; - for (const auto &Entry : {CDBFile{&CompileCommandsJson, parseJSON}, - CDBFile{&BuildCompileCommandsJson, parseJSON}, - CDBFile{&CompileFlagsTxt, parseFixed}}) { + CDBFile Files[] = { + {&CompileCommandsJson, parseJSON}, + {&BuildCompileCommandsJson, parseJSON}, + {&CompileFlagsTxt, parseFixed}, + }; + for (const auto &Entry : Files) { bool Active = ActiveCachedFile == Entry.File; auto Loaded = Entry.File->load(FS, Active); switch (Loaded.Result) {