clang-tools
15.0.0git
|
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 |
Sema & | getSema () |
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 llvm::Optional< 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 std::vector< PragmaMark > & | getMarks () const |
Gets all pragma marks in the main file. 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... | |
const HeuristicResolver * | getHeuristicResolver () const |
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 45 of file ParsedAST.h.
|
default |
clang::clangd::ParsedAST::~ParsedAST | ( | ) |
Definition at line 686 of file ParsedAST.cpp.
References Action.
|
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 342 of file ParsedAST.cpp.
References CI, ns1::ns2::D, Diagnostic, Filename, Inputs, M, Preamble, clang::clangd::StoreDiags::setDiagCallback(), SPAN_ATTACH, and Tracer.
const 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 697 of file ParsedAST.cpp.
References Clang.
Referenced by clang::clangd::findDecl(), clang::clangd::findReferencedLocations(), clang::clangd::getFoldingRanges(), getLangOpts(), clang::clangd::getSemanticHighlightings(), getSourceManager(), and clang::clangd::indexMainDecls().
const ASTContext& clang::clangd::ParsedAST::getASTContext | ( | ) | const |
const CanonicalIncludes & clang::clangd::ParsedAST::getCanonicalIncludes | ( | ) | const |
Definition at line 758 of file ParsedAST.cpp.
Referenced by clang::clangd::indexMainDecls().
|
inline |
Definition at line 89 of file ParsedAST.h.
|
inline |
Definition at line 115 of file ParsedAST.h.
Referenced by clang::clangd::getNonLocalDeclRefs().
const IncludeStructure & clang::clangd::ParsedAST::getIncludeStructure | ( | ) | const |
Definition at line 754 of file ParsedAST.cpp.
|
inline |
Definition at line 80 of file ParsedAST.h.
References getASTContext().
Referenced by clang::clangd::getCorrespondingHeaderOrSource(), and clang::clangd::getFoldingRanges().
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 715 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 719 of file ParsedAST.cpp.
References Macros.
Referenced by clang::clangd::indexMainDecls().
const std::vector< PragmaMark > & clang::clangd::ParsedAST::getMarks | ( | ) | const |
Gets all pragma marks in the main file.
Definition at line 720 of file ParsedAST.cpp.
const Preprocessor & clang::clangd::ParsedAST::getPreprocessor | ( | ) |
Definition at line 705 of file ParsedAST.cpp.
References Clang.
Referenced by clang::clangd::findReferencedLocations(), and clang::clangd::indexMainDecls().
const Preprocessor& clang::clangd::ParsedAST::getPreprocessor | ( | ) | const |
std::shared_ptr< Preprocessor > clang::clangd::ParsedAST::getPreprocessorPtr | ( | ) |
Definition at line 707 of file ParsedAST.cpp.
References Clang.
Sema & clang::clangd::ParsedAST::getSema | ( | ) |
Definition at line 703 of file ParsedAST.cpp.
References Clang.
|
inline |
Definition at line 73 of file ParsedAST.h.
References getASTContext().
Referenced by clang::clangd::getFoldingRanges().
|
inline |
Definition at line 76 of file ParsedAST.h.
References getASTContext().
|
inline |
Tokens recorded while parsing the main file.
(!) does not have tokens from the preamble.
Definition at line 106 of file ParsedAST.h.
Referenced by clang::clangd::findReferencedLocations(), and clang::clangd::getFoldingRanges().
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 722 of file ParsedAST.cpp.
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 782 of file ParsedAST.cpp.
References Preamble.
|
inline |
Returns the version of the ParseInputs this AST was built from.
Definition at line 109 of file ParsedAST.h.
Referenced by clang::clangd::indexMainDecls().