clang-tools
11.0.0
|
Stores and provides access to parsed AST. More...
#include <ParsedAST.h>
Public Member Functions | |
ParsedAST (ParsedAST &&Other) | |
ParsedAST & | operator= (ParsedAST &&Other) |
~ParsedAST () | |
ASTContext & | getASTContext () |
Note that the returned ast will not contain decls from the preamble that were not deserialized during parsing. More... | |
const ASTContext & | getASTContext () const |
Preprocessor & | getPreprocessor () |
std::shared_ptr< Preprocessor > | getPreprocessorPtr () |
const Preprocessor & | getPreprocessor () const |
SourceManager & | getSourceManager () |
const SourceManager & | getSourceManager () const |
const LangOptions & | getLangOpts () const |
ArrayRef< Decl * > | getLocalTopLevelDecls () |
This function returns top-level decls present in the main file of the AST. More... | |
const std::vector< Diag > & | getDiagnostics () const |
std::size_t | getUsedBytes () const |
Returns the estimated size of the AST and the accessory structures, in bytes. More... | |
const IncludeStructure & | getIncludeStructure () const |
const CanonicalIncludes & | getCanonicalIncludes () const |
const MainFileMacros & | getMacros () const |
Gets all macro references (definition, expansions) present in the main file, including those in the preamble region. More... | |
const syntax::TokenBuffer & | getTokens () const |
Tokens recorded while parsing the main file. More... | |
llvm::StringRef | version () const |
Returns the version of the ParseInputs this AST was built from. More... | |
llvm::Optional< llvm::StringRef > | preambleVersion () const |
Returns the version of the ParseInputs used to build Preamble part of this AST. More... | |
Static Public Member Functions | |
static llvm::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. More... | |
Stores and provides access to parsed AST.
Definition at line 48 of file ParsedAST.h.
|
default |
clang::clangd::ParsedAST::~ParsedAST | ( | ) |
Definition at line 460 of file ParsedAST.cpp.
|
static |
Attempts to run Clang and store the parsed AST.
If Preamble
is non-null it is reused during parsing. This function does not check if preamble is valid to reuse.
Definition at line 246 of file ParsedAST.cpp.
References CI, clang::tidy::configurationAsText(), clang::clangd::PreamblePatch::create(), clang::tidy::ClangTidyCheckFactories::createChecks(), dlog, E, Filename, Inputs, clang::clangd::log(), clang::clangd::None, Patch, Preamble, clang::clangd::prepareCompilerInstance(), clang::clangd::StoreDiags::setLevelAdjuster(), SPAN_ATTACH, and Tracer.
Referenced by clang::clangd::TestTU::build().
ASTContext & clang::clangd::ParsedAST::getASTContext | ( | ) |
Note that the returned ast will not contain decls from the preamble that were not deserialized during parsing.
Clients should expect only decls from the main file to be in the AST.
Definition at line 471 of file ParsedAST.cpp.
Referenced by clang::clangd::dumpAST(), clang::clangd::findDecl(), getLangOpts(), clang::clangd::getSemanticHighlightings(), getSourceManager(), getUsedBytes(), and clang::clangd::indexMainDecls().
const ASTContext & clang::clangd::ParsedAST::getASTContext | ( | ) | const |
Definition at line 473 of file ParsedAST.cpp.
const CanonicalIncludes & clang::clangd::ParsedAST::getCanonicalIncludes | ( | ) | const |
Definition at line 531 of file ParsedAST.cpp.
Referenced by clang::clangd::indexMainDecls().
const std::vector< Diag > & clang::clangd::ParsedAST::getDiagnostics | ( | ) | const |
Definition at line 493 of file ParsedAST.cpp.
const IncludeStructure & clang::clangd::ParsedAST::getIncludeStructure | ( | ) | const |
Definition at line 527 of file ParsedAST.cpp.
|
inline |
Definition at line 81 of file ParsedAST.h.
References getASTContext().
llvm::ArrayRef< Decl * > clang::clangd::ParsedAST::getLocalTopLevelDecls | ( | ) |
This function returns top-level decls present in the main file of the AST.
The result does not include the decls that come from the preamble. (These should be const, but RecursiveASTVisitor requires Decl*).
Definition at line 487 of file ParsedAST.cpp.
Referenced by clang::clangd::getIndexableLocalDecls(), and clang::clangd::indexMainDecls().
const MainFileMacros & clang::clangd::ParsedAST::getMacros | ( | ) | const |
Gets all macro references (definition, expansions) present in the main file, including those in the preamble region.
Definition at line 491 of file ParsedAST.cpp.
Referenced by clang::clangd::getSemanticHighlightings(), and clang::clangd::indexMainDecls().
Preprocessor & clang::clangd::ParsedAST::getPreprocessor | ( | ) |
Definition at line 477 of file ParsedAST.cpp.
const Preprocessor & clang::clangd::ParsedAST::getPreprocessor | ( | ) | const |
Definition at line 483 of file ParsedAST.cpp.
std::shared_ptr< Preprocessor > clang::clangd::ParsedAST::getPreprocessorPtr | ( | ) |
Definition at line 479 of file ParsedAST.cpp.
Referenced by clang::clangd::indexMainDecls().
|
inline |
Definition at line 74 of file ParsedAST.h.
References getASTContext().
|
inline |
Definition at line 77 of file ParsedAST.h.
References getASTContext().
|
inline |
Tokens recorded while parsing the main file.
(!) does not have tokens from the preamble.
Definition at line 103 of file ParsedAST.h.
std::size_t clang::clangd::ParsedAST::getUsedBytes | ( | ) | const |
Returns the estimated size of the AST and the accessory structures, in bytes.
Does not include the size of the preamble.
Definition at line 495 of file ParsedAST.cpp.
References clang::clangd::AST, and getASTContext().
llvm::Optional< llvm::StringRef > clang::clangd::ParsedAST::preambleVersion | ( | ) | const |
Returns the version of the ParseInputs used to build Preamble part of this AST.
Might be None if no Preamble is used.
Definition at line 552 of file ParsedAST.cpp.
References clang::clangd::None.
|
inline |
Returns the version of the ParseInputs this AST was built from.
Definition at line 106 of file ParsedAST.h.
Referenced by clang::clangd::indexMainDecls().