[clang-tools-extra] r340156 - [clangd] Add missing lock in the lookup.

Haojian Wu via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 20 02:07:59 PDT 2018


Author: hokein
Date: Mon Aug 20 02:07:59 2018
New Revision: 340156

URL: http://llvm.org/viewvc/llvm-project?rev=340156&view=rev
Log:
[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

Modified:
    clang-tools-extra/trunk/clangd/index/MemIndex.cpp

Modified: clang-tools-extra/trunk/clangd/index/MemIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/index/MemIndex.cpp?rev=340156&r1=340155&r2=340156&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/index/MemIndex.cpp (original)
+++ clang-tools-extra/trunk/clangd/index/MemIndex.cpp Mon Aug 20 02:07:59 2018
@@ -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())




More information about the cfe-commits mailing list