Go to the documentation of this file.
22 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_PREAMBLE_H
23 #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_PREAMBLE_H
32 #include "clang/Frontend/CompilerInvocation.h"
33 #include "clang/Frontend/PrecompiledPreamble.h"
34 #include "clang/Lex/Lexer.h"
35 #include "clang/Tooling/CompilationDatabase.h"
36 #include "llvm/ADT/StringRef.h"
53 std::unique_ptr<PreambleFileStatusCache>
StatCache,
75 std::function<void(ASTContext &, std::shared_ptr<clang::Preprocessor>,
81 std::shared_ptr<const PreambleData>
92 const CompilerInvocation &
CI);
113 void apply(CompilerInvocation &
CI)
const;
127 llvm::StringRef
text()
const {
return PatchContents; }
131 std::string PatchContents;
132 std::string PatchFileName;
135 std::vector<Inclusion> PreambleIncludes;
136 PreambleBounds ModifiedBounds = {0,
false};
142 const SourceManager &SM);
147 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANGD_PREAMBLE_H
std::unique_ptr< PreambleFileStatusCache > StatCache
bool isPreambleCompatible(const PreambleData &Preamble, const ParseInputs &Inputs, PathRef FileName, const CompilerInvocation &CI)
Returns true if Preamble is reusable for Inputs.
llvm::StringRef text() const
Returns textual patch contents.
std::function< void(ASTContext &, std::shared_ptr< clang::Preprocessor >, const CanonicalIncludes &)> PreambleParsedCallback
PrecompiledPreamble Preamble
std::unique_ptr< CompilerInvocation > CI
static PreamblePatch unmodified(const PreambleData &Preamble)
Preamble is used verbatim.
Stores information required to parse a TU using a (possibly stale) Baseline preamble.
IncludeStructure Includes
const PreambleData & Preamble
void apply(CompilerInvocation &CI) const
Adjusts CI (which compiles the modified inputs) to be used with the baseline preamble.
The parsed preamble and associated data.
Maps a definition location onto an #include file, based on a set of filename rules.
std::shared_ptr< const PreambleData > buildPreamble(PathRef FileName, CompilerInvocation CI, const ParseInputs &Inputs, bool StoreInMemory, PreambleParsedCallback PreambleCallback)
Build a preamble for the new inputs unless an old one can be reused.
std::vector< Diag > Diags
static PreamblePatch create(llvm::StringRef FileName, const ParseInputs &Modified, const PreambleData &Baseline)
Builds a patch that contains new PP directives introduced to the preamble section of Modified compare...
tooling::CompileCommand CompileCommand
PreambleBounds modifiedBounds() const
Returns preamble bounds for the Modified.
llvm::StringRef PathRef
A typedef to represent a ref to file path.
PreambleData(const ParseInputs &Inputs, PrecompiledPreamble Preamble, std::vector< Diag > Diags, IncludeStructure Includes, MainFileMacros Macros, std::unique_ptr< PreambleFileStatusCache > StatCache, CanonicalIncludes CanonIncludes)
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
SourceLocation Loc
'#' location in the include directive
CanonicalIncludes CanonIncludes
std::vector< Inclusion > preambleIncludes() const
Returns #include directives from the Modified preamble that were resolved using the Baseline preamble...
SourceLocation translatePreamblePatchLocation(SourceLocation Loc, const SourceManager &SM)
Translates locations inside preamble patch to their main-file equivalent using presumed locations.