Now that we are passing back "free standing decls", make sure -ast-dump works like -ast-print.
Also added a cast to be safe...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44209 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/AST/StmtDumper.cpp b/AST/StmtDumper.cpp
index a30b901..c6ab298 100644
--- a/AST/StmtDumper.cpp
+++ b/AST/StmtDumper.cpp
@@ -219,8 +219,16 @@
}
}
fprintf(F, "\"");
+ } else if (TagDecl *TD = dyn_cast<TagDecl>(D)) {
+ // print a free standing tag decl (e.g. "struct x;").
+ const char *tagname;
+ if (const IdentifierInfo *II = TD->getIdentifier())
+ tagname = II->getName();
+ else
+ tagname = "<anonymous>";
+ fprintf(F, "\"%s %s;\"", TD->getKindName(), tagname);
+ // FIXME: print tag bodies.
} else {
- // FIXME: "struct x;"
assert(0 && "Unexpected decl");
}
}