14 #ifndef LLVM_CLANG_AST_STMTVISITOR_H
15 #define LLVM_CLANG_AST_STMTVISITOR_H
31 template<
template <
typename>
class Ptr,
typename ImplClass,
typename RetTy=
void>
35 #define PTR(CLASS) typename Ptr<CLASS>::type
36 #define DISPATCH(NAME, CLASS) \
37 return static_cast<ImplClass*>(this)->Visit ## NAME(static_cast<PTR(CLASS)>(S))
45 switch (BinOp->getOpcode()) {
82 switch (UnOp->getOpcode()) {
100 switch (S->getStmtClass()) {
101 default: llvm_unreachable(
"Unknown stmt kind!");
102 #define ABSTRACT_STMT(STMT)
103 #define STMT(CLASS, PARENT) \
104 case Stmt::CLASS ## Class: DISPATCH(CLASS, CLASS);
105 #include "clang/AST/StmtNodes.inc"
111 #define STMT(CLASS, PARENT) \
112 RetTy Visit ## CLASS(PTR(CLASS) S) { DISPATCH(PARENT, PARENT); }
113 #include "clang/AST/StmtNodes.inc"
117 #define BINOP_FALLBACK(NAME) \
118 RetTy VisitBin ## NAME(PTR(BinaryOperator) S) { \
119 DISPATCH(BinaryOperator, BinaryOperator); \
133 #undef BINOP_FALLBACK
137 #define CAO_FALLBACK(NAME) \
138 RetTy VisitBin ## NAME(PTR(CompoundAssignOperator) S) { \
139 DISPATCH(CompoundAssignOperator, CompoundAssignOperator); \
149 #define UNARYOP_FALLBACK(NAME) \
150 RetTy VisitUnary ## NAME(PTR(UnaryOperator) S) { \
151 DISPATCH(UnaryOperator, UnaryOperator); \
161 #undef UNARYOP_FALLBACK
164 RetTy VisitStmt(
PTR(
Stmt)
Node) {
return RetTy(); }
175 template<
typename ImplClass,
typename RetTy=
void>
184 template<
typename ImplClass,
typename RetTy=
void>
190 template<
class ImplClass,
template <
typename>
class Ptr,
typename RetTy>
193 #define PTR(CLASS) typename Ptr<CLASS>::type
194 #define DISPATCH(CLASS) \
195 return static_cast<ImplClass*>(this)->Visit##CLASS(static_cast<PTR(CLASS)>(S))
197 #define OPENMP_CLAUSE(Name, Class) \
198 RetTy Visit ## Class (PTR(Class) S) { DISPATCH(Class); }
199 #include "clang/Basic/OpenMPKinds.def"
204 default: llvm_unreachable(
"Unknown clause kind!");
205 #define OPENMP_CLAUSE(Name, Class) \
206 case OMPC_ ## Name : return Visit ## Class(static_cast<PTR(Class)>(S));
207 #include "clang/Basic/OpenMPKinds.def"
216 template<
class ImplClass,
typename RetTy =
void>
219 template<
class ImplClass,
typename RetTy =
void>
#define CAO_FALLBACK(NAME)
This class implements a simple visitor for OMPClause subclasses.
Defines the Objective-C statement AST node classes.
Defines the clang::Expr interface and subclasses for C++ expressions.
A builtin binary operation expression such as "x + y" or "x <= y".
#define DISPATCH(NAME, CLASS)
OpenMPClauseKind getClauseKind() const
Returns kind of OpenMP clause (private, shared, reduction, etc.).
RetTy Visit(PTR(OMPClause) S)
This is a basic class for representing single OpenMP clause.
ast_type_traits::DynTypedNode Node
RetTy VisitOMPClause(PTR(OMPClause) Node)
This file defines OpenMP AST classes for executable directives and clauses.
#define UNARYOP_FALLBACK(NAME)
BINOP_FALLBACK(PtrMemD) BINOP_FALLBACK(PtrMemI) BINOP_FALLBACK(Mul) BINOP_FALLBACK(Div) BINOP_FALLBACK(Rem) BINOP_FALLBACK(Add) BINOP_FALLBACK(Sub) BINOP_FALLBACK(Shl) BINOP_FALLBACK(LT) BINOP_FALLBACK(GT) BINOP_FALLBACK(LE) BINOP_FALLBACK(GE) BINOP_FALLBACK(EQ) BINOP_FALLBACK(NE) BINOP_FALLBACK(And) BINOP_FALLBACK(Xor) BINOP_FALLBACK(Or) BINOP_FALLBACK(LAnd) BINOP_FALLBACK(LOr) CAO_FALLBACK(MulAssign) CAO_FALLBACK(DivAssign) CAO_FALLBACK(RemAssign) CAO_FALLBACK(AddAssign) CAO_FALLBACK(SubAssign) CAO_FALLBACK(ShlAssign) CAO_FALLBACK(ShrAssign) CAO_FALLBACK(AndAssign) CAO_FALLBACK(OrAssign) UNARYOP_FALLBACK(PostInc) UNARYOP_FALLBACK(PostDec) UNARYOP_FALLBACK(PreInc) UNARYOP_FALLBACK(PreDec) UNARYOP_FALLBACK(AddrOf) UNARYOP_FALLBACK(Deref) UNARYOP_FALLBACK(Plus) UNARYOP_FALLBACK(Minus) UNARYOP_FALLBACK(Not) UNARYOP_FALLBACK(LNot) UNARYOP_FALLBACK(Real) UNARYOP_FALLBACK(Imag) RetTy VisitStmt(PTR(Stmt) Node)