clang
9.0.0
|
Classes | |
class | Arena |
A memory arena for syntax trees. More... | |
class | CompoundStatement |
{ statement1; statement2; … } More... | |
struct | FileRange |
A half-open character range inside a particular file, the start offset is included and the end offset is excluded from the range. More... | |
class | Leaf |
A leaf node points to a single token inside the expanded token stream. More... | |
class | Node |
A node in a syntax tree. More... | |
class | Statement |
An abstract node for C++ statements, e.g. 'while', 'if', etc. More... | |
class | Token |
A token coming directly from a file or from a macro invocation. More... | |
class | TokenBuffer |
A list of tokens obtained by preprocessing a text buffer and operations to map between the expanded and spelled tokens, i.e. More... | |
class | TokenCollector |
Collects tokens for the main file while running the frontend action. More... | |
class | TopLevelDeclaration |
FIXME: this node is temporary and will be replaced with nodes for various 'declarations' and 'declarators' from the C/C++ grammar. More... | |
class | TranslationUnit |
A root node for a translation unit. Parent is always null. More... | |
class | Tree |
A node that has children and represents a syntactic language construct. More... | |
class | TreeBuilder |
A helper class for constructing the syntax tree while traversing a clang AST. More... | |
Enumerations | |
enum | NodeKind : uint16_t { NodeKind::Leaf, NodeKind::TranslationUnit, NodeKind::TopLevelDeclaration, NodeKind::CompoundStatement } |
A kind of a syntax node, used for implementing casts. More... | |
enum | NodeRole : uint8_t { NodeRole::Detached, NodeRole::Unknown, NodeRole::CompoundStatement_lbrace, NodeRole::CompoundStatement_rbrace } |
A relation between a parent and child node. Used for implementing accessors. More... | |
Functions | |
syntax::TranslationUnit * | buildSyntaxTree (Arena &A, const clang::TranslationUnitDecl &TU) |
Build a syntax tree for the main file. More... | |
llvm::raw_ostream & | operator<< (llvm::raw_ostream &OS, NodeKind K) |
For debugging purposes. More... | |
llvm::raw_ostream & | operator<< (llvm::raw_ostream &OS, const FileRange &R) |
For debugging purposes. More... | |
llvm::raw_ostream & | operator<< (llvm::raw_ostream &OS, const Token &T) |
For debugging purposes. Equivalent to a call to Token::str(). More... | |
std::vector< syntax::Token > | tokenize (FileID FID, const SourceManager &SM, const LangOptions &LO) |
Lex the text buffer, corresponding to FID , in raw mode and record the resulting spelled tokens. More... | |
|
strong |
|
strong |
syntax::TranslationUnit * clang::syntax::buildSyntaxTree | ( | Arena & | A, |
const clang::TranslationUnitDecl & | TU | ||
) |
Build a syntax tree for the main file.
Definition at line 269 of file BuildTree.cpp.
llvm::raw_ostream & clang::syntax::operator<< | ( | llvm::raw_ostream & | OS, |
NodeKind | K | ||
) |
For debugging purposes.
Definition at line 13 of file Nodes.cpp.
Referenced by clang::syntax::Token::length().
llvm::raw_ostream & clang::syntax::operator<< | ( | llvm::raw_ostream & | OS, |
const FileRange & | R | ||
) |
For debugging purposes.
Definition at line 105 of file Tokens.cpp.
References clang::syntax::FileRange::beginOffset(), clang::syntax::FileRange::endOffset(), clang::syntax::FileRange::file(), and clang::FileID::getHashValue().
llvm::raw_ostream & clang::syntax::operator<< | ( | llvm::raw_ostream & | OS, |
const Token & | T | ||
) |
For debugging purposes. Equivalent to a call to Token::str().
Definition at line 74 of file Tokens.cpp.
References clang::syntax::Token::str().
std::vector< syntax::Token > clang::syntax::tokenize | ( | FileID | FID, |
const SourceManager & | SM, | ||
const LangOptions & | LO | ||
) |
Lex the text buffer, corresponding to FID
, in raw mode and record the resulting spelled tokens.
Does minimal post-processing on raw identifiers, setting the appropriate token kind (instead of the raw_identifier reported by lexer in raw mode). This is a very low-level function, most users should prefer to use TokenCollector. Lexing in raw mode produces wildly different results from what one might expect when running a C++ frontend, e.g. preprocessor does not run at all. The result will not have a 'eof' token at the end.
Definition at line 235 of file Tokens.cpp.
Referenced by clang::syntax::TokenCollector::Builder::build(), and clang::syntax::Arena::lexBuffer().