[cfe-commits] r40959 - /cfe/trunk/AST/StmtDumper.cpp
Chris Lattner
sabre at nondot.org
Wed Aug 8 18:04:32 PDT 2007
Author: lattner
Date: Wed Aug 8 20:04:32 2007
New Revision: 40959
URL: http://llvm.org/viewvc/llvm-project?rev=40959&view=rev
Log:
add dumping support for some new nodes
Modified:
cfe/trunk/AST/StmtDumper.cpp
Modified: cfe/trunk/AST/StmtDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/AST/StmtDumper.cpp?rev=40959&r1=40958&r2=40959&view=diff
==============================================================================
--- cfe/trunk/AST/StmtDumper.cpp (original)
+++ cfe/trunk/AST/StmtDumper.cpp Wed Aug 8 20:04:32 2007
@@ -166,17 +166,14 @@
}
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::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 @@
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;
More information about the cfe-commits
mailing list