diff --git a/clang-tools-extra/clangd/ClangdLSPServer.cpp b/clang-tools-extra/clangd/ClangdLSPServer.cpp --- a/clang-tools-extra/clangd/ClangdLSPServer.cpp +++ b/clang-tools-extra/clangd/ClangdLSPServer.cpp @@ -371,16 +371,6 @@ llvm::StringMap> Notifications; llvm::StringMap> Calls; - // The maximum number of callbacks held in clangd. - // - // We bound the maximum size to the pending map to prevent memory leakage - // for cases where LSP clients don't reply for the request. - static constexpr int MaxReplayCallbacks = 100; - mutable std::mutex CallMutex; - int NextCallID = 0; /* GUARDED_BY(CallMutex) */ - std::deque>> - ReplyCallbacks; /* GUARDED_BY(CallMutex) */ // Method calls may be cancelled by ID, so keep track of their state. // This needs a mutex: handlers may finish on a different thread, and that's @@ -432,6 +422,17 @@ })); } + // The maximum number of callbacks held in clangd. + // + // We bound the maximum size to the pending map to prevent memory leakage + // for cases where LSP clients don't reply for the request. + static constexpr int MaxReplayCallbacks = 100; + mutable std::mutex CallMutex; + int NextCallID = 0; /* GUARDED_BY(CallMutex) */ + std::deque>> + ReplyCallbacks; /* GUARDED_BY(CallMutex) */ + ClangdLSPServer &Server; }; constexpr int ClangdLSPServer::MessageHandler::MaxReplayCallbacks;