clang 10.0.0git

Public Member Functions | List of all members
clang::syntax::Arena Class Reference

A memory arena for syntax trees. More...

`#include "clang/Tooling/Syntax/Tree.h"`

## Public Member Functions
| Arena (SourceManager &SourceMgr, const LangOptions &LangOpts, TokenBuffer Tokens)
const SourceManager & | sourceManager () const
const LangOptions & | langOptions () const
const TokenBuffer & | tokenBuffer () const
llvm::BumpPtrAllocator & | allocator ()
std::pair< FileID, llvm::ArrayRef< syntax::Token > > | lexBuffer (std::unique_ptr< llvm::MemoryBuffer > Buffer)
| Add `Buffer` to the underlying source manager, tokenize it and store the resulting tokens. More...

## Detailed Description

A memory arena for syntax trees.

Also tracks the underlying token buffers, source manager, etc.

Definition at line 39 of file Tree.h.

## Constructor & Destructor Documentation

## ◆ Arena()

syntax::Arena::Arena | ( | SourceManager & | SourceMgr,
|  | const LangOptions & | LangOpts,
|  | TokenBuffer | Tokens
| ) |  |

Definition at line 35 of file Tree.cpp.

## Member Function Documentation

## ◆ allocator()

llvm::BumpPtrAllocator& clang::syntax::Arena::allocator | ( |  | ) |
| inline

Definition at line 48 of file Tree.h.

References lexBuffer().

## ◆ langOptions()

const LangOptions& clang::syntax::Arena::langOptions | ( |  | ) | const
| inline

Definition at line 45 of file Tree.h.

References tokenBuffer().

## ◆ lexBuffer()

std::pair< FileID, llvm::ArrayRef< syntax::Token > > syntax::Arena::lexBuffer | ( | std::unique_ptr< llvm::MemoryBuffer > | Buffer | ) |

Add `Buffer` to the underlying source manager, tokenize it and store the resulting tokens.

Useful when there is a need to materialize tokens that were not written in user code.

Definition at line 44 of file Tree.cpp.

References clang::SourceManager::createFileID(), and clang::syntax::tokenize().

Referenced by allocator().

## ◆ sourceManager()

const SourceManager& clang::syntax::Arena::sourceManager | ( |  | ) | const
| inline

Definition at line 44 of file Tree.h.

Referenced by clang::syntax::computeReplacements(), and clang::syntax::Node::dumpTokens().

## ◆ tokenBuffer()

const clang::syntax::TokenBuffer & syntax::Arena::tokenBuffer | ( |  | ) | const

Definition at line 39 of file Tree.cpp.

Referenced by clang::syntax::computeReplacements(), and langOptions().

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

- include/clang/Tooling/Syntax/Tree.h
- lib/Tooling/Syntax/Tree.cpp