10#include "clang-include-cleaner/Record.h"
12#include "gtest/gtest.h"
20 auto Index = std::make_unique<FileIndex>(
true);
21 for (
const auto &Input : Inputs) {
22 if (!Input.second.IsMainFile)
24 TU.Code = Input.second.Code;
25 TU.Filename = Input.first().str();
27 std::shared_ptr<const include_cleaner::PragmaIncludes> PI) {
30 Index->updatePreamble(
testPath(Input.first()),
"null", Ctx, PP, *PI);
33 Index->updateMain(
testPath(Input.first()), MainAST);
39 auto It = Inputs.find(Filename);
40 if (It == Inputs.end()) {
41 ADD_FAILURE() <<
"Accessing non-existing file: " << Filename;
44 TU.Code = It->second.Code;
45 TU.Filename = It->first().str();
49void TestWorkspace::addInput(llvm::StringRef Filename,
50 const SourceFile &Input) {
51 Inputs.insert(std::make_pair(Filename, Input));
Stores and provides access to parsed AST.
static std::optional< ParsedAST > build(llvm::StringRef Filename, const ParseInputs &Inputs, std::unique_ptr< clang::CompilerInvocation > CI, llvm::ArrayRef< Diag > CompilerInvocationDiags, std::shared_ptr< const PreambleData > Preamble)
Attempts to run Clang and store the parsed AST.
std::optional< ParsedAST > openFile(llvm::StringRef Filename)
std::unique_ptr< SymbolIndex > index()
FIXME: Skip testing on windows temporarily due to the different escaping code mode.
std::string testPath(PathRef File, llvm::sys::path::Style Style)
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
The captured AST context.
Preprocessor & getPreprocessor()
ASTContext & getASTContext()
llvm::StringMap< std::string > AdditionalFiles