summaryrefslogtreecommitdiffstats
path: root/clang/AST/StmtPrinter.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-08-08 22:51:59 +0000
committerChris Lattner <sabre@nondot.org>2007-08-08 22:51:59 +0000
commitcbe4f77c9e787c3d669e48005d03d6bf835dfa8e (patch)
tree60bc23ec633d027540d2e3f708e4080a140865a6 /clang/AST/StmtPrinter.cpp
parent2b21c3c7a8ddeb327590482a54e0c44954ffe6e8 (diff)
downloadbcm5719-llvm-cbe4f77c9e787c3d669e48005d03d6bf835dfa8e.tar.gz
bcm5719-llvm-cbe4f77c9e787c3d669e48005d03d6bf835dfa8e.zip
add a new AST dumper interface (E->dump()). This dumps out
the AST in a structural, non-pretty, form useful for understanding the AST. It isn't quite done yet, but is already somewhat useful. For this example: int test(short X, long long Y) { return X < ((100)); } we get (with -parse-ast-dump): int test(short X, long long Y) (CompoundStmt 0x2905ce0 (ReturnStmt 0x2905cd0 (BinaryOperator 0x2905cb0 '<' (ImplicitCastExpr 0x2905ca0 (DeclRefExpr 0x2905c20 Decl='X' 0x2905bb0)) (ParenExpr 0x2905c80 (ParenExpr 0x2905c60 (IntegerLiteral 0x2905c40 100)))))) llvm-svn: 40954
Diffstat (limited to 'clang/AST/StmtPrinter.cpp')
-rw-r--r--clang/AST/StmtPrinter.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/clang/AST/StmtPrinter.cpp b/clang/AST/StmtPrinter.cpp
index 41aa6468dbf..f44e20a0ab5 100644
--- a/clang/AST/StmtPrinter.cpp
+++ b/clang/AST/StmtPrinter.cpp
@@ -7,7 +7,8 @@
//
//===----------------------------------------------------------------------===//
//
-// This file implements the Stmt::dump/Stmt::print methods.
+// This file implements the Stmt::dumpPretty/Stmt::printPretty methods, which
+// pretty print the AST back out to C code.
//
//===----------------------------------------------------------------------===//
@@ -524,12 +525,12 @@ void StmtPrinter::VisitCXXBoolLiteralExpr(CXXBoolLiteralExpr *Node) {
// Stmt method implementations
//===----------------------------------------------------------------------===//
-void Stmt::dump() const {
+void Stmt::dumpPretty() const {
// FIXME: eliminate use of <iostream>
- print(std::cerr);
+ printPretty(std::cerr);
}
-void Stmt::print(std::ostream &OS) const {
+void Stmt::printPretty(std::ostream &OS) const {
if (this == 0) {
OS << "<NULL>";
return;
OpenPOWER on IntegriCloud