aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2007-12-12 06:59:42 +0000
committerTed Kremenek <kremenek@apple.com>2007-12-12 06:59:42 +0000
commit5399ce26f27e6d093417a3882e38da8738a78fef (patch)
tree07c331beac832d2a5c0247aff65f03c24d515728
parente8b724d481c9547de2ee6f442be594b38ada452d (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44924 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--AST/StmtDumper.cpp37
1 files changed, 28 insertions, 9 deletions
diff --git a/AST/StmtDumper.cpp b/AST/StmtDumper.cpp
index b36c80b237..ae792094a6 100644
--- a/AST/StmtDumper.cpp
+++ b/AST/StmtDumper.cpp
@@ -54,17 +54,21 @@ namespace {
++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 @@ 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());