[clang-tools-extra] 2a6eedb - [clangd] Destroy context before resetting CurrentReq

Kadir Cetinkaya via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 8 00:58:18 PDT 2020


Author: Kadir Cetinkaya
Date: 2020-04-08T09:57:55+02:00
New Revision: 2a6eedbb51fd612d3386b0379938036b17511ae0

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

LOG: [clangd] Destroy context before resetting CurrentReq

Summary:
Our tests stash callbacks into request context and rely on it being
invoked before threads going idle.

Reviewers: sammccall

Subscribers: ilya-biryukov, javed.absar, MaskRay, jkorous, arphaman, usaxena95, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D77671

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clangd/TUScheduler.cpp b/clang-tools-extra/clangd/TUScheduler.cpp
index 46ec8e91d5a1..6b2d3368578c 100644
--- a/clang-tools-extra/clangd/TUScheduler.cpp
+++ b/clang-tools-extra/clangd/TUScheduler.cpp
@@ -255,9 +255,11 @@ class PreambleThread {
         NextReq.reset();
       }
 
-      WithContext Guard(std::move(CurrentReq->Ctx));
-      // Build the preamble and let the waiters know about it.
-      build(std::move(*CurrentReq));
+      {
+        WithContext Guard(std::move(CurrentReq->Ctx));
+        // Build the preamble and let the waiters know about it.
+        build(std::move(*CurrentReq));
+      }
       bool IsEmpty = false;
       {
         std::lock_guard<std::mutex> Lock(Mutex);


        


More information about the cfe-commits mailing list