[cfe-commits] r44924 - /cfe/trunk/AST/StmtDumper.cpp
Ted Kremenek
kremenek at apple.com
Tue Dec 11 22:59:42 PST 2007
Author: kremenek
Date: Wed Dec 12 00:59:42 2007
New Revision: 44924
URL: http://llvm.org/viewvc/llvm-project?rev=44924&view=rev
Log:
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.
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=44924&r1=44923&r2=44924&view=diff
==============================================================================
--- cfe/trunk/AST/StmtDumper.cpp (original)
+++ cfe/trunk/AST/StmtDumper.cpp Wed Dec 12 00:59:42 2007
@@ -54,17 +54,21 @@
++IndentLevel;
if (S) {
- Visit(S);
-
- // Print out children.
- Stmt::child_iterator CI = S->child_begin(), CE = S->child_end();
- if (CI != CE) {
- while (CI != CE) {
- fprintf(F, "\n");
- DumpSubTree(*CI++);
+ if (DeclStmt* DS = dyn_cast<DeclStmt>(S))
+ VisitDeclStmt(DS);
+ else {
+ Visit(S);
+
+ // Print out children.
+ Stmt::child_iterator CI = S->child_begin(), CE = S->child_end();
+ if (CI != CE) {
+ while (CI != CE) {
+ fprintf(F, "\n");
+ DumpSubTree(*CI++);
+ }
}
+ fprintf(F, ")");
}
- fprintf(F, ")");
} else {
Indent();
fprintf(F, "<<<NULL>>>");
@@ -102,6 +106,7 @@
// Stmts.
void VisitStmt(Stmt *Node);
+ void VisitDeclStmt(DeclStmt *Node);
void VisitLabelStmt(LabelStmt *Node);
void VisitGotoStmt(GotoStmt *Node);
@@ -232,6 +237,20 @@
}
}
+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());
More information about the cfe-commits
mailing list