diff --git a/clang-tools-extra/clangd/TUScheduler.cpp b/clang-tools-extra/clangd/TUScheduler.cpp --- a/clang-tools-extra/clangd/TUScheduler.cpp +++ b/clang-tools-extra/clangd/TUScheduler.cpp @@ -255,9 +255,11 @@ 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 Lock(Mutex);