diff options
Diffstat (limited to 'clang-tools-extra/clangd/TUScheduler.h')
-rw-r--r-- | clang-tools-extra/clangd/TUScheduler.h | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/clang-tools-extra/clangd/TUScheduler.h b/clang-tools-extra/clangd/TUScheduler.h index c7df8c4dba1..c984b711209 100644 --- a/clang-tools-extra/clangd/TUScheduler.h +++ b/clang-tools-extra/clangd/TUScheduler.h @@ -11,9 +11,9 @@ #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_TUSCHEDULER_H #include "ClangdUnit.h" -#include "ClangdUnitStore.h" #include "Function.h" #include "Threading.h" +#include "llvm/ADT/StringMap.h" namespace clang { namespace clangd { @@ -42,6 +42,7 @@ class TUScheduler { public: TUScheduler(unsigned AsyncThreadsCount, bool StorePreamblesInMemory, ASTParsedCallback ASTCallback); + ~TUScheduler(); /// Returns estimated memory usage for each of the currently open files. /// The order of results is unspecified. @@ -55,12 +56,8 @@ public: OnUpdated); /// Remove \p File from the list of tracked files and schedule removal of its - /// resources. \p Action will be called when resources are freed. - /// If an error occurs during processing, it is forwarded to the \p Action - /// callback. - /// FIXME(ibiryukov): the callback passed to this function is not used, we - /// should remove it. - void remove(PathRef File, UniqueFunction<void(llvm::Error)> Action); + /// resources. + void remove(PathRef File); /// Schedule an async read of the AST. \p Action will be called when AST is /// ready. The AST passed to \p Action refers to the version of \p File @@ -81,11 +78,17 @@ public: UniqueFunction<void(llvm::Expected<InputsAndPreamble>)> Action); private: - const ParseInputs &getInputs(PathRef File); + /// This class stores per-file data in the Files map. + struct FileData; - llvm::StringMap<ParseInputs> CachedInputs; - CppFileCollection Files; - ThreadPool Threads; + const bool StorePreamblesInMemory; + const std::shared_ptr<PCHContainerOperations> PCHOps; + const ASTParsedCallback ASTCallback; + Semaphore Barrier; + llvm::StringMap<std::unique_ptr<FileData>> Files; + // None when running tasks synchronously and non-None when running tasks + // asynchronously. + llvm::Optional<AsyncTaskRunner> Tasks; }; } // namespace clangd } // namespace clang |