Author: Sam McCall
Date: 2021-07-26T11:38:47+02:00
New Revision: e9274af7189333d1f50e47098d9ae30522d7193f

URL: 
https://github.com/llvm/llvm-project/commit/e9274af7189333d1f50e47098d9ae30522d7193f
DIFF: 
https://github.com/llvm/llvm-project/commit/e9274af7189333d1f50e47098d9ae30522d7193f.diff

LOG: Revert "[clangd] Avoid range-loop init-list lifetime subtleties."

This reverts commit 253b8145dedbe8d10792f44b4af7f52dbecd527f.

This doesn't actually fix anything - I should stop guessing.
See https://github.com/clangd/clangd/issues/800 for update

Added: 
    

Modified: 
    clang-tools-extra/clangd/GlobalCompilationDatabase.cpp

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clangd/GlobalCompilationDatabase.cpp 
b/clang-tools-extra/clangd/GlobalCompilationDatabase.cpp
index 73f19abaeb9d..d830190bfdfd 100644
--- a/clang-tools-extra/clangd/GlobalCompilationDatabase.cpp
+++ b/clang-tools-extra/clangd/GlobalCompilationDatabase.cpp
@@ -276,7 +276,7 @@ bool 
DirectoryBasedGlobalCompilationDatabase::DirectoryCache::load(
   // For these, we know the files they read and cache their metadata so we can
   // cheaply validate whether they've changed, and hot-reload if they have.
   // (As a bonus, these are also VFS-clean)!
-  struct {
+  struct CDBFile {
     CachedFile *File;
     // Wrapper for {Fixed,JSON}CompilationDatabase::loadFromBuffer.
     llvm::function_ref<std::unique_ptr<tooling::CompilationDatabase>(
@@ -284,12 +284,10 @@ bool 
DirectoryBasedGlobalCompilationDatabase::DirectoryCache::load(
         /*Data*/ llvm::StringRef,
         /*ErrorMsg*/ std::string &)>
         Parser;
-  } Files[] = {
-      {&CompileCommandsJson, parseJSON},
-      {&BuildCompileCommandsJson, parseJSON},
-      {&CompileFlagsTxt, parseFixed},
   };
-  for (const auto &Entry : Files) {
+  for (const auto &Entry : {CDBFile{&CompileCommandsJson, parseJSON},
+                            CDBFile{&BuildCompileCommandsJson, parseJSON},
+                            CDBFile{&CompileFlagsTxt, parseFixed}}) {
     bool Active = ActiveCachedFile == Entry.File;
     auto Loaded = Entry.File->load(FS, Active);
     switch (Loaded.Result) {


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to