This machine mirrors various open-source projects.
20 Gbit/s uplink.
If there are any issues or you want another project mirrored, please contact
mirror-service -=AT=- netcologne DOT de !
00001 //===-- ast/AstDumper.h --------------------------------------- -*- C++ -*-===// 00002 // 00003 // This file is distributed under the MIT license. See LICENSE.txt for details. 00004 // 00005 // Copyright (C) 2009, Stephen Wilson 00006 // 00007 //===----------------------------------------------------------------------===// 00008 00009 //===----------------------------------------------------------------------===// 00016 //===----------------------------------------------------------------------===// 00017 00018 #ifndef COMMA_AST_ASTDUMPER_HDR_GUARD 00019 #define COMMA_AST_ASTDUMPER_HDR_GUARD 00020 00021 #include "comma/basic/ParameterModes.h" 00022 00023 #include "llvm/Support/raw_ostream.h" 00024 00025 namespace comma { 00026 00027 class Ast; 00028 class Decl; 00029 class Expr; 00030 class RangeAttrib; 00031 class Stmt; 00032 class Type; 00033 00036 class AstDumperBase { 00037 00038 public: 00039 virtual ~AstDumperBase() { } 00040 00042 AstDumperBase(llvm::raw_ostream &S) : S(S), indentLevel(0) { } 00043 00044 protected: 00046 llvm::raw_ostream &S; 00047 00049 unsigned indentLevel; 00050 00053 void indent() { indentLevel += 2; } 00054 00056 void dedent() { indentLevel -= 2; } 00057 00062 virtual llvm::raw_ostream &printHeader(Ast *node); 00063 00068 llvm::raw_ostream &printIndentation(); 00069 00073 llvm::raw_ostream &dumpParamMode(PM::ParameterMode mode); 00074 }; 00075 00077 class DeclDumper; 00078 class ExprDumper; 00079 class StmtDumper; 00080 class TypeDumper; 00081 00082 class AstDumper : public AstDumperBase { 00083 00084 public: 00087 AstDumper(llvm::raw_ostream &stream); 00088 00089 ~AstDumper(); 00090 00093 llvm::raw_ostream &dump(Ast *node, unsigned level = 0); 00094 00095 private: 00098 DeclDumper *DDumper; 00099 ExprDumper *EDumper; 00100 StmtDumper *SDumper; 00101 TypeDumper *TDumper; 00102 00105 llvm::raw_ostream &dumpDecl(Decl *node); 00106 00109 llvm::raw_ostream &dumpExpr(Expr *node); 00110 00113 llvm::raw_ostream &dumpStmt(Stmt *node); 00114 00117 llvm::raw_ostream &dumpType(Type *node); 00118 00120 llvm::raw_ostream &dumpRangeAttrib(RangeAttrib *node); 00121 }; 00122 00123 } // end comma namespace. 00124 00125 #endif