summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ASTDumper.cpp
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2018-12-09 13:23:07 +0000
committerStephen Kelly <steveire@gmail.com>2018-12-09 13:23:07 +0000
commit3283535dc8c82c0fab0236a94c1f06e7e4f6ba48 (patch)
treeacc90b5ce10341942218fd5691f1446ce7459d77 /clang/lib/AST/ASTDumper.cpp
parent39271a195babb514ce99226f0718000f0d592aab (diff)
downloadbcm5719-llvm-3283535dc8c82c0fab0236a94c1f06e7e4f6ba48.tar.gz
bcm5719-llvm-3283535dc8c82c0fab0236a94c1f06e7e4f6ba48.zip
Introduce optional labels to dumpStmt
If the label is present, it is added as a child, with the statement a child of the label. This preserves behavior of the InitListExpr dump output. llvm-svn: 348717
Diffstat (limited to 'clang/lib/AST/ASTDumper.cpp')
-rw-r--r--clang/lib/AST/ASTDumper.cpp21
1 files changed, 15 insertions, 6 deletions
diff --git a/clang/lib/AST/ASTDumper.cpp b/clang/lib/AST/ASTDumper.cpp
index b95813ed7c1..d1d7097a64e 100644
--- a/clang/lib/AST/ASTDumper.cpp
+++ b/clang/lib/AST/ASTDumper.cpp
@@ -83,7 +83,8 @@ namespace {
void setDeserialize(bool D) { Deserialize = D; }
void dumpDecl(const Decl *D);
- void dumpStmt(const Stmt *S);
+ void dumpStmt(const Stmt *S, const char *label = nullptr);
+ void dumpStmtImpl(const Stmt *S);
// Utilities
void dumpType(QualType T) { NodeDumper.dumpType(T); }
@@ -1711,7 +1712,18 @@ void ASTDumper::VisitBlockDecl(const BlockDecl *D) {
// Stmt dumping methods.
//===----------------------------------------------------------------------===//
-void ASTDumper::dumpStmt(const Stmt *S) {
+void ASTDumper::dumpStmt(const Stmt *S, const char *label) {
+ if (label) {
+ dumpChild([=] {
+ OS << label;
+ dumpStmtImpl(S);
+ });
+ } else {
+ dumpStmtImpl(S);
+ }
+}
+
+void ASTDumper::dumpStmtImpl(const Stmt *S) {
dumpChild([=] {
if (!S) {
ColorScope Color(OS, ShowColors, NullColor);
@@ -1978,10 +1990,7 @@ void ASTDumper::VisitInitListExpr(const InitListExpr *ILE) {
NodeDumper.dumpBareDeclRef(Field);
}
if (auto *Filler = ILE->getArrayFiller()) {
- dumpChild([=] {
- OS << "array filler";
- dumpStmt(Filler);
- });
+ dumpStmt(Filler, "array filler");
}
}
OpenPOWER on IntegriCloud