clang
10.0.0git
|
Classes | |
class | Arena |
A memory arena for syntax trees. More... | |
class | BreakStatement |
break; More... | |
class | CaseStatement |
case : <body> More... | |
class | CompoundStatement |
{ statement1; statement2; … } More... | |
class | ContinueStatement |
continue; More... | |
class | Declaration |
A declaration that can appear at the top-level. More... | |
class | DeclarationStatement |
E.g. 'int a, b = 10;'. More... | |
class | DefaultStatement |
default: <body> More... | |
class | EmptyDeclaration |
A semicolon in the top-level context. Does not declare anything. More... | |
class | EmptyStatement |
The no-op statement, i.e. ';'. More... | |
class | Expression |
A base class for all expressions. More... | |
class | ExpressionStatement |
Expression in a statement position, e.g. More... | |
class | FactoryImpl |
Exposes private syntax tree APIs required to implement node synthesis. 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 | ForStatement |
for (<init>; <cond>; <increment>) <body> More... | |
class | IfStatement |
if (cond) <then-statement> else <else-statement> FIXME: add condition that models 'expression or variable declaration' More... | |
class | Leaf |
A leaf node points to a single token inside the expanded token stream. More... | |
class | LinkageSpecificationDeclaration |
extern <string-literal> declaration extern <string-literal> { <decls> } More... | |
class | MutationsImpl |
class | NamespaceAliasDefinition |
namespace <name> = <namespace-reference> More... | |
class | NamespaceDefinition |
namespace <name> { <decls> } More... | |
class | Node |
A node in a syntax tree. More... | |
class | RangeBasedForStatement |
for (<decl> : <init>) <body> More... | |
class | ReturnStatement |
return <expr>; return; More... | |
class | SimpleDeclaration |
Groups multiple declarators (e.g. More... | |
class | Statement |
An abstract node for C++ statements, e.g. More... | |
class | StaticAssertDeclaration |
static_assert(<condition>, <message>) static_assert(<condition>) More... | |
class | SwitchStatement |
switch (<cond>) <body> 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 | 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... | |
class | TypeAliasDeclaration |
using <name> = <type> More... | |
class | UnknownDeclaration |
Declaration of an unknown kind, e.g. not yet supported in syntax trees. More... | |
class | UnknownExpression |
An expression of an unknown kind, i.e. More... | |
class | UnknownStatement |
A statement of an unknown kind, i.e. More... | |
class | UsingDeclaration |
using <scope>::<name> using typename <scope>::<name> More... | |
class | UsingNamespaceDirective |
using namespace <name> More... | |
class | WhileStatement |
while (<cond>) <body> More... | |
Functions | |
syntax::TranslationUnit * | buildSyntaxTree (Arena &A, const clang::TranslationUnitDecl &TU) |
Build a syntax tree for the main file. More... | |
clang::syntax::Leaf * | createPunctuation (clang::syntax::Arena &A, clang::tok::TokenKind K) |
clang::syntax::EmptyStatement * | createEmptyStatement (clang::syntax::Arena &A) |
tooling::Replacements | computeReplacements (const Arena &A, const syntax::TranslationUnit &TU) |
Computes textual replacements required to mimic the tree modifications made to the syntax tree. More... | |
void | removeStatement (syntax::Arena &A, syntax::Statement *S) |
Removes a statement or replaces it with an empty statement where one is required syntactically. More... | |
llvm::raw_ostream & | operator<< (llvm::raw_ostream &OS, NodeKind K) |
For debugging purposes. More... | |
llvm::raw_ostream & | operator<< (llvm::raw_ostream &OS, NodeRole R) |
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... | |
llvm::ArrayRef< syntax::Token > | spelledTokensTouching (SourceLocation Loc, const syntax::TokenBuffer &Tokens) |
The spelled tokens that overlap or touch a spelling location Loc. More... | |
const syntax::Token * | spelledIdentifierTouching (SourceLocation Loc, const syntax::TokenBuffer &Tokens) |
The identifier token that overlaps or touches a spelling location Loc. 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 |
A kind of a syntax node, used for implementing casts.
The ordering and blocks of enumerator constants must correspond to the inheritance hierarchy of syntax::Node.
|
strong |
A relation between a parent and child node, e.g.
'left-hand-side of a binary expression'. Used for implementing accessors.
syntax::TranslationUnit * clang::syntax::buildSyntaxTree | ( | Arena & | A, |
const clang::TranslationUnitDecl & | TU | ||
) |
Build a syntax tree for the main file.
Definition at line 662 of file BuildTree.cpp.
tooling::Replacements clang::syntax::computeReplacements | ( | const Arena & | A, |
const syntax::TranslationUnit & | TU | ||
) |
Computes textual replacements required to mimic the tree modifications made to the syntax tree.
Definition at line 85 of file ComputeReplacements.cpp.
References clang::tooling::Replacements::add(), emitReplacement(), SM, clang::syntax::Arena::sourceManager(), and clang::syntax::Arena::tokenBuffer().
clang::syntax::EmptyStatement * clang::syntax::createEmptyStatement | ( | clang::syntax::Arena & | A | ) |
Definition at line 38 of file Synthesis.cpp.
clang::syntax::Leaf * clang::syntax::createPunctuation | ( | clang::syntax::Arena & | A, |
clang::tok::TokenKind | K | ||
) |
Definition at line 24 of file Synthesis.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, |
NodeRole | R | ||
) |
For debugging purposes.
Definition at line 75 of file Nodes.cpp.
References BodyStatement, CaseStatement_value, CloseParen, CompoundStatement_statement, Detached, ExpressionStatement_expression, IfStatement_elseKeyword, IfStatement_elseStatement, IfStatement_thenStatement, IntroducerKeyword, OpenParen, ReturnStatement_value, StaticAssertDeclaration_condition, StaticAssertDeclaration_message, and Unknown.
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().
void clang::syntax::removeStatement | ( | syntax::Arena & | A, |
syntax::Statement * | S | ||
) |
Removes a statement or replaces it with an empty statement where one is required syntactically.
E.g., in the following example: if (cond) { foo(); } else bar(); One can remove foo();
completely and to remove bar();
we would need to replace it with an empty statement. EXPECTS: S->canModify() == true
Definition at line 84 of file Mutations.cpp.
const syntax::Token * clang::syntax::spelledIdentifierTouching | ( | SourceLocation | Loc, |
const syntax::TokenBuffer & | Tokens | ||
) |
The identifier token that overlaps or touches a spelling location Loc.
If there is none, returns nullptr.
Definition at line 272 of file Tokens.cpp.
llvm::ArrayRef< syntax::Token > clang::syntax::spelledTokensTouching | ( | SourceLocation | Loc, |
const syntax::TokenBuffer & | Tokens | ||
) |
The spelled tokens that overlap or touch a spelling location Loc.
This always returns 0-2 tokens.
Definition at line 258 of file Tokens.cpp.
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 296 of file Tokens.cpp.
Referenced by TokenCollector::Builder::build(), and clang::syntax::Arena::lexBuffer().