|
clang-tools 22.0.0git
|
Stores and provides access to parsed AST. More...
#include <ParsedAST.h>
Public Member Functions | |
| ParsedAST (ParsedAST &&Other) | |
| ParsedAST & | operator= (ParsedAST &&Other) |
| ~ParsedAST () | |
| ParsedAST (const ParsedAST &Other)=delete | |
| ParsedAST & | operator= (const ParsedAST &Other)=delete |
| ASTContext & | getASTContext () |
| Note that the returned ast will not contain decls from the preamble that were not deserialized during parsing. | |
| 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. | |
| ArrayRef< const Decl * > | getLocalTopLevelDecls () const |
| llvm::ArrayRef< Diag > | getDiagnostics () const |
| std::size_t | getUsedBytes () const |
| Returns the estimated size of the AST and the accessory structures, in bytes. | |
| const IncludeStructure & | getIncludeStructure () const |
| const MainFileMacros & | getMacros () const |
| Gets all macro references (definition, expansions) present in the main file, including those in the preamble region. | |
| const std::vector< PragmaMark > & | getMarks () const |
| Gets all pragma marks in the main file. | |
| const syntax::TokenBuffer & | getTokens () const |
| Tokens recorded while parsing the main file. | |
| const include_cleaner::PragmaIncludes & | getPragmaIncludes () const |
| Returns the PramaIncludes for preamble + main file includes. | |
| llvm::StringRef | version () const |
| Returns the version of the ParseInputs this AST was built from. | |
| PathRef | tuPath () const |
| Returns the path passed by the caller when building this AST. | |
| std::optional< llvm::StringRef > | preambleVersion () const |
| Returns the version of the ParseInputs used to build Preamble part of this AST. | |
| const HeuristicResolver * | getHeuristicResolver () const |
Static Public Member Functions | |
| 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. | |
Public Attributes | |
| llvm::DenseMap< const FunctionDecl *, SmallVector< const CXXConstructorDecl *, 1 > > | ForwardingToConstructorCache |
| Cache for constructors called through forwarding, e.g. make_unique. | |
Stores and provides access to parsed AST.
Definition at line 46 of file ParsedAST.h.
|
default |
References ParsedAST().
Referenced by build(), operator=(), operator=(), ParsedAST(), and ParsedAST().
| clang::clangd::ParsedAST::~ParsedAST | ( | ) |
Definition at line 772 of file ParsedAST.cpp.
|
delete |
References ParsedAST().
|
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 405 of file ParsedAST.cpp.
References clang::clangd::Config::AngledHeaders, clang::tidy::ClangTidyOptions::Checks, clang::clangd::Config::ClangTidy, clang::clangd::ParseInputs::ClangTidyProvider, clang::clangd::IncludeStructure::collect(), clang::clangd::collectPragmaMarksCallback(), clang::clangd::ParseInputs::CompileCommand, clang::tidy::configurationAsText(), clang::clangd::ParseInputs::Contents, clang::clangd::StoreDiags::contributeFixes(), clang::tidy::ClangTidyCheckFactories::createChecksForLanguage(), clang::clangd::PreamblePatch::createFullPatch(), clang::clangd::Config::current(), clang::clangd::Config::Diagnostics, dlog, clang::clangd::elog(), clang::clangd::StoreDiags::EndSourceFile(), clang::tidy::ClangTidyOptions::ExtraArgs, clang::tidy::ClangTidyOptions::ExtraArgsBefore, clang::clangd::Config::FastCheckFilter, clang::clangd::ParseInputs::FeatureModules, clang::clangd::getFormatStyleForFile(), clang::clangd::getTidyOptionsForFile(), clang::clangd::ParseOptions::ImportInsertions, clang::clangd::Symbol::Include, clang::clangd::ParseInputs::Index, clang::clangd::Info, clang::clangd::isDiagnosticSuppressed(), clang::clangd::isInsideMainFile(), clang::clangd::log(), clang::clangd::DiagBase::Message, clang::clangd::ParseInputs::Opts, ParsedAST(), clang::clangd::preferredIncludeDirective(), clang::clangd::prepareCompilerInstance(), clang::clangd::Config::QuotedHeaders, clang::clangd::StoreDiags::setDiagCallback(), clang::clangd::StoreDiags::setLevelAdjuster(), SPAN_ATTACH, clang::clangd::Config::Style, clang::clangd::Config::Suppress, clang::clangd::Config::SuppressAll, clang::clangd::StoreDiags::take(), clang::clangd::ParseInputs::TFS, clang::clangd::toString(), clang::clangd::ParseInputs::Version, and clang::clangd::ThreadsafeFS::view().
Referenced by clang::clangd::TestTU::build(), and clang::clangd::TestWorkspace::index().
| 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 783 of file ParsedAST.cpp.
References getASTContext().
Referenced by getASTContext(), getLangOpts(), getSourceManager(), getSourceManager(), and getUsedBytes().
| const ASTContext & clang::clangd::ParsedAST::getASTContext | ( | ) | const |
Definition at line 785 of file ParsedAST.cpp.
| llvm::ArrayRef< Diag > clang::clangd::ParsedAST::getDiagnostics | ( | ) | const |
Definition at line 878 of file ParsedAST.cpp.
|
inline |
Definition at line 122 of file ParsedAST.h.
| const IncludeStructure & clang::clangd::ParsedAST::getIncludeStructure | ( | ) | const |
Definition at line 844 of file ParsedAST.cpp.
|
inline |
Definition at line 84 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 801 of file ParsedAST.cpp.
| llvm::ArrayRef< const Decl * > clang::clangd::ParsedAST::getLocalTopLevelDecls | ( | ) | const |
Definition at line 805 of file ParsedAST.cpp.
| 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 809 of file ParsedAST.cpp.
| const std::vector< PragmaMark > & clang::clangd::ParsedAST::getMarks | ( | ) | const |
Gets all pragma marks in the main file.
Definition at line 810 of file ParsedAST.cpp.
| const include_cleaner::PragmaIncludes & clang::clangd::ParsedAST::getPragmaIncludes | ( | ) | const |
Returns the PramaIncludes for preamble + main file includes.
Definition at line 868 of file ParsedAST.cpp.
| Preprocessor & clang::clangd::ParsedAST::getPreprocessor | ( | ) |
Definition at line 791 of file ParsedAST.cpp.
Referenced by getUsedBytes().
| const Preprocessor & clang::clangd::ParsedAST::getPreprocessor | ( | ) | const |
Definition at line 797 of file ParsedAST.cpp.
| std::shared_ptr< Preprocessor > clang::clangd::ParsedAST::getPreprocessorPtr | ( | ) |
Definition at line 793 of file ParsedAST.cpp.
| Sema & clang::clangd::ParsedAST::getSema | ( | ) |
Definition at line 789 of file ParsedAST.cpp.
|
inline |
Definition at line 77 of file ParsedAST.h.
References getASTContext().
|
inline |
Definition at line 80 of file ParsedAST.h.
References getASTContext().
|
inline |
Tokens recorded while parsing the main file.
(!) does not have tokens from the preamble.
Definition at line 108 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 812 of file ParsedAST.cpp.
References clang::clangd::AST, getASTContext(), and getPreprocessor().
References ParsedAST().
References ParsedAST().
| std::optional< llvm::StringRef > clang::clangd::ParsedAST::preambleVersion | ( | ) | const |
Returns the version of the ParseInputs used to build Preamble part of this AST.
Might be std::nullopt if no Preamble is used.
Definition at line 872 of file ParsedAST.cpp.
|
inline |
Returns the path passed by the caller when building this AST.
Definition at line 116 of file ParsedAST.h.
|
inline |
Returns the version of the ParseInputs this AST was built from.
Definition at line 113 of file ParsedAST.h.
| llvm::DenseMap<const FunctionDecl *, SmallVector<const CXXConstructorDecl *, 1> > clang::clangd::ParsedAST::ForwardingToConstructorCache |
Cache for constructors called through forwarding, e.g. make_unique.
Definition at line 129 of file ParsedAST.h.