13 #ifndef LLVM_CLANG_AST_TEXTNODEDUMPER_H 14 #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 *>,
135 const bool ShowColors;
139 const char *LastLocFilename =
"";
140 unsigned LastLocLine = ~0U;
151 const char *getCommandName(
unsigned CommandID);
160 void Visit(
const Attr *A);
163 const Decl *From =
nullptr, StringRef
Label = {});
167 void Visit(
const Type *T);
171 void Visit(
const Decl *D);
181 void dumpPointer(
const void *Ptr);
186 void dumpBareDeclRef(
const Decl *D);
190 void dumpDeclRef(
const Decl *D, StringRef
Label = {});
215 #include "clang/AST/AttrTextNodeDump.inc" 227 void VisitIfStmt(
const IfStmt *Node);
229 void VisitWhileStmt(
const WhileStmt *Node);
230 void VisitLabelStmt(
const LabelStmt *Node);
231 void VisitGotoStmt(
const GotoStmt *Node);
232 void VisitCaseStmt(
const CaseStmt *Node);
234 void VisitCallExpr(
const CallExpr *Node);
235 void VisitCastExpr(
const CastExpr *Node);
291 void VisitTagType(
const TagType *T);
293 void VisitAutoType(
const AutoType *T);
301 void VisitEnumDecl(
const EnumDecl *D);
307 void VisitVarDecl(
const VarDecl *D);
355 #endif // LLVM_CLANG_AST_TEXTNODEDUMPER_H ObjCPropertyRefExpr - A dot-syntax expression to access an ObjC property.
Defines the clang::ASTContext interface.
Represents a function declaration or definition.
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.
An instance of this object exists for each enum constant that is defined.
Represents the declaration of a typedef-name via the 'typedef' type specifier.
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.
Declaration of a variable template.
Represents an array type, per C99 6.7.5.2 - Array Declarators.
Represent a C++ namespace.
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...
FriendDecl - Represents the declaration of a friend entity, which can be a function, a type, or a templated function or type.
Represents a variable declaration or definition.
ObjCMethodDecl - Represents an instance or class method declaration.
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.
Represents the builtin template declaration which is used to implement __make_integer_seq and other b...
LabelStmt - Represents a label, which has a substatement.
Represents a struct/union/class.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Represents a member of a struct/union/class.
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 an access specifier followed by colon ':'.
Represents Objective-C's @catch statement.
Describes an C or C++ initializer list.
Represents a C++ using-declaration.
AssociationTy< true > ConstAssociation
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 an Objective-C protocol declaration.
Represents binding an expression to a temporary.
Represents a C++ member access expression where the actual member referenced could not be resolved be...
Represents the body of a CapturedStmt, and serves as its DeclContext.
Represents an ObjC class declaration.
Represents a linkage specification.
A binding in a decomposition declaration.
Represents an extended vector type where either the type or size is dependent.
Represents the this expression in C++.
ObjCPropertyImplDecl - Represents implementation declaration of a property in a class or category imp...
Represents the declaration of a typedef-name via a C++11 alias-declaration.
Represents a prototype with parameter type info, e.g.
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand...
ConstantExpr - An expression that occurs in a constant context and optionally the result of evaluatin...
This represents '#pragma omp requires...' directive.
Represents an array type in C++ whose size is a value-dependent expression.
Represents a shadow constructor declaration introduced into a class by a C++11 using-declaration that...
Represents a block literal declaration, which is like an unnamed FunctionDecl.
Declaration of a template type parameter.
TextTreeStructure(raw_ostream &OS, bool ShowColors)
ObjCSelectorExpr used for @selector in Objective-C.
Represents an expression that computes the length of a parameter pack.
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
Declaration of an alias template.
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.
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
static QualType Desugar(ASTContext &Context, QualType QT, bool &ShouldAKA)
Encodes a location in the source.
This represents '#pragma omp declare reduction ...' directive.
Pseudo declaration for capturing expressions.
Interfaces are the core concept in Objective-C for object oriented design.
This is a basic class for representing single OpenMP executable directive.
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)"...
Represents the declaration of a label.
Represents a dependent using declaration which was not marked with typename.
void AddChild(StringRef Label, Fn DoAddChild)
Add a child of the current node with an optional label.
ObjCCategoryDecl - Represents a category declaration.
This is a basic class for representing single OpenMP clause.
ObjCProtocolExpr used for protocol expression in Objective-C.
Represents one property declaration in an Objective-C interface.
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
ObjCBoxedExpr - used for generalized expression boxing.
Describes a module import declaration, which makes the contents of the named module visible in the cu...
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.
Represents a C11 generic selection.
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
Represents a field injected from an anonymous union/struct into the parent scope. ...
Represents a dependent using declaration which was marked with typename.
Represents the declaration of an Objective-C type parameter.
SwitchStmt - This represents a 'switch' stmt.
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
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 a C++ struct/union/class.
Represents an explicit C++ type conversion that uses "functional" notation (C++ [expr.type.conv]).
ObjCIvarDecl - Represents an ObjC instance variable.
WhileStmt - This represents a 'while' stmt.
Declaration of a class template.
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 a C++ namespace alias.
Represents C++ using-directive.
Represents a #pragma detect_mismatch line.
A simple visitor class that helps create declaration visitors.
ObjCCategoryImplDecl - An object of this class encapsulates a category @implementation declaration...
Represents the canonical version of C arrays with a specified constant size.
This class handles loading and caching of source files into memory.
Declaration of a template function.
void AddChild(Fn DoAddChild)
Add a child of the current node. Calls DoAddChild without arguments.
Attr - This represents one attribute.
Represents a shadow declaration introduced into a scope by a (resolved) using declaration.
ObjCCompatibleAliasDecl - Represents alias of a class.