llvm/clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp

//===-- TUSchedulerTests.cpp ------------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "Annotations.h"
#include "ClangdServer.h"
#include "Compiler.h"
#include "Config.h"
#include "Diagnostics.h"
#include "GlobalCompilationDatabase.h"
#include "Matchers.h"
#include "ParsedAST.h"
#include "Preamble.h"
#include "TUScheduler.h"
#include "TestFS.h"
#include "TestIndex.h"
#include "clang-include-cleaner/Record.h"
#include "support/Cancellation.h"
#include "support/Context.h"
#include "support/Path.h"
#include "support/TestTracer.h"
#include "support/Threading.h"
#include "clang/Basic/DiagnosticDriver.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/FunctionExtras.h"
#include "llvm/ADT/ScopeExit.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringRef.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <cstdint>
#include <functional>
#include <memory>
#include <mutex>
#include <optional>
#include <string>
#include <utility>
#include <vector>

namespace clang {
namespace clangd {
namespace {

AllOf;
AnyOf;
Contains;
Each;
ElementsAre;
Eq;
Field;
IsEmpty;
Not;
Pair;
Pointee;
SizeIs;
UnorderedElementsAre;

MATCHER_P2(TUState, PreambleActivity, ASTActivity, "") {}

// Simple ContextProvider to verify the provider is invoked & contexts are used.
static Key<std::string> BoundPath;
Context bindPath(PathRef F) {}
llvm::StringRef boundPath() {}

TUScheduler::Options optsForTest() {}

class TUSchedulerTests : public ::testing::Test {};

Key<llvm::unique_function<void(PathRef File, std::vector<Diag>)>>
    TUSchedulerTests::DiagsCallbackKey;

TEST_F(TUSchedulerTests, MissingFiles) {}

TEST_F(TUSchedulerTests, WantDiagnostics) {}

TEST_F(TUSchedulerTests, Debounce) {}

TEST_F(TUSchedulerTests, Cancellation) {}

TEST_F(TUSchedulerTests, InvalidationNoCrash) {}

TEST_F(TUSchedulerTests, Invalidation) {}

// We don't invalidate requests for updates that don't change the file content.
// These are mostly "refresh this file" events synthesized inside clangd itself.
// (Usually the AST rebuild is elided after verifying that all inputs are
// unchanged, but invalidation decisions happen earlier and so independently).
// See https://github.com/clangd/clangd/issues/620
TEST_F(TUSchedulerTests, InvalidationUnchanged) {}

TEST_F(TUSchedulerTests, ManyUpdates) {}

TEST_F(TUSchedulerTests, EvictedAST) {}

// We send "empty" changes to TUScheduler when we think some external event
// *might* have invalidated current state (e.g. a header was edited).
// Verify that this doesn't evict our cache entries.
TEST_F(TUSchedulerTests, NoopChangesDontThrashCache) {}

TEST_F(TUSchedulerTests, EmptyPreamble) {}

TEST_F(TUSchedulerTests, ASTSignalsSmokeTests) {}

TEST_F(TUSchedulerTests, RunWaitsForPreamble) {}

TEST_F(TUSchedulerTests, NoopOnEmptyChanges) {}

// We rebuild if a completely missing header exists, but not if one is added
// on a higher-priority include path entry (for performance).
// (Previously we wouldn't automatically rebuild when files were added).
TEST_F(TUSchedulerTests, MissingHeader) {}

TEST_F(TUSchedulerTests, NoChangeDiags) {}

TEST_F(TUSchedulerTests, Run) {}

TEST_F(TUSchedulerTests, TUStatus) {}

TEST_F(TUSchedulerTests, CommandLineErrors) {}

TEST_F(TUSchedulerTests, CommandLineWarnings) {}

TEST(DebouncePolicy, Compute) {}

TEST_F(TUSchedulerTests, AsyncPreambleThread) {}

TEST_F(TUSchedulerTests, OnlyPublishWhenPreambleIsBuilt) {}

TEST_F(TUSchedulerTests, PublishWithStalePreamble) {}

// If a header file is missing from the CDB (or inferred using heuristics), and
// it's included by another open file, then we parse it using that files flags.
TEST_F(TUSchedulerTests, IncluderCache) {}

TEST_F(TUSchedulerTests, PreservesLastActiveFile) {}

TEST_F(TUSchedulerTests, PreambleThrottle) {}

} // namespace
} // namespace clangd
} // namespace clang