Lines Matching defs:ASTWorker
8 // TUScheduler manages a worker per active file. This ASTWorker processes
12 // Each ASTWorker owns a dedicated thread to process updates and reads to the
20 // ASTWorker processes the file in two parts, a preamble and a main-file
26 // version of the file. ASTWorker eliminates such requests as they are
29 // In the presence of stale (non-compatible) preambles, ASTWorker won't publish
34 // ASTWorker owns a PreambleThread for building preambles. If the preamble gets
46 // concurrently, ASTWorker runs these requests on their own thread. These
136 class ASTWorker;
153 using Key = const ASTWorker *;
246 /// threads, remove()s mostly from the main thread, and get() from ASTWorker.
434 ASTWorker &AW)
509 // Preamble tasks are always scheduled by ASTWorker tasks, and we
570 /// Notifies ASTWorker after build finishes.
590 ASTWorker &ASTPeer;
598 /// Each ASTWorker processes the async requests sent to it on a separate
600 /// The ASTWorker that manages the AST is shared by both the processing thread
601 /// and the TUScheduler. The TUScheduler should discard an ASTWorker when
606 class ASTWorker {
608 ASTWorker(PathRef FileName, const GlobalCompilationDatabase &CDB,
615 /// Create a new ASTWorker and return a handle to it.
626 ~ASTWorker();
627 ASTWorker(const ASTWorker &other) = delete;
628 ASTWorker &operator=(const ASTWorker &other) = delete;
639 /// Used to inform ASTWorker about a new preamble build by PreambleThread.
719 /// File that ASTWorker is responsible for.
749 /// building. Only written by ASTWorker's thread.
772 /// A smart-pointer-like class that points to an active ASTWorker.
773 /// In destructor, signals to the underlying ASTWorker that no new requests will
777 friend class ASTWorker;
778 ASTWorkerHandle(std::shared_ptr<ASTWorker> Worker)
794 ASTWorker &operator*() {
799 ASTWorker *operator->() {
804 /// Returns an owning reference to the underlying ASTWorker that can outlive
805 /// the ASTWorkerHandle. However, no new requests to an active ASTWorker can
808 std::shared_ptr<const ASTWorker> lock() { return Worker; }
811 std::shared_ptr<ASTWorker> Worker;
815 ASTWorker::create(PathRef FileName, const GlobalCompilationDatabase &CDB,
821 std::shared_ptr<ASTWorker> Worker(
822 new ASTWorker(FileName, CDB, IdleASTs, HeaderIncluders, Barrier,
825 Tasks->runAsync("ASTWorker:" + llvm::sys::path::filename(FileName),
834 ASTWorker::ASTWorker(PathRef FileName, const GlobalCompilationDatabase &CDB,
852 ASTWorker::~ASTWorker() {
859 "unprocessed requests when destroying ASTWorker");
863 void ASTWorker::update(ParseInputs Inputs, WantDiagnostics WantDiags,
908 log("ASTWorker building file {0} version {1} with command {2}\n[{3}]\n{4}",
966 // LatestPreamble is only populated by ASTWorker thread.
974 void ASTWorker::runWithAST(
991 vlog("ASTWorker rebuilding evicted AST to run {0}: {1} version {2}", Name,
995 // return a compatible preamble as ASTWorker::update blocks.
1011 vlog("ASTWorker running {0} on version {2} of {1}", Name, FileName,
1104 void ASTWorker::updatePreamble(std::unique_ptr<CompilerInvocation> CI,
1114 // Update the preamble inside ASTWorker queue to ensure atomicity. As a task
1115 // running inside ASTWorker assumes internals won't change until it
1165 void ASTWorker::updateASTSignals(ParsedAST &AST) {
1175 void ASTWorker::generateDiagnostics(
1262 // AST might've been built for an older version of the source, as ASTWorker
1271 std::shared_ptr<const PreambleData> ASTWorker::getPossiblyStalePreamble(
1279 void ASTWorker::waitForFirstPreamble() const {
1284 tooling::CompileCommand ASTWorker::getCurrentCompileCommand() const {
1289 TUScheduler::FileStats ASTWorker::stats() const {
1302 bool ASTWorker::isASTCached() const { return IdleASTs.getUsedBytes(this) != 0; }
1304 void ASTWorker::stop() {
1321 void ASTWorker::runTask(llvm::StringRef Name, llvm::function_ref<void()> Task) {
1331 void ASTWorker::startTask(llvm::StringRef Name,
1394 void ASTWorker::run() {
1481 Deadline ASTWorker::scheduleLocked() {
1508 vlog("ASTWorker skipping {0} for {1}", Requests.front().Name, FileName);
1526 bool ASTWorker::shouldSkipHeadLocked() const {
1553 bool ASTWorker::blockUntilIdle(Deadline Timeout) const {
1560 // Make sure ASTWorker has processed all requests, which might issue new
1564 // Now that ASTWorker processed all requests, ensure PreamblePeer has served
1566 // ASTWorker.
1571 "blockUntilIdle(): ASTWorker isn't threadsafe");
1572 // Finally make sure ASTWorker has processed all of the preamble updates.
1681 ASTWorkerHandle Worker = ASTWorker::create(
1783 std::shared_ptr<const ASTWorker> Worker = It->second->Worker.lock();