Mercurial > hg > CbC > CbC_llvm
comparison clang-tools-extra/clangd/TUScheduler.h @ 252:1f2b6ac9f198 llvm-original
LLVM16-1
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 18 Aug 2023 09:04:13 +0900 |
parents | c4bab56944e8 |
children |
comparison
equal
deleted
inserted
replaced
237:c80f45b162ad | 252:1f2b6ac9f198 |
---|---|
11 | 11 |
12 #include "ASTSignals.h" | 12 #include "ASTSignals.h" |
13 #include "Compiler.h" | 13 #include "Compiler.h" |
14 #include "Diagnostics.h" | 14 #include "Diagnostics.h" |
15 #include "GlobalCompilationDatabase.h" | 15 #include "GlobalCompilationDatabase.h" |
16 #include "index/CanonicalIncludes.h" | 16 #include "clang-include-cleaner/Record.h" |
17 #include "support/Function.h" | 17 #include "support/Function.h" |
18 #include "support/MemoryTree.h" | 18 #include "support/MemoryTree.h" |
19 #include "support/Path.h" | 19 #include "support/Path.h" |
20 #include "support/Threading.h" | 20 #include "support/Threading.h" |
21 #include "llvm/ADT/Optional.h" | |
22 #include "llvm/ADT/StringMap.h" | 21 #include "llvm/ADT/StringMap.h" |
23 #include "llvm/ADT/StringRef.h" | 22 #include "llvm/ADT/StringRef.h" |
24 #include <chrono> | 23 #include <chrono> |
24 #include <memory> | |
25 #include <optional> | |
25 #include <string> | 26 #include <string> |
26 | 27 |
27 namespace clang { | 28 namespace clang { |
28 namespace clangd { | 29 namespace clangd { |
29 class ParsedAST; | 30 class ParsedAST; |
159 virtual ~ParsingCallbacks() = default; | 160 virtual ~ParsingCallbacks() = default; |
160 | 161 |
161 /// Called on the AST that was built for emitting the preamble. The built AST | 162 /// Called on the AST that was built for emitting the preamble. The built AST |
162 /// contains only AST nodes from the #include directives at the start of the | 163 /// contains only AST nodes from the #include directives at the start of the |
163 /// file. AST node in the current file should be observed on onMainAST call. | 164 /// file. AST node in the current file should be observed on onMainAST call. |
164 virtual void onPreambleAST(PathRef Path, llvm::StringRef Version, | 165 virtual void |
165 const CompilerInvocation &CI, ASTContext &Ctx, | 166 onPreambleAST(PathRef Path, llvm::StringRef Version, CapturedASTCtx Ctx, |
166 Preprocessor &PP, const CanonicalIncludes &) {} | 167 std::shared_ptr<const include_cleaner::PragmaIncludes>) {} |
167 | |
168 /// The argument function is run under the critical section guarding against | 168 /// The argument function is run under the critical section guarding against |
169 /// races when closing the files. | 169 /// races when closing the files. |
170 using PublishFn = llvm::function_ref<void(llvm::function_ref<void()>)>; | 170 using PublishFn = llvm::function_ref<void(llvm::function_ref<void()>)>; |
171 /// Called on the AST built for the file itself. Note that preamble AST nodes | 171 /// Called on the AST built for the file itself. Note that preamble AST nodes |
172 /// are not deserialized and should be processed in the onPreambleAST call | 172 /// are not deserialized and should be processed in the onPreambleAST call |
350 // order to get the file name into the index implementations. Do not depend on | 350 // order to get the file name into the index implementations. Do not depend on |
351 // this inside clangd. | 351 // this inside clangd. |
352 // FIXME: remove this when there is proper index support via build system | 352 // FIXME: remove this when there is proper index support via build system |
353 // integration. | 353 // integration. |
354 // FIXME: move to ClangdServer via createProcessingContext. | 354 // FIXME: move to ClangdServer via createProcessingContext. |
355 static llvm::Optional<llvm::StringRef> getFileBeingProcessedInContext(); | 355 static std::optional<llvm::StringRef> getFileBeingProcessedInContext(); |
356 | 356 |
357 void profile(MemoryTree &MT) const; | 357 void profile(MemoryTree &MT) const; |
358 | 358 |
359 private: | 359 private: |
360 void runWithSemaphore(llvm::StringRef Name, llvm::StringRef Path, | 360 void runWithSemaphore(llvm::StringRef Name, llvm::StringRef Path, |
366 Semaphore Barrier; | 366 Semaphore Barrier; |
367 Semaphore QuickRunBarrier; | 367 Semaphore QuickRunBarrier; |
368 llvm::StringMap<std::unique_ptr<FileData>> Files; | 368 llvm::StringMap<std::unique_ptr<FileData>> Files; |
369 std::unique_ptr<ASTCache> IdleASTs; | 369 std::unique_ptr<ASTCache> IdleASTs; |
370 std::unique_ptr<HeaderIncluderCache> HeaderIncluders; | 370 std::unique_ptr<HeaderIncluderCache> HeaderIncluders; |
371 // None when running tasks synchronously and non-None when running tasks | 371 // std::nullopt when running tasks synchronously and non-std::nullopt when |
372 // asynchronously. | 372 // running tasks asynchronously. |
373 llvm::Optional<AsyncTaskRunner> PreambleTasks; | 373 std::optional<AsyncTaskRunner> PreambleTasks; |
374 llvm::Optional<AsyncTaskRunner> WorkerThreads; | 374 std::optional<AsyncTaskRunner> WorkerThreads; |
375 // Used to create contexts for operations that are not bound to a particular | 375 // Used to create contexts for operations that are not bound to a particular |
376 // file (e.g. index queries). | 376 // file (e.g. index queries). |
377 std::string LastActiveFile; | 377 std::string LastActiveFile; |
378 }; | 378 }; |
379 | 379 |