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 | 273a1ea2e831f48e018f9033da2af8a3aaf7b8de (patch) | |
| tree | 4462c14c022084f83357ceaabad235a35a0c1dc7 | |
| parent | ba1a98a4e0dd43cec625fbb5435c13e987263a2f (diff) | |
| download | bcm5719-llvm-273a1ea2e831f48e018f9033da2af8a3aaf7b8de.tar.gz bcm5719-llvm-273a1ea2e831f48e018f9033da2af8a3aaf7b8de.zip  | |
add dumping support for some new nodes
llvm-svn: 40959
| -rw-r--r-- | clang/AST/StmtDumper.cpp | 74 | 
1 files changed, 15 insertions, 59 deletions
diff --git a/clang/AST/StmtDumper.cpp b/clang/AST/StmtDumper.cpp index 5d288778b3e..145f8a1c223 100644 --- a/clang/AST/StmtDumper.cpp +++ b/clang/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;  | 

