aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaojian Wu <hokein@google.com>2018-08-20 09:07:59 +0000
committerHaojian Wu <hokein@google.com>2018-08-20 09:07:59 +0000
commit02465baea2382d453e45bc1f6e69710accf3cc26 (patch)
treedc5b03254142d4f32b971d378a237f779fac0242
parent30ffdf42f78c35421f3ea0848846c11b4e36c331 (diff)
downloadllvm-02465baea2382d453e45bc1f6e69710accf3cc26.zip
llvm-02465baea2382d453e45bc1f6e69710accf3cc26.tar.gz
llvm-02465baea2382d453e45bc1f6e69710accf3cc26.tar.bz2
[clangd] Add missing lock in the lookup.
Reviewers: ioeric Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D50960 llvm-svn: 340156
-rw-r--r--clang-tools-extra/clangd/index/MemIndex.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/clang-tools-extra/clangd/index/MemIndex.cpp b/clang-tools-extra/clangd/index/MemIndex.cpp
index eca0bfe..83c036f 100644
--- a/clang-tools-extra/clangd/index/MemIndex.cpp
+++ b/clang-tools-extra/clangd/index/MemIndex.cpp
@@ -64,6 +64,7 @@ bool MemIndex::fuzzyFind(
void MemIndex::lookup(const LookupRequest &Req,
llvm::function_ref<void(const Symbol &)> Callback) const {
+ std::lock_guard<std::mutex> Lock(Mutex);
for (const auto &ID : Req.IDs) {
auto I = Index.find(ID);
if (I != Index.end())