00001 //===-- ast/StmtDumper.h -------------------------------------- -*- C++ -*-===// 00002 // 00003 // This file is distributed under the MIT license. See LICENSE.txt for details. 00004 // 00005 // Copyright (C) 2009-2010, Stephen Wilson 00006 // 00007 //===----------------------------------------------------------------------===// 00008 00009 //===----------------------------------------------------------------------===// 00017 //===----------------------------------------------------------------------===// 00018 00019 #ifndef COMMA_AST_STMTDUMPER_HDR_GUARD 00020 #define COMMA_AST_STMTDUMPER_HDR_GUARD 00021 00022 #include "AstDumper.h" 00023 #include "DeclDumper.h" 00024 #include "ExprDumper.h" 00025 #include "comma/ast/StmtVisitor.h" 00026 00027 namespace comma { 00028 00029 class StmtDumper : public AstDumperBase, private StmtVisitor { 00030 00031 public: 00034 StmtDumper(llvm::raw_ostream &stream, AstDumper *dumper) 00035 : AstDumperBase(stream), dumper(dumper) { } 00036 00039 llvm::raw_ostream &dump(Stmt *stmt, unsigned level = 0); 00040 00041 private: 00043 AstDumper *dumper; 00044 00046 llvm::raw_ostream &dumpAST(Ast *node); 00047 00058 void visitStmtSequence(StmtSequence *node); 00059 void visitBlockStmt(BlockStmt *node); 00060 void visitProcedureCallStmt(ProcedureCallStmt *node); 00061 void visitReturnStmt(ReturnStmt *node); 00062 void visitAssignmentStmt(AssignmentStmt *node); 00063 void visitIfStmt(IfStmt *node); 00064 void visitWhileStmt(WhileStmt *node); 00065 void visitForStmt(ForStmt *node); 00066 void visitLoopStmt(LoopStmt *node); 00067 void visitPragmaStmt(PragmaStmt *node); 00068 void visitNullStmt(NullStmt *node); 00069 }; 00070 00071 } // end comma namespace. 00072 00073 #endif