summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clangd/index/FileIndex.cpp
diff options
context:
space:
mode:
authorKadir Cetinkaya <kadircet@google.com>2019-05-09 15:07:53 +0000
committerKadir Cetinkaya <kadircet@google.com>2019-05-09 15:07:53 +0000
commit40177ac6d1d567f8c001bc6b4bfbad4ea56c36e6 (patch)
treeeea07e0d9acd8318968d9b8e932c488f6571779a /clang-tools-extra/clangd/index/FileIndex.cpp
parent0268083329c3a27d330b8520087320c17e65e007 (diff)
downloadbcm5719-llvm-40177ac6d1d567f8c001bc6b4bfbad4ea56c36e6.tar.gz
bcm5719-llvm-40177ac6d1d567f8c001bc6b4bfbad4ea56c36e6.zip
[clangd] Bump index version and get rid of wrong assertion
Summary: After rL360344, BackgroundIndex expects symbols with zero refcounts. Therefore existing index files are no longer valid. Assertion regarding finding target of a reference was wrong, since background-index might still be going on or we might've loaded only some part of the shards and might be missing the declaring shards for the symbol. Reviewers: ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D61734 llvm-svn: 360349
Diffstat (limited to 'clang-tools-extra/clangd/index/FileIndex.cpp')
-rw-r--r--clang-tools-extra/clangd/index/FileIndex.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/clang-tools-extra/clangd/index/FileIndex.cpp b/clang-tools-extra/clangd/index/FileIndex.cpp
index 22c6e860fb8..49746ae926b 100644
--- a/clang-tools-extra/clangd/index/FileIndex.cpp
+++ b/clang-tools-extra/clangd/index/FileIndex.cpp
@@ -138,7 +138,9 @@ FileSymbols::buildIndex(IndexType Type, DuplicateHandling DuplicateHandle) {
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());
OpenPOWER on IntegriCloud