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

//===--- PreambleTests.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 "Compiler.h"
#include "Config.h"
#include "Diagnostics.h"
#include "Headers.h"
#include "Hover.h"
#include "ParsedAST.h"
#include "Preamble.h"
#include "Protocol.h"
#include "SourceCode.h"
#include "TestFS.h"
#include "TestTU.h"
#include "XRefs.h"
#include "support/Context.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Format/Format.h"
#include "clang/Frontend/FrontendActions.h"
#include "clang/Frontend/PrecompiledPreamble.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/ScopedPrinter.h"
#include "llvm/Support/VirtualFileSystem.h"
#include "llvm/Testing/Annotations/Annotations.h"
#include "gmock/gmock.h"
#include "gtest/gtest-matchers.h"
#include "gtest/gtest.h"
#include <memory>
#include <optional>
#include <string>
#include <utility>
#include <vector>

AllOf;
Contains;
ElementsAre;
Field;
IsEmpty;
Matcher;
MatchesRegex;
UnorderedElementsAre;
UnorderedElementsAreArray;

namespace clang {
namespace clangd {
namespace {

MATCHER_P2(Distance, File, D, "") {}

// Builds a preamble for BaselineContents, patches it for ModifiedContents and
// returns the includes in the patch.
IncludeStructure
collectPatchedIncludes(llvm::StringRef ModifiedContents,
                       llvm::StringRef BaselineContents,
                       llvm::StringRef MainFileName = "main.cpp") {}

// Check preamble lexing logic by building an empty preamble and patching it
// with all the contents.
TEST(PreamblePatchTest, IncludeParsing) {}

TEST(PreamblePatchTest, ContainsNewIncludes) {}

TEST(PreamblePatchTest, MainFileIsEscaped) {}

TEST(PreamblePatchTest, PatchesPreambleIncludes) {}

std::optional<ParsedAST>
createPatchedAST(llvm::StringRef Baseline, llvm::StringRef Modified,
                 llvm::StringMap<std::string> AdditionalFiles = {}

std::string getPreamblePatch(llvm::StringRef Baseline,
                             llvm::StringRef Modified) {}

TEST(PreamblePatchTest, IncludesArePreserved) {}

TEST(PreamblePatchTest, Define) {}

TEST(PreamblePatchTest, OrderingPreserved) {}

TEST(PreamblePatchTest, LocateMacroAtWorks) {}

TEST(PreamblePatchTest, LocateMacroAtDeletion) {}

MATCHER_P(referenceRangeIs, R, "") {}

TEST(PreamblePatchTest, RefsToMacros) {}

TEST(TranslatePreamblePatchLocation, Simple) {}

TEST(PreamblePatch, ModifiedBounds) {}

TEST(PreamblePatch, MacroLoc) {}

TEST(PreamblePatch, NoopWhenNotRequested) {}

::testing::Matcher<const Diag &>
withNote(::testing::Matcher<Note> NoteMatcher) {}
MATCHER_P(Diag, Range, "Diag at " + llvm::to_string(Range)) {}
MATCHER_P2(Diag, Range, Name,
           "Diag at " + llvm::to_string(Range) + " = [" + Name + "]") {}

TEST(PreamblePatch, DiagnosticsFromMainASTAreInRightPlace) {}

TEST(PreamblePatch, DiagnosticsToPreamble) {}

TEST(PreamblePatch, TranslatesDiagnosticsInPreamble) {}

MATCHER_P2(Mark, Range, Text, "") {}

TEST(PreamblePatch, MacroAndMarkHandling) {}

TEST(PreamblePatch, PatchFileEntry) {}

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