14 #ifndef LLVM_CLANG_AST_TEXTNODEDUMPER_H 15 #define LLVM_CLANG_AST_TEXTNODEDUMPER_H 31 const bool ShowColors;
40 bool FirstChild =
true;
47 template <
typename Fn>
void AddChild(Fn DoAddChild) {
59 while (!Pending.empty()) {
71 std::string LabelStr =
Label;
72 auto DumpWithIndent = [
this, DoAddChild, LabelStr](
bool IsLastChild) {
88 OS << Prefix << (IsLastChild ?
'`' :
'|') <<
'-';
89 if (!LabelStr.empty())
90 OS << LabelStr <<
": ";
92 this->Prefix.push_back(IsLastChild ?
' ' :
'|');
93 this->Prefix.push_back(
' ');
97 unsigned Depth = Pending.size();
103 while (Depth < Pending.size()) {
104 Pending.back()(
true);
105 this->Pending.pop_back();
109 this->Prefix.resize(Prefix.size() - 2);
113 Pending.push_back(std::move(DumpWithIndent));
115 Pending.back()(
false);
116 Pending.back() = std::move(DumpWithIndent);
122 : OS(OS), ShowColors(ShowColors) {}
128 const comments::FullComment *>,
134 const bool ShowColors;
138 const char *LastLocFilename =
"";
139 unsigned LastLocLine = ~0U;
148 const char *getCommandName(
unsigned CommandID);
157 void Visit(
const Attr *A);
160 const Decl *From =
nullptr, StringRef
Label = {});
164 void Visit(
const Type *T);
168 void Visit(
const Decl *D);
176 void dumpPointer(
const void *Ptr);
181 void dumpBareDeclRef(
const Decl *D);
185 void dumpDeclRef(
const Decl *D, StringRef
Label = {});
210 #include "clang/AST/AttrTextNodeDump.inc" 222 void VisitIfStmt(
const IfStmt *Node);
224 void VisitWhileStmt(
const WhileStmt *Node);
225 void VisitLabelStmt(
const LabelStmt *Node);
226 void VisitGotoStmt(
const GotoStmt *Node);
227 void VisitCaseStmt(
const CaseStmt *Node);
228 void VisitCallExpr(
const CallExpr *Node);
229 void VisitCastExpr(
const CastExpr *Node);
284 void VisitTagType(
const TagType *T);
286 void VisitAutoType(
const AutoType *T);
298 #endif // LLVM_CLANG_AST_TEXTNODEDUMPER_H ObjCPropertyRefExpr - A dot-syntax expression to access an ObjC property.
Defines the clang::ASTContext interface.
A class which contains all the information about a particular captured value.
Represents the dependent type named by a dependently-scoped typename using declaration, e.g.
A (possibly-)qualified type.
ConstStmtVisitor - This class implements a simple visitor for Stmt subclasses.
Stmt - This represents one statement.
FunctionType - C99 6.7.5.3 - Function Declarators.
IfStmt - This represents an if/then/else.
Decl - This represents one declaration (or definition), e.g.
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
Represents a C++11 auto or C++14 decltype(auto) type.
The base class of the type hierarchy.
Represents an array type, per C99 6.7.5.2 - Array Declarators.
Represents a call to a C++ constructor.
ObjCSubscriptRefExpr - used for array and dictionary subscripting.
AccessSpecifier
A C++ access specifier (public, private, protected), plus the special value "none" which means differ...
Represents a prvalue temporary that is written into memory so that a reference can bind to it...
Describes how types, statements, expressions, and declarations should be printed. ...
Represents an expression – generally a full-expression – that introduces cleanups to be run at the ...
Defines the clang::Expr interface and subclasses for C++ expressions.
LabelStmt - Represents a label, which has a substatement.
A simple visitor class that helps create attribute visitors.
ExtVectorElementExpr - This represents access to specific elements of a vector, and may occur on the ...
Represents Objective-C's @catch statement.
Describes an C or C++ initializer list.
A simple visitor class that helps create template argument visitors.
A builtin binary operation expression such as "x + y" or "x <= y".
CaseStmt - Represent a case statement.
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
Represents binding an expression to a temporary.
Represents a C++ member access expression where the actual member referenced could not be resolved be...
Represents an extended vector type where either the type or size is dependent.
Represents the this expression in C++.
Represents a prototype with parameter type info, e.g.
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand...
Represents an array type in C++ whose size is a value-dependent expression.
TextTreeStructure(raw_ostream &OS, bool ShowColors)
ObjCSelectorExpr used for @selector in Objective-C.
Represents an expression that computes the length of a parameter pack.
An expression that sends a message to the given Objective-C object or class.
UnaryOperator - This represents the unary-expression's (except sizeof and alignof), the postinc/postdec operators from postfix-expression, and various extensions.
Represents a GCC generic vector type.
static QualType Desugar(ASTContext &Context, QualType QT, bool &ShouldAKA)
Encodes a location in the source.
Represents a C++ temporary.
Interfaces are the core concept in Objective-C for object oriented design.
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)"...
void AddChild(StringRef Label, Fn DoAddChild)
Add a child of the current node with an optional label.
This is a basic class for representing single OpenMP clause.
ObjCProtocolExpr used for protocol expression in Objective-C.
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
ObjCBoxedExpr - used for generalized expression boxing.
The injected class name of a C++ class template or class template partial specialization.
Represents a pack expansion of types.
CompoundAssignOperator - For compound assignments (e.g.
AddrLabelExpr - The GNU address of label extension, representing &&label.
ast_type_traits::DynTypedNode Node
Represents a template argument.
Dataflow Directional Tag Classes.
[C99 6.4.2.2] - A predefined identifier such as func.
Represents a delete expression for memory deallocation and destructor calls, e.g. ...
static const TerminalColor IndentColor
SwitchStmt - This represents a 'switch' stmt.
Represents a C++ base or member initializer.
ObjCEncodeExpr, used for @encode in Objective-C.
Base for LValueReferenceType and RValueReferenceType.
ObjCIvarRefExpr - A reference to an ObjC instance variable.
Describes an explicit type conversion that uses functional notion but could not be resolved because o...
GotoStmt - This represents a direct goto.
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
Represents an explicit C++ type conversion that uses "functional" notation (C++ [expr.type.conv]).
WhileStmt - This represents a 'while' stmt.
StringLiteral - This represents a string literal expression, e.g.
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Abstract class common to all of the C++ "named"/"keyword" casts.
ObjCBoolLiteralExpr - Objective-C Boolean Literal.
A reference to a declared variable, function, enum, etc.
Represents a type template specialization; the template must be a class template, a type alias templa...
A trivial tuple used to represent a source range.
This represents a decl that may have a name.
A boolean literal, per ([C++ lex.bool] Boolean literals).
Represents a C array with a specified size that is not an integer-constant-expression.
Represents the canonical version of C arrays with a specified constant size.
This class handles loading and caching of source files into memory.
void AddChild(Fn DoAddChild)
Add a child of the current node. Calls DoAddChild without arguments.
Attr - This represents one attribute.