DumpType(Node->getType());
}
+ // Stmts.
void VisitStmt(Stmt *Node);
-#define STMT(N, CLASS, PARENT) \
- void Visit##CLASS(CLASS *Node);
-#include "clang/AST/StmtNodes.def"
+ void VisitDeclStmt(DeclStmt *Node);
+ void VisitLabelStmt(LabelStmt *Node);
+ void VisitGotoStmt(GotoStmt *Node);
+
+ // Exprs
+ void VisitExpr(Expr *Node);
+ void VisitDeclRefExpr(DeclRefExpr *Node);
+ void VisitPreDefinedExpr(PreDefinedExpr *Node);
+ void VisitCharacterLiteral(CharacterLiteral *Node);
+ void VisitIntegerLiteral(IntegerLiteral *Node);
+ void VisitFloatingLiteral(FloatingLiteral *Node);
+ void VisitStringLiteral(StringLiteral *Str);
+ void VisitUnaryOperator(UnaryOperator *Node);
+ void VisitSizeOfAlignOfTypeExpr(SizeOfAlignOfTypeExpr *Node);
+ void VisitMemberExpr(MemberExpr *Node);
+ void VisitOCUVectorElementExpr(OCUVectorElementExpr *Node);
+ void VisitBinaryOperator(BinaryOperator *Node);
+ void VisitCompoundAssignOperator(CompoundAssignOperator *Node);
+ void VisitAddrLabelExpr(AddrLabelExpr *Node);
+ void VisitTypesCompatibleExpr(TypesCompatibleExpr *Node);
+
+ // C++
+ void VisitCXXCastExpr(CXXCastExpr *Node);
+ void VisitCXXBoolLiteralExpr(CXXBoolLiteralExpr *Node);
+
+ // ObjC
+ void VisitObjCEncodeExpr(ObjCEncodeExpr *Node);
};
}
//===----------------------------------------------------------------------===//
void StmtDumper::VisitStmt(Stmt *Node) {
- Indent();
- fprintf(F, "<<unknown stmt type>>\n");
+ DumpStmt(Node);
}
void StmtDumper::DumpDeclarator(Decl *D) {
}
}
-
-void StmtDumper::VisitNullStmt(NullStmt *Node) {
- DumpStmt(Node);
-}
-
void StmtDumper::VisitDeclStmt(DeclStmt *Node) {
DumpStmt(Node);
fprintf(F, "\n");
}
}
-void StmtDumper::VisitCompoundStmt(CompoundStmt *Node) {
- DumpStmt(Node);
-}
-
-void StmtDumper::VisitCaseStmt(CaseStmt *Node) {
- DumpStmt(Node);
-}
-
-void StmtDumper::VisitDefaultStmt(DefaultStmt *Node) {
- DumpStmt(Node);
-}
-
void StmtDumper::VisitLabelStmt(LabelStmt *Node) {
DumpStmt(Node);
fprintf(F, " '%s'\n", Node->getName());
}
-void StmtDumper::VisitIfStmt(IfStmt *Node) {
- DumpStmt(Node);
-}
-
-void StmtDumper::VisitSwitchStmt(SwitchStmt *Node) {
- DumpStmt(Node);
-}
-
-void StmtDumper::VisitSwitchCase(SwitchCase*) {
- assert(0 && "SwitchCase is an abstract class");
-}
-
-void StmtDumper::VisitWhileStmt(WhileStmt *Node) {
- DumpStmt(Node);
-}
-
-void StmtDumper::VisitDoStmt(DoStmt *Node) {
- DumpStmt(Node);
-}
-
-void StmtDumper::VisitForStmt(ForStmt *Node) {
- DumpStmt(Node);
-}
-
void StmtDumper::VisitGotoStmt(GotoStmt *Node) {
DumpStmt(Node);
fprintf(F, " '%s':%p", Node->getLabel()->getName(), (void*)Node->getLabel());
}
-void StmtDumper::VisitIndirectGotoStmt(IndirectGotoStmt *Node) {
- DumpStmt(Node);
-}
-
-void StmtDumper::VisitContinueStmt(ContinueStmt *Node) {
- DumpStmt(Node);
-}
-
-void StmtDumper::VisitBreakStmt(BreakStmt *Node) {
- DumpStmt(Node);
-}
-
-
-void StmtDumper::VisitReturnStmt(ReturnStmt *Node) {
- DumpStmt(Node);
-}
-
//===----------------------------------------------------------------------===//
// Expr printing methods.
//===----------------------------------------------------------------------===//
void StmtDumper::VisitExpr(Expr *Node) {
DumpExpr(Node);
- fprintf(F, ": UNKNOWN EXPR to StmtDumper)");
}
void StmtDumper::VisitDeclRefExpr(DeclRefExpr *Node) {
fprintf(F, " %f", Node->getValue());
}
-void StmtDumper::VisitImaginaryLiteral(ImaginaryLiteral *Node) {
- DumpExpr(Node);
-}
-
void StmtDumper::VisitStringLiteral(StringLiteral *Str) {
DumpExpr(Str);
// FIXME: this doesn't print wstrings right.
}
fprintf(F, "\"");
}
-void StmtDumper::VisitParenExpr(ParenExpr *Node) {
- DumpExpr(Node);
-}
+
void StmtDumper::VisitUnaryOperator(UnaryOperator *Node) {
DumpExpr(Node);
fprintf(F, " %s '%s'", Node->isPostfix() ? "postfix" : "prefix",
fprintf(F, " %s ", Node->isSizeOf() ? "sizeof" : "alignof");
DumpType(Node->getArgumentType());
}
-void StmtDumper::VisitArraySubscriptExpr(ArraySubscriptExpr *Node) {
- DumpExpr(Node);
-}
-
-void StmtDumper::VisitCallExpr(CallExpr *Node) {
- DumpExpr(Node);
-}
void StmtDumper::VisitMemberExpr(MemberExpr *Node) {
DumpExpr(Node);
DumpExpr(Node);
fprintf(F, " %s", Node->getAccessor().getName());
}
-void StmtDumper::VisitCastExpr(CastExpr *Node) {
- DumpExpr(Node);
-}
-void StmtDumper::VisitCompoundLiteralExpr(CompoundLiteralExpr *Node) {
- DumpExpr(Node);
-}
-void StmtDumper::VisitImplicitCastExpr(ImplicitCastExpr *Node) {
- DumpExpr(Node);
-}
void StmtDumper::VisitBinaryOperator(BinaryOperator *Node) {
DumpExpr(Node);
fprintf(F, " '%s'", BinaryOperator::getOpcodeStr(Node->getOpcode()));
BinaryOperator::getOpcodeStr(Node->getOpcode()));
DumpType(Node->getComputationType());
}
-void StmtDumper::VisitConditionalOperator(ConditionalOperator *Node) {
- DumpExpr(Node);
-}
// GNU extensions.
fprintf(F, " %s %p", Node->getLabel()->getName(), (void*)Node->getLabel());
}
-void StmtDumper::VisitStmtExpr(StmtExpr *Node) {
- DumpExpr(Node);
-}
-
void StmtDumper::VisitTypesCompatibleExpr(TypesCompatibleExpr *Node) {
DumpExpr(Node);
fprintf(F, " ");
DumpType(Node->getArgType2());
}
-void StmtDumper::VisitChooseExpr(ChooseExpr *Node) {
- DumpExpr(Node);
-}
-
//===----------------------------------------------------------------------===//
// C++ Expressions
//===----------------------------------------------------------------------===//
// Obj-C Expressions
//===----------------------------------------------------------------------===//
-void StmtDumper::VisitObjCStringLiteral(ObjCStringLiteral *Node) {
- DumpExpr(Node);
-}
-
void StmtDumper::VisitObjCEncodeExpr(ObjCEncodeExpr *Node) {
DumpExpr(Node);