[PATCH] D61734: [clangd] Bump index version and get rid of wrong assertion

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 9 08:30:25 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rCTE360349: [clangd] Bump index version and get rid of wrong assertion (authored by kadircet, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D61734?vs=198825&id=198828#toc

Repository:
  rCTE Clang Tools Extra

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61734/new/

https://reviews.llvm.org/D61734

Files:
  clangd/index/FileIndex.cpp
  clangd/index/Serialization.cpp


Index: clangd/index/Serialization.cpp
===================================================================
--- clangd/index/Serialization.cpp
+++ clangd/index/Serialization.cpp
@@ -370,7 +370,7 @@
 // The current versioning scheme is simple - non-current versions are rejected.
 // If you make a breaking change, bump this version number to invalidate stored
 // data. Later we may want to support some backward compatibility.
-constexpr static uint32_t Version = 9;
+constexpr static uint32_t Version = 10;
 
 llvm::Expected<IndexFileIn> readRIFF(llvm::StringRef Data) {
   auto RIFF = riff::readFile(Data);
Index: clangd/index/FileIndex.cpp
===================================================================
--- clangd/index/FileIndex.cpp
+++ clangd/index/FileIndex.cpp
@@ -138,7 +138,9 @@
     for (const RefSlab *Refs : MainFileRefs)
       for (const auto &Sym : *Refs) {
         auto It = Merged.find(Sym.first);
-        assert(It != Merged.end() && "Reference to unknown symbol");
+        // This might happen while background-index is still running.
+        if (It == Merged.end())
+          continue;
         It->getSecond().References += Sym.second.size();
       }
     SymsStorage.reserve(Merged.size());


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61734.198828.patch
Type: text/x-patch
Size: 1223 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190509/23f1a291/attachment.bin>


More information about the cfe-commits mailing list