Added back VisitDeclStmt() to the StmtDumper, essentially reverting r44920:

http://llvm.org/viewvc/llvm-project?rev=44920&view=rev

Putting VisitDeclStmt() was motivated because it called DumpDeclarator(),
which printed out a little bit more information than just using the
child_iterator interface to visit the subexpressions of DeclStmt. To avoid
printing the initializers twice, DumpSubTree() now specially checks for
DeclStmts; in such cases it calls VisitDeclStmt() without using the
child_iterators to visit the subexpressions.

llvm-svn: 44924
This commit is contained in:
Ted Kremenek 2007-12-12 06:59:42 +00:00
parent 61511e12e0
commit 433a492f53
1 changed files with 28 additions and 9 deletions

View File

@ -54,6 +54,9 @@ namespace {
++IndentLevel;
if (S) {
if (DeclStmt* DS = dyn_cast<DeclStmt>(S))
VisitDeclStmt(DS);
else {
Visit(S);
// Print out children.
@ -65,6 +68,7 @@ namespace {
}
}
fprintf(F, ")");
}
} else {
Indent();
fprintf(F, "<<<NULL>>>");
@ -102,6 +106,7 @@ namespace {
// Stmts.
void VisitStmt(Stmt *Node);
void VisitDeclStmt(DeclStmt *Node);
void VisitLabelStmt(LabelStmt *Node);
void VisitGotoStmt(GotoStmt *Node);
@ -232,6 +237,20 @@ void StmtDumper::DumpDeclarator(Decl *D) {
}
}
void StmtDumper::VisitDeclStmt(DeclStmt *Node) {
DumpStmt(Node);
fprintf(F,"\n");
for (ScopedDecl *D = Node->getDecl(); D; D = D->getNextDeclarator()) {
++IndentLevel;
Indent();
fprintf(F, "%p ", (void*) D);
DumpDeclarator(D);
if (D->getNextDeclarator())
fprintf(F,"\n");
--IndentLevel;
}
}
void StmtDumper::VisitLabelStmt(LabelStmt *Node) {
DumpStmt(Node);
fprintf(F, " '%s'\n", Node->getName());