diff options
author | Chris Lattner <sabre@nondot.org> | 2007-08-09 01:04:32 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-08-09 01:04:32 +0000 |
commit | a0df31ac1f09a3cf2f08c5c3a134376640dc7893 (patch) | |
tree | 62fce7465a7904ef5c7b5511b025f3b83ec28d5f | |
parent | fd8f7da224ef188f799256a6bc37c463ba0071ed (diff) |
add dumping support for some new nodes
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40959 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | AST/StmtDumper.cpp | 74 |
1 files changed, 15 insertions, 59 deletions
diff --git a/AST/StmtDumper.cpp b/AST/StmtDumper.cpp index 5d288778b3..145f8a1c22 100644 --- a/AST/StmtDumper.cpp +++ b/AST/StmtDumper.cpp @@ -166,17 +166,14 @@ void StmtDumper::VisitCompoundStmt(CompoundStmt *Node) { } void StmtDumper::VisitCaseStmt(CaseStmt *Node) { -#if 0 - Indent(-1) << "case "; - DumpExpr(Node->getLHS()); - if (Node->getRHS()) { - OS << " ... "; - DumpExpr(Node->getRHS()); - } - OS << ":\n"; - - DumpSubTree(Node->getSubStmt(), 0); -#endif + DumpStmt(Node); + fprintf(F, "\n"); + DumpSubTree(Node->getLHS()); + fprintf(F, "\n"); + DumpSubTree(Node->getRHS()); + fprintf(F, "\n"); + DumpSubTree(Node->getSubStmt()); + fprintf(F, ")"); } void StmtDumper::VisitDefaultStmt(DefaultStmt *Node) { @@ -313,53 +310,8 @@ void StmtDumper::VisitPreDefinedExpr(PreDefinedExpr *Node) { } void StmtDumper::VisitCharacterLiteral(CharacterLiteral *Node) { -#if 0 - // FIXME should print an L for wchar_t constants - unsigned value = Node->getValue(); - switch (value) { - case '\\': - OS << "'\\\\'"; - break; - case '\'': - OS << "'\\''"; - break; - case '\a': - // TODO: K&R: the meaning of '\\a' is different in traditional C - OS << "'\\a'"; - break; - case '\b': - OS << "'\\b'"; - break; - // Nonstandard escape sequence. - /*case '\e': - OS << "'\\e'"; - break;*/ - case '\f': - OS << "'\\f'"; - break; - case '\n': - OS << "'\\n'"; - break; - case '\r': - OS << "'\\r'"; - break; - case '\t': - OS << "'\\t'"; - break; - case '\v': - OS << "'\\v'"; - break; - default: - if (isprint(value) && value < 256) { - OS << "'" << (char)value << "'"; - } else if (value < 256) { - OS << "'\\x" << std::hex << value << std::dec << "'"; - } else { - // FIXME what to really do here? - OS << value; - } - } -#endif + DumpExpr(Node); + fprintf(F, " %d)", Node->getValue()); } void StmtDumper::VisitIntegerLiteral(IntegerLiteral *Node) { @@ -373,11 +325,15 @@ void StmtDumper::VisitFloatingLiteral(FloatingLiteral *Node) { fprintf(F, " %f)", Node->getValue()); } void StmtDumper::VisitStringLiteral(StringLiteral *Str) { + DumpExpr(Str); + // FIXME: this doesn't print wstrings right. + // FIXME: this doesn't print strings with \0's in them. + fprintf(F, " \"%s\")", Str->getStrData()); + #if 0 if (Str->isWide()) OS << 'L'; OS << '"'; - // FIXME: this doesn't print wstrings right. for (unsigned i = 0, e = Str->getByteLength(); i != e; ++i) { switch (Str->getStrData()[i]) { default: OS << Str->getStrData()[i]; break; |