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
30 #include "clang-include-cleaner/Record.h"
33 #include "clang/Frontend/CompilerInvocation.h"
34 #include "clang/Frontend/PrecompiledPreamble.h"
35 #include "clang/Lex/Lexer.h"
36 #include "clang/Tooling/CompilationDatabase.h"
37 #include "llvm/ADT/StringRef.h"
103 std::shared_ptr<const PreambleData>
115 const CompilerInvocation &
CI);
141 void apply(CompilerInvocation &
CI)
const;
155 llvm::StringRef
text()
const {
return PatchContents; }
167 std::string PatchContents;
168 std::string PatchFileName;
171 std::vector<Inclusion> PreambleIncludes;
172 PreambleBounds ModifiedBounds = {0,
false};
178 const SourceManager &SM);
183 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANGD_PREAMBLE_H
std::shared_ptr< const PreambleData > buildPreamble(PathRef FileName, CompilerInvocation CI, const ParseInputs &Inputs, bool StoreInMemory, PreambleParsedCallback PreambleCallback, PreambleBuildStats *Stats)
Build a preamble for the new inputs unless an old one can be reused.
bool MainIsIncludeGuarded
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.
PrecompiledPreamble Preamble
std::unique_ptr< CompilerInvocation > CI
static PreamblePatch unmodified(const PreambleData &Preamble)
Preamble is used verbatim.
double TotalBuildTime
Total wall time it took to build preamble, in seconds.
Stores information required to parse a TU using a (possibly stale) Baseline preamble.
Timings and statistics from the premble build.
IncludeStructure Includes
include_cleaner::PragmaIncludes Pragmas
size_t SerializedSize
The serialized size of the preamble.
void apply(CompilerInvocation &CI) const
Adjusts CI (which compiles the modified inputs) to be used with the baseline preamble.
bool preserveDiagnostics() const
Whether diagnostics generated using this patch are trustable.
The parsed preamble and associated data.
Maps a definition location onto an #include file, based on a set of filename rules.
double FileSystemTime
Time spent in filesystem operations during the build, in seconds.
static PreamblePatch createMacroPatch(llvm::StringRef FileName, const ParseInputs &Modified, const PreambleData &Baseline)
std::vector< Diag > Diags
std::vector< PragmaMark > Marks
tooling::CompileCommand CompileCommand
PreambleBounds modifiedBounds() const
Returns preamble bounds for the Modified.
static PreamblePatch createFullPatch(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...
llvm::StringRef PathRef
A typedef to represent a ref to file path.
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
size_t BuildSize
Estimate of the memory used while building the preamble.
PreambleData(PrecompiledPreamble Preamble)
CanonicalIncludes CanonIncludes
std::function< void(ASTContext &, Preprocessor &, const CanonicalIncludes &)> PreambleParsedCallback
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.