clang-tools 8.0.0

Public Member Functions | Static Public Member Functions | List of all members
clang::clangd::ParsedAST Class Reference

Stores and provides access to parsed AST. More...

`#include <ClangdUnit.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
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 esitmated size of the AST and the accessory structures, in bytes. More...
const IncludeStructure & | getIncludeStructure () const

## Static Public Member Functions
static llvm::Optional< ParsedAST > | build (std::unique_ptr< clang::CompilerInvocation > CI, std::shared_ptr< const PreambleData > Preamble, std::unique_ptr< llvm::MemoryBuffer > Buffer, std::shared_ptr< PCHContainerOperations > PCHs, IntrusiveRefCntPtr< llvm::vfs::FileSystem > VFS)
| Attempts to run Clang and store parsed AST. More...

## Detailed Description

Stores and provides access to parsed AST.

Definition at line 71 of file ClangdUnit.h.

## Constructor & Destructor Documentation

## ◆ ParsedAST()

clang::clangd::ParsedAST::ParsedAST | ( | ParsedAST && | Other | ) |
| default

## ◆ ~ParsedAST()

clang::clangd::ParsedAST::~ParsedAST | ( |  | ) |

Definition at line 337 of file ClangdUnit.cpp.

References Action.

## Member Function Documentation

## ◆ build()

llvm::Optional< ParsedAST > clang::clangd::ParsedAST::build | ( | std::unique_ptr< clang::CompilerInvocation > | CI,
|  | std::shared_ptr< const PreambleData > | Preamble,
|  | std::unique_ptr< llvm::MemoryBuffer > | Buffer,
|  | std::shared_ptr< PCHContainerOperations > | PCHs,
|  | IntrusiveRefCntPtr< llvm::vfs::FileSystem > | VFS
| ) |  |
| static

Attempts to run Clang and store parsed AST.

If `Preamble` is non-null it is reused during parsing.

Definition at line 227 of file ClangdUnit.cpp.

References Action, clang::clangd::log(), clang::clangd::None, and clang::clangd::prepareCompilerInstance().

## ◆ getASTContext() [1/2]

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 348 of file ClangdUnit.cpp.

Referenced by clang::clangd::dumpAST(), clang::clangd::getBeginningOfIdentifier(), and clang::clangd::indexMainDecls().

## ◆ getASTContext() [2/2]

const ASTContext & clang::clangd::ParsedAST::getASTContext | ( |  | ) | const

Definition at line 350 of file ClangdUnit.cpp.

## ◆ getDiagnostics()

const std::vector< Diag > & clang::clangd::ParsedAST::getDiagnostics | ( |  | ) | const

Definition at line 368 of file ClangdUnit.cpp.

## ◆ getIncludeStructure()

const IncludeStructure & clang::clangd::ParsedAST::getIncludeStructure | ( |  | ) | const

Definition at line 402 of file ClangdUnit.cpp.

## ◆ getLocalTopLevelDecls()

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 364 of file ClangdUnit.cpp.

Referenced by clang::clangd::indexMainDecls().

## ◆ getPreprocessor() [1/2]

Preprocessor & clang::clangd::ParsedAST::getPreprocessor | ( |  | ) |

Definition at line 354 of file ClangdUnit.cpp.

## ◆ getPreprocessor() [2/2]

const Preprocessor & clang::clangd::ParsedAST::getPreprocessor | ( |  | ) | const

Definition at line 360 of file ClangdUnit.cpp.

## ◆ getPreprocessorPtr()

std::shared_ptr< Preprocessor > clang::clangd::ParsedAST::getPreprocessorPtr | ( |  | ) |

Definition at line 356 of file ClangdUnit.cpp.

Referenced by clang::clangd::indexMainDecls().

## ◆ getUsedBytes()

std::size_t clang::clangd::ParsedAST::getUsedBytes | ( |  | ) | const

Returns the esitmated size of the AST and the accessory structures, in bytes.

Does not include the size of the preamble.

Definition at line 370 of file ClangdUnit.cpp.

References clang::clangd::AST.

## ◆ operator=()

ParsedAST & clang::clangd::ParsedAST::operator= | ( | ParsedAST && | Other | ) |
| default

The documentation for this class was generated from the following files:

- ClangdUnit.h
- ClangdUnit.cpp