diff options
-rw-r--r-- | clang-tools-extra/clangd/CodeComplete.cpp | 2 | ||||
-rw-r--r-- | clang-tools-extra/clangd/TUScheduler.h | 14 | ||||
-rw-r--r-- | clang-tools-extra/clangd/Threading.h | 14 |
3 files changed, 15 insertions, 15 deletions
diff --git a/clang-tools-extra/clangd/CodeComplete.cpp b/clang-tools-extra/clangd/CodeComplete.cpp index 434062097f6..030b4bada8d 100644 --- a/clang-tools-extra/clangd/CodeComplete.cpp +++ b/clang-tools-extra/clangd/CodeComplete.cpp @@ -31,7 +31,7 @@ #include "Protocol.h" #include "Quality.h" #include "SourceCode.h" -#include "TUScheduler.h" +#include "Threading.h" #include "Trace.h" #include "URI.h" #include "index/Index.h" diff --git a/clang-tools-extra/clangd/TUScheduler.h b/clang-tools-extra/clangd/TUScheduler.h index 3103af91ae3..ff2d4d48504 100644 --- a/clang-tools-extra/clangd/TUScheduler.h +++ b/clang-tools-extra/clangd/TUScheduler.h @@ -20,7 +20,6 @@ #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/StringMap.h" #include "llvm/ADT/StringRef.h" -#include <future> namespace clang { namespace clangd { @@ -259,19 +258,6 @@ private: std::chrono::steady_clock::duration UpdateDebounce; }; -/// Runs \p Action asynchronously with a new std::thread. The context will be -/// propagated. -template <typename T> -std::future<T> runAsync(llvm::unique_function<T()> Action) { - return std::async( - std::launch::async, - [](llvm::unique_function<T()> &&Action, Context Ctx) { - WithContext WithCtx(std::move(Ctx)); - return Action(); - }, - std::move(Action), Context::current().clone()); -} - } // namespace clangd } // namespace clang diff --git a/clang-tools-extra/clangd/Threading.h b/clang-tools-extra/clangd/Threading.h index 920b2e004ed..64caa49d858 100644 --- a/clang-tools-extra/clangd/Threading.h +++ b/clang-tools-extra/clangd/Threading.h @@ -14,6 +14,7 @@ #include "llvm/ADT/Twine.h" #include <cassert> #include <condition_variable> +#include <future> #include <memory> #include <mutex> #include <thread> @@ -117,6 +118,19 @@ private: std::size_t InFlightTasks = 0; }; +/// Runs \p Action asynchronously with a new std::thread. The context will be +/// propagated. +template <typename T> +std::future<T> runAsync(llvm::unique_function<T()> Action) { + return std::async( + std::launch::async, + [](llvm::unique_function<T()> &&Action, Context Ctx) { + WithContext WithCtx(std::move(Ctx)); + return Action(); + }, + std::move(Action), Context::current().clone()); +} + } // namespace clangd } // namespace clang #endif |