blob: e167441c4437579098d81df81f351ce66578a3f2 [file] [log] [blame]
Chris Lattnercbe4f772007-08-08 22:51:59 +00001//===--- StmtDumper.cpp - Dumping implementation for Stmt ASTs ------------===//
2//
3// The LLVM Compiler Infrastructure
4//
Chris Lattner5b12ab82007-12-29 19:59:25 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Chris Lattnercbe4f772007-08-08 22:51:59 +00007//
8//===----------------------------------------------------------------------===//
9//
10// This file implements the Stmt::dump/Stmt::print methods, which dump out the
11// AST in a form that exposes type details and other fields.
12//
13//===----------------------------------------------------------------------===//
14
15#include "clang/AST/StmtVisitor.h"
Ted Kremenek5c84c012007-10-17 18:36:42 +000016#include "clang/AST/DeclObjC.h"
Douglas Gregor889ceb72009-02-03 19:21:40 +000017#include "clang/AST/DeclCXX.h"
Douglas Gregor7de59662009-05-29 20:38:28 +000018#include "clang/AST/PrettyPrinter.h"
Chris Lattner11e30d32007-08-30 06:17:34 +000019#include "clang/Basic/SourceManager.h"
Daniel Dunbar34a96c82009-12-03 09:13:13 +000020#include "llvm/Support/raw_ostream.h"
Chris Lattnercbe4f772007-08-08 22:51:59 +000021using namespace clang;
22
23//===----------------------------------------------------------------------===//
24// StmtDumper Visitor
25//===----------------------------------------------------------------------===//
26
27namespace {
Benjamin Kramer26222b62009-11-28 19:03:38 +000028 class StmtDumper : public StmtVisitor<StmtDumper> {
Chris Lattner11e30d32007-08-30 06:17:34 +000029 SourceManager *SM;
Daniel Dunbar34a96c82009-12-03 09:13:13 +000030 llvm::raw_ostream &OS;
Chris Lattnercbe4f772007-08-08 22:51:59 +000031 unsigned IndentLevel;
Mike Stump11289f42009-09-09 15:08:12 +000032
Chris Lattnercbe4f772007-08-08 22:51:59 +000033 /// MaxDepth - When doing a normal dump (not dumpAll) we only want to dump
34 /// the first few levels of an AST. This keeps track of how many ast levels
35 /// are left.
36 unsigned MaxDepth;
Mike Stump11289f42009-09-09 15:08:12 +000037
Chris Lattner11e30d32007-08-30 06:17:34 +000038 /// LastLocFilename/LastLocLine - Keep track of the last location we print
39 /// out so that we can print out deltas from then on out.
40 const char *LastLocFilename;
41 unsigned LastLocLine;
Douglas Gregor7de59662009-05-29 20:38:28 +000042
Chris Lattnercbe4f772007-08-08 22:51:59 +000043 public:
Daniel Dunbar34a96c82009-12-03 09:13:13 +000044 StmtDumper(SourceManager *sm, llvm::raw_ostream &os, unsigned maxDepth)
45 : SM(sm), OS(os), IndentLevel(0-1), MaxDepth(maxDepth) {
Chris Lattner11e30d32007-08-30 06:17:34 +000046 LastLocFilename = "";
47 LastLocLine = ~0U;
48 }
Mike Stump11289f42009-09-09 15:08:12 +000049
Chris Lattner8f184b12007-08-09 18:03:18 +000050 void DumpSubTree(Stmt *S) {
Chris Lattnercbe4f772007-08-08 22:51:59 +000051 // Prune the recursion if not using dump all.
52 if (MaxDepth == 0) return;
Mike Stump11289f42009-09-09 15:08:12 +000053
Chris Lattner8f184b12007-08-09 18:03:18 +000054 ++IndentLevel;
Chris Lattnercbe4f772007-08-08 22:51:59 +000055 if (S) {
Ted Kremenek433a4922007-12-12 06:59:42 +000056 if (DeclStmt* DS = dyn_cast<DeclStmt>(S))
57 VisitDeclStmt(DS);
Mike Stump11289f42009-09-09 15:08:12 +000058 else {
Ted Kremenek433a4922007-12-12 06:59:42 +000059 Visit(S);
Mike Stump11289f42009-09-09 15:08:12 +000060
Ted Kremenek433a4922007-12-12 06:59:42 +000061 // Print out children.
John McCall8322c3a2011-02-13 04:07:26 +000062 Stmt::child_range CI = S->children();
63 if (CI) {
64 while (CI) {
Daniel Dunbar34a96c82009-12-03 09:13:13 +000065 OS << '\n';
Ted Kremenek433a4922007-12-12 06:59:42 +000066 DumpSubTree(*CI++);
67 }
Chris Lattnercfb83dd2007-08-30 00:53:54 +000068 }
69 }
Chris Lattneredde8a92010-05-25 17:56:43 +000070 OS << ')';
Chris Lattnercbe4f772007-08-08 22:51:59 +000071 } else {
72 Indent();
Daniel Dunbar34a96c82009-12-03 09:13:13 +000073 OS << "<<<NULL>>>";
Chris Lattnercbe4f772007-08-08 22:51:59 +000074 }
Chris Lattner8f184b12007-08-09 18:03:18 +000075 --IndentLevel;
Chris Lattnercbe4f772007-08-08 22:51:59 +000076 }
Mike Stump11289f42009-09-09 15:08:12 +000077
Chris Lattner8f184b12007-08-09 18:03:18 +000078 void DumpDeclarator(Decl *D);
Mike Stump11289f42009-09-09 15:08:12 +000079
Chris Lattnercbe4f772007-08-08 22:51:59 +000080 void Indent() const {
81 for (int i = 0, e = IndentLevel; i < e; ++i)
Daniel Dunbar34a96c82009-12-03 09:13:13 +000082 OS << " ";
Chris Lattnercbe4f772007-08-08 22:51:59 +000083 }
Mike Stump11289f42009-09-09 15:08:12 +000084
Steve Naroff42a350a2007-09-01 21:08:38 +000085 void DumpType(QualType T) {
John McCall717d9b02010-12-10 11:01:00 +000086 SplitQualType T_split = T.split();
87 OS << "'" << QualType::getAsString(T_split) << "'";
Chris Lattner9bcd9152007-08-09 00:36:22 +000088
Douglas Gregor58354032008-12-24 00:01:03 +000089 if (!T.isNull()) {
John McCall8ccfcb52009-09-24 19:53:00 +000090 // If the type is sugared, also dump a (shallow) desugared type.
John McCall717d9b02010-12-10 11:01:00 +000091 SplitQualType D_split = T.getSplitDesugaredType();
92 if (T_split != D_split)
93 OS << ":'" << QualType::getAsString(D_split) << "'";
Chris Lattner091718d2008-04-02 05:06:23 +000094 }
Chris Lattner9bcd9152007-08-09 00:36:22 +000095 }
John McCall351762c2011-02-07 10:33:21 +000096 void DumpDeclRef(Decl *node);
Steve Naroff42a350a2007-09-01 21:08:38 +000097 void DumpStmt(const Stmt *Node) {
Chris Lattnercbe4f772007-08-08 22:51:59 +000098 Indent();
Daniel Dunbar34a96c82009-12-03 09:13:13 +000099 OS << "(" << Node->getStmtClassName()
100 << " " << (void*)Node;
Steve Naroff42a350a2007-09-01 21:08:38 +0000101 DumpSourceRange(Node);
Chris Lattnercbe4f772007-08-08 22:51:59 +0000102 }
John McCall7decc9e2010-11-18 06:31:45 +0000103 void DumpValueKind(ExprValueKind K) {
104 switch (K) {
105 case VK_RValue: break;
106 case VK_LValue: OS << " lvalue"; break;
107 case VK_XValue: OS << " xvalue"; break;
108 }
109 }
110 void DumpObjectKind(ExprObjectKind K) {
111 switch (K) {
112 case OK_Ordinary: break;
113 case OK_BitField: OS << " bitfield"; break;
114 case OK_ObjCProperty: OS << " objcproperty"; break;
115 case OK_VectorComponent: OS << " vectorcomponent"; break;
116 }
117 }
Steve Naroff42a350a2007-09-01 21:08:38 +0000118 void DumpExpr(const Expr *Node) {
Chris Lattnercbe4f772007-08-08 22:51:59 +0000119 DumpStmt(Node);
Daniel Dunbar34a96c82009-12-03 09:13:13 +0000120 OS << ' ';
Chris Lattner9bcd9152007-08-09 00:36:22 +0000121 DumpType(Node->getType());
John McCall7decc9e2010-11-18 06:31:45 +0000122 DumpValueKind(Node->getValueKind());
123 DumpObjectKind(Node->getObjectKind());
Chris Lattnercbe4f772007-08-08 22:51:59 +0000124 }
Steve Naroff42a350a2007-09-01 21:08:38 +0000125 void DumpSourceRange(const Stmt *Node);
Chris Lattner11e30d32007-08-30 06:17:34 +0000126 void DumpLocation(SourceLocation Loc);
Mike Stump11289f42009-09-09 15:08:12 +0000127
Chris Lattner84ca3762007-08-30 01:00:35 +0000128 // Stmts.
Chris Lattner62249a62007-08-21 04:04:25 +0000129 void VisitStmt(Stmt *Node);
Ted Kremenek433a4922007-12-12 06:59:42 +0000130 void VisitDeclStmt(DeclStmt *Node);
Chris Lattner84ca3762007-08-30 01:00:35 +0000131 void VisitLabelStmt(LabelStmt *Node);
132 void VisitGotoStmt(GotoStmt *Node);
Mike Stump11289f42009-09-09 15:08:12 +0000133
Chris Lattner84ca3762007-08-30 01:00:35 +0000134 // Exprs
135 void VisitExpr(Expr *Node);
Anders Carlssond7923c62009-08-22 23:33:40 +0000136 void VisitCastExpr(CastExpr *Node);
Chris Lattner84ca3762007-08-30 01:00:35 +0000137 void VisitDeclRefExpr(DeclRefExpr *Node);
Chris Lattner6307f192008-08-10 01:53:14 +0000138 void VisitPredefinedExpr(PredefinedExpr *Node);
Chris Lattner84ca3762007-08-30 01:00:35 +0000139 void VisitCharacterLiteral(CharacterLiteral *Node);
140 void VisitIntegerLiteral(IntegerLiteral *Node);
141 void VisitFloatingLiteral(FloatingLiteral *Node);
142 void VisitStringLiteral(StringLiteral *Str);
143 void VisitUnaryOperator(UnaryOperator *Node);
Peter Collingbournee190dee2011-03-11 19:24:49 +0000144 void VisitUnaryExprOrTypeTraitExpr(UnaryExprOrTypeTraitExpr *Node);
Chris Lattner84ca3762007-08-30 01:00:35 +0000145 void VisitMemberExpr(MemberExpr *Node);
Nate Begemance4d7fc2008-04-18 23:10:10 +0000146 void VisitExtVectorElementExpr(ExtVectorElementExpr *Node);
Chris Lattner84ca3762007-08-30 01:00:35 +0000147 void VisitBinaryOperator(BinaryOperator *Node);
148 void VisitCompoundAssignOperator(CompoundAssignOperator *Node);
149 void VisitAddrLabelExpr(AddrLabelExpr *Node);
John McCall351762c2011-02-07 10:33:21 +0000150 void VisitBlockExpr(BlockExpr *Node);
Chris Lattner84ca3762007-08-30 01:00:35 +0000151
152 // C++
Douglas Gregore200adc2008-10-27 19:41:14 +0000153 void VisitCXXNamedCastExpr(CXXNamedCastExpr *Node);
Chris Lattner84ca3762007-08-30 01:00:35 +0000154 void VisitCXXBoolLiteralExpr(CXXBoolLiteralExpr *Node);
Douglas Gregor8ea1f532008-11-04 14:56:14 +0000155 void VisitCXXThisExpr(CXXThisExpr *Node);
Douglas Gregore200adc2008-10-27 19:41:14 +0000156 void VisitCXXFunctionalCastExpr(CXXFunctionalCastExpr *Node);
Anders Carlsson073846832009-08-12 00:21:52 +0000157 void VisitCXXConstructExpr(CXXConstructExpr *Node);
158 void VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *Node);
John McCall5d413782010-12-06 08:20:24 +0000159 void VisitExprWithCleanups(ExprWithCleanups *Node);
John McCall76d09942009-12-11 21:50:11 +0000160 void VisitUnresolvedLookupExpr(UnresolvedLookupExpr *Node);
Anders Carlsson073846832009-08-12 00:21:52 +0000161 void DumpCXXTemporary(CXXTemporary *Temporary);
Mike Stump11289f42009-09-09 15:08:12 +0000162
Chris Lattner84ca3762007-08-30 01:00:35 +0000163 // ObjC
Douglas Gregor96c79492010-04-23 22:50:49 +0000164 void VisitObjCAtCatchStmt(ObjCAtCatchStmt *Node);
Chris Lattner84ca3762007-08-30 01:00:35 +0000165 void VisitObjCEncodeExpr(ObjCEncodeExpr *Node);
Ted Kremenek36748da2008-02-29 22:04:05 +0000166 void VisitObjCMessageExpr(ObjCMessageExpr* Node);
Fariborz Jahanian4bef4622007-10-16 20:40:23 +0000167 void VisitObjCSelectorExpr(ObjCSelectorExpr *Node);
Fariborz Jahaniana32aaef2007-10-17 16:58:11 +0000168 void VisitObjCProtocolExpr(ObjCProtocolExpr *Node);
Daniel Dunbar4b8c6db2008-08-30 05:35:15 +0000169 void VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *Node);
Steve Naroff5d5efca2008-03-12 13:19:12 +0000170 void VisitObjCIvarRefExpr(ObjCIvarRefExpr *Node);
Chris Lattnercbe4f772007-08-08 22:51:59 +0000171 };
172}
173
174//===----------------------------------------------------------------------===//
Chris Lattner11e30d32007-08-30 06:17:34 +0000175// Utilities
176//===----------------------------------------------------------------------===//
177
178void StmtDumper::DumpLocation(SourceLocation Loc) {
Chris Lattner53e384f2009-01-16 07:00:02 +0000179 SourceLocation SpellingLoc = SM->getSpellingLoc(Loc);
Mike Stump11289f42009-09-09 15:08:12 +0000180
Chris Lattner11e30d32007-08-30 06:17:34 +0000181 // The general format we print out is filename:line:col, but we drop pieces
182 // that haven't changed since the last loc printed.
Chris Lattnerf1ca7d32009-01-27 07:57:44 +0000183 PresumedLoc PLoc = SM->getPresumedLoc(SpellingLoc);
184
Douglas Gregor453b0122010-11-12 07:15:47 +0000185 if (PLoc.isInvalid()) {
186 OS << "<invalid sloc>";
187 return;
188 }
189
Chris Lattnerf1ca7d32009-01-27 07:57:44 +0000190 if (strcmp(PLoc.getFilename(), LastLocFilename) != 0) {
Daniel Dunbar34a96c82009-12-03 09:13:13 +0000191 OS << PLoc.getFilename() << ':' << PLoc.getLine()
192 << ':' << PLoc.getColumn();
Chris Lattnerf1ca7d32009-01-27 07:57:44 +0000193 LastLocFilename = PLoc.getFilename();
194 LastLocLine = PLoc.getLine();
195 } else if (PLoc.getLine() != LastLocLine) {
Daniel Dunbar34a96c82009-12-03 09:13:13 +0000196 OS << "line" << ':' << PLoc.getLine()
197 << ':' << PLoc.getColumn();
Chris Lattnerf1ca7d32009-01-27 07:57:44 +0000198 LastLocLine = PLoc.getLine();
Chris Lattner11e30d32007-08-30 06:17:34 +0000199 } else {
Daniel Dunbar34a96c82009-12-03 09:13:13 +0000200 OS << "col" << ':' << PLoc.getColumn();
Chris Lattner11e30d32007-08-30 06:17:34 +0000201 }
202}
203
Steve Naroff42a350a2007-09-01 21:08:38 +0000204void StmtDumper::DumpSourceRange(const Stmt *Node) {
Chris Lattner11e30d32007-08-30 06:17:34 +0000205 // Can't translate locations if a SourceManager isn't available.
206 if (SM == 0) return;
Mike Stump11289f42009-09-09 15:08:12 +0000207
Chris Lattner11e30d32007-08-30 06:17:34 +0000208 // TODO: If the parent expression is available, we can print a delta vs its
209 // location.
210 SourceRange R = Node->getSourceRange();
Mike Stump11289f42009-09-09 15:08:12 +0000211
Daniel Dunbar34a96c82009-12-03 09:13:13 +0000212 OS << " <";
Chris Lattnera7c19fe2007-10-16 22:36:42 +0000213 DumpLocation(R.getBegin());
214 if (R.getBegin() != R.getEnd()) {
Daniel Dunbar34a96c82009-12-03 09:13:13 +0000215 OS << ", ";
Chris Lattnera7c19fe2007-10-16 22:36:42 +0000216 DumpLocation(R.getEnd());
Chris Lattner11e30d32007-08-30 06:17:34 +0000217 }
Daniel Dunbar34a96c82009-12-03 09:13:13 +0000218 OS << ">";
Mike Stump11289f42009-09-09 15:08:12 +0000219
Chris Lattner11e30d32007-08-30 06:17:34 +0000220 // <t2.c:123:421[blah], t2.c:412:321>
221
222}
223
224
225//===----------------------------------------------------------------------===//
Chris Lattnercbe4f772007-08-08 22:51:59 +0000226// Stmt printing methods.
227//===----------------------------------------------------------------------===//
228
229void StmtDumper::VisitStmt(Stmt *Node) {
Chris Lattner84ca3762007-08-30 01:00:35 +0000230 DumpStmt(Node);
Chris Lattnercbe4f772007-08-08 22:51:59 +0000231}
232
Chris Lattner8f184b12007-08-09 18:03:18 +0000233void StmtDumper::DumpDeclarator(Decl *D) {
Chris Lattnercbe4f772007-08-08 22:51:59 +0000234 // FIXME: Need to complete/beautify this... this code simply shows the
235 // nodes are where they need to be.
236 if (TypedefDecl *localType = dyn_cast<TypedefDecl>(D)) {
Daniel Dunbar34a96c82009-12-03 09:13:13 +0000237 OS << "\"typedef " << localType->getUnderlyingType().getAsString()
Benjamin Kramerb11416d2010-04-17 09:33:03 +0000238 << ' ' << localType << '"';
Chris Lattnercbe4f772007-08-08 22:51:59 +0000239 } else if (ValueDecl *VD = dyn_cast<ValueDecl>(D)) {
Daniel Dunbar34a96c82009-12-03 09:13:13 +0000240 OS << "\"";
Chris Lattnercbe4f772007-08-08 22:51:59 +0000241 // Emit storage class for vardecls.
242 if (VarDecl *V = dyn_cast<VarDecl>(VD)) {
John McCall8e7d6562010-08-26 03:08:43 +0000243 if (V->getStorageClass() != SC_None)
Daniel Dunbar34a96c82009-12-03 09:13:13 +0000244 OS << VarDecl::getStorageClassSpecifierString(V->getStorageClass())
245 << " ";
Chris Lattnercbe4f772007-08-08 22:51:59 +0000246 }
Mike Stump11289f42009-09-09 15:08:12 +0000247
Chris Lattner1cbaacc2008-11-24 04:00:27 +0000248 std::string Name = VD->getNameAsString();
Mike Stump11289f42009-09-09 15:08:12 +0000249 VD->getType().getAsStringInternal(Name,
Chris Lattnerc61089a2009-06-30 01:26:17 +0000250 PrintingPolicy(VD->getASTContext().getLangOptions()));
Daniel Dunbar34a96c82009-12-03 09:13:13 +0000251 OS << Name;
Mike Stump11289f42009-09-09 15:08:12 +0000252
Chris Lattnercbe4f772007-08-08 22:51:59 +0000253 // If this is a vardecl with an initializer, emit it.
254 if (VarDecl *V = dyn_cast<VarDecl>(VD)) {
255 if (V->getInit()) {
Daniel Dunbar34a96c82009-12-03 09:13:13 +0000256 OS << " =\n";
Chris Lattner8f184b12007-08-09 18:03:18 +0000257 DumpSubTree(V->getInit());
Chris Lattnercbe4f772007-08-08 22:51:59 +0000258 }
259 }
Daniel Dunbar34a96c82009-12-03 09:13:13 +0000260 OS << '"';
Steve Naroff14f5f792007-11-17 21:37:36 +0000261 } else if (TagDecl *TD = dyn_cast<TagDecl>(D)) {
262 // print a free standing tag decl (e.g. "struct x;").
263 const char *tagname;
264 if (const IdentifierInfo *II = TD->getIdentifier())
Daniel Dunbar2c422dc92009-10-18 20:26:12 +0000265 tagname = II->getNameStart();
Steve Naroff14f5f792007-11-17 21:37:36 +0000266 else
267 tagname = "<anonymous>";
Daniel Dunbar34a96c82009-12-03 09:13:13 +0000268 OS << '"' << TD->getKindName() << ' ' << tagname << ";\"";
Steve Naroff14f5f792007-11-17 21:37:36 +0000269 // FIXME: print tag bodies.
Douglas Gregor889ceb72009-02-03 19:21:40 +0000270 } else if (UsingDirectiveDecl *UD = dyn_cast<UsingDirectiveDecl>(D)) {
271 // print using-directive decl (e.g. "using namespace x;")
272 const char *ns;
273 if (const IdentifierInfo *II = UD->getNominatedNamespace()->getIdentifier())
Daniel Dunbar2c422dc92009-10-18 20:26:12 +0000274 ns = II->getNameStart();
Douglas Gregor889ceb72009-02-03 19:21:40 +0000275 else
276 ns = "<anonymous>";
Daniel Dunbar34a96c82009-12-03 09:13:13 +0000277 OS << '"' << UD->getDeclKindName() << ns << ";\"";
Sebastian Redl80fecff2010-05-04 10:20:17 +0000278 } else if (UsingDecl *UD = dyn_cast<UsingDecl>(D)) {
279 // print using decl (e.g. "using std::string;")
280 const char *tn = UD->isTypeName() ? "typename " : "";
281 OS << '"' << UD->getDeclKindName() << tn;
Douglas Gregora9d87bc2011-02-25 00:36:19 +0000282 UD->getQualifier()->print(OS,
283 PrintingPolicy(UD->getASTContext().getLangOptions()));
Sebastian Redl80fecff2010-05-04 10:20:17 +0000284 OS << ";\"";
Chris Lattner43e7f312011-02-18 02:08:43 +0000285 } else if (LabelDecl *LD = dyn_cast<LabelDecl>(D)) {
286 OS << "label " << LD->getNameAsString();
Peter Collingbourne7d8a0b52011-03-16 18:37:27 +0000287 } else if (StaticAssertDecl *SAD = dyn_cast<StaticAssertDecl>(D)) {
288 OS << "\"static_assert(\n";
289 DumpSubTree(SAD->getAssertExpr());
290 OS << ",\n";
291 DumpSubTree(SAD->getMessage());
292 OS << ");\"";
Chris Lattnercbe4f772007-08-08 22:51:59 +0000293 } else {
Chris Lattnercbe4f772007-08-08 22:51:59 +0000294 assert(0 && "Unexpected decl");
295 }
Chris Lattnercbe4f772007-08-08 22:51:59 +0000296}
297
Ted Kremenek433a4922007-12-12 06:59:42 +0000298void StmtDumper::VisitDeclStmt(DeclStmt *Node) {
299 DumpStmt(Node);
Daniel Dunbar34a96c82009-12-03 09:13:13 +0000300 OS << "\n";
Ted Kremenek62408482008-10-06 18:38:35 +0000301 for (DeclStmt::decl_iterator DI = Node->decl_begin(), DE = Node->decl_end();
302 DI != DE; ++DI) {
Douglas Gregor6e6ad602009-01-20 01:17:11 +0000303 Decl* D = *DI;
Ted Kremenek433a4922007-12-12 06:59:42 +0000304 ++IndentLevel;
305 Indent();
Daniel Dunbar34a96c82009-12-03 09:13:13 +0000306 OS << (void*) D << " ";
Ted Kremenek433a4922007-12-12 06:59:42 +0000307 DumpDeclarator(D);
Chris Lattner3d954d52009-03-29 16:04:50 +0000308 if (DI+1 != DE)
Daniel Dunbar34a96c82009-12-03 09:13:13 +0000309 OS << "\n";
Ted Kremenek433a4922007-12-12 06:59:42 +0000310 --IndentLevel;
311 }
312}
313
Chris Lattnercbe4f772007-08-08 22:51:59 +0000314void StmtDumper::VisitLabelStmt(LabelStmt *Node) {
315 DumpStmt(Node);
Daniel Dunbar34a96c82009-12-03 09:13:13 +0000316 OS << " '" << Node->getName() << "'";
Chris Lattnercbe4f772007-08-08 22:51:59 +0000317}
318
Chris Lattnercbe4f772007-08-08 22:51:59 +0000319void StmtDumper::VisitGotoStmt(GotoStmt *Node) {
320 DumpStmt(Node);
Daniel Dunbar34a96c82009-12-03 09:13:13 +0000321 OS << " '" << Node->getLabel()->getName()
322 << "':" << (void*)Node->getLabel();
Chris Lattnercbe4f772007-08-08 22:51:59 +0000323}
324
Chris Lattnercbe4f772007-08-08 22:51:59 +0000325//===----------------------------------------------------------------------===//
326// Expr printing methods.
327//===----------------------------------------------------------------------===//
328
329void StmtDumper::VisitExpr(Expr *Node) {
330 DumpExpr(Node);
Chris Lattnercbe4f772007-08-08 22:51:59 +0000331}
332
Anders Carlssona70cff62010-04-24 19:06:50 +0000333static void DumpBasePath(llvm::raw_ostream &OS, CastExpr *Node) {
John McCallcf142162010-08-07 06:22:56 +0000334 if (Node->path_empty())
Anders Carlssona70cff62010-04-24 19:06:50 +0000335 return;
336
337 OS << " (";
338 bool First = true;
John McCallcf142162010-08-07 06:22:56 +0000339 for (CastExpr::path_iterator
340 I = Node->path_begin(), E = Node->path_end(); I != E; ++I) {
Anders Carlssona70cff62010-04-24 19:06:50 +0000341 const CXXBaseSpecifier *Base = *I;
342 if (!First)
343 OS << " -> ";
344
345 const CXXRecordDecl *RD =
346 cast<CXXRecordDecl>(Base->getType()->getAs<RecordType>()->getDecl());
347
348 if (Base->isVirtual())
349 OS << "virtual ";
350 OS << RD->getName();
351 First = false;
352 }
353
354 OS << ')';
355}
356
Anders Carlssond7923c62009-08-22 23:33:40 +0000357void StmtDumper::VisitCastExpr(CastExpr *Node) {
358 DumpExpr(Node);
Anders Carlssona70cff62010-04-24 19:06:50 +0000359 OS << " <" << Node->getCastKindName();
360 DumpBasePath(OS, Node);
361 OS << ">";
Anders Carlssond7923c62009-08-22 23:33:40 +0000362}
363
Chris Lattnercbe4f772007-08-08 22:51:59 +0000364void StmtDumper::VisitDeclRefExpr(DeclRefExpr *Node) {
365 DumpExpr(Node);
Ted Kremenek5f64ca82007-09-10 17:32:55 +0000366
Daniel Dunbar34a96c82009-12-03 09:13:13 +0000367 OS << " ";
John McCall351762c2011-02-07 10:33:21 +0000368 DumpDeclRef(Node->getDecl());
369}
370
371void StmtDumper::DumpDeclRef(Decl *d) {
372 OS << d->getDeclKindName() << ' ' << (void*) d;
373
374 if (NamedDecl *nd = dyn_cast<NamedDecl>(d)) {
375 OS << " '";
376 nd->getDeclName().printName(OS);
377 OS << "'";
Ted Kremenek5f64ca82007-09-10 17:32:55 +0000378 }
Mike Stump11289f42009-09-09 15:08:12 +0000379
John McCall351762c2011-02-07 10:33:21 +0000380 if (ValueDecl *vd = dyn_cast<ValueDecl>(d)) {
381 OS << ' '; DumpType(vd->getType());
382 }
Chris Lattnercbe4f772007-08-08 22:51:59 +0000383}
384
John McCall76d09942009-12-11 21:50:11 +0000385void StmtDumper::VisitUnresolvedLookupExpr(UnresolvedLookupExpr *Node) {
386 DumpExpr(Node);
387 OS << " (";
388 if (!Node->requiresADL()) OS << "no ";
Benjamin Kramerb11416d2010-04-17 09:33:03 +0000389 OS << "ADL) = '" << Node->getName() << '\'';
John McCall76d09942009-12-11 21:50:11 +0000390
391 UnresolvedLookupExpr::decls_iterator
392 I = Node->decls_begin(), E = Node->decls_end();
393 if (I == E) OS << " empty";
394 for (; I != E; ++I)
395 OS << " " << (void*) *I;
396}
397
Steve Naroff5d5efca2008-03-12 13:19:12 +0000398void StmtDumper::VisitObjCIvarRefExpr(ObjCIvarRefExpr *Node) {
Steve Naroffe3fa7132008-05-23 00:59:14 +0000399 DumpExpr(Node);
Steve Naroff5d5efca2008-03-12 13:19:12 +0000400
Daniel Dunbar34a96c82009-12-03 09:13:13 +0000401 OS << " " << Node->getDecl()->getDeclKindName()
Benjamin Kramerb11416d2010-04-17 09:33:03 +0000402 << "Decl='" << Node->getDecl()
Daniel Dunbar34a96c82009-12-03 09:13:13 +0000403 << "' " << (void*)Node->getDecl();
Steve Naroffb3424a92008-05-23 22:01:24 +0000404 if (Node->isFreeIvar())
Daniel Dunbar34a96c82009-12-03 09:13:13 +0000405 OS << " isFreeIvar";
Steve Naroff5d5efca2008-03-12 13:19:12 +0000406}
407
Chris Lattner6307f192008-08-10 01:53:14 +0000408void StmtDumper::VisitPredefinedExpr(PredefinedExpr *Node) {
Chris Lattnercbe4f772007-08-08 22:51:59 +0000409 DumpExpr(Node);
410 switch (Node->getIdentType()) {
Chris Lattnera9b3cae2008-06-21 18:04:54 +0000411 default: assert(0 && "unknown case");
Daniel Dunbar34a96c82009-12-03 09:13:13 +0000412 case PredefinedExpr::Func: OS << " __func__"; break;
413 case PredefinedExpr::Function: OS << " __FUNCTION__"; break;
414 case PredefinedExpr::PrettyFunction: OS << " __PRETTY_FUNCTION__";break;
Chris Lattnercbe4f772007-08-08 22:51:59 +0000415 }
416}
417
418void StmtDumper::VisitCharacterLiteral(CharacterLiteral *Node) {
Chris Lattner273a1ea2007-08-09 01:04:32 +0000419 DumpExpr(Node);
Daniel Dunbar34a96c82009-12-03 09:13:13 +0000420 OS << Node->getValue();
Chris Lattnercbe4f772007-08-08 22:51:59 +0000421}
422
423void StmtDumper::VisitIntegerLiteral(IntegerLiteral *Node) {
424 DumpExpr(Node);
425
426 bool isSigned = Node->getType()->isSignedIntegerType();
Daniel Dunbar34a96c82009-12-03 09:13:13 +0000427 OS << " " << Node->getValue().toString(10, isSigned);
Chris Lattnercbe4f772007-08-08 22:51:59 +0000428}
429void StmtDumper::VisitFloatingLiteral(FloatingLiteral *Node) {
430 DumpExpr(Node);
Daniel Dunbar34a96c82009-12-03 09:13:13 +0000431 OS << " " << Node->getValueAsApproximateDouble();
Chris Lattnercbe4f772007-08-08 22:51:59 +0000432}
Chris Lattner1c20a172007-08-26 03:42:43 +0000433
Chris Lattnercbe4f772007-08-08 22:51:59 +0000434void StmtDumper::VisitStringLiteral(StringLiteral *Str) {
Chris Lattner273a1ea2007-08-09 01:04:32 +0000435 DumpExpr(Str);
436 // FIXME: this doesn't print wstrings right.
Daniel Dunbar34a96c82009-12-03 09:13:13 +0000437 OS << " ";
438 if (Str->isWide())
439 OS << "L";
440 OS << '"';
Benjamin Kramer35b077e2010-08-17 12:54:38 +0000441 OS.write_escaped(Str->getString());
Daniel Dunbar34a96c82009-12-03 09:13:13 +0000442 OS << '"';
Chris Lattnercbe4f772007-08-08 22:51:59 +0000443}
Chris Lattner84ca3762007-08-30 01:00:35 +0000444
Chris Lattnercbe4f772007-08-08 22:51:59 +0000445void StmtDumper::VisitUnaryOperator(UnaryOperator *Node) {
Chris Lattnerdb3b3ff2007-08-09 17:35:30 +0000446 DumpExpr(Node);
Daniel Dunbar34a96c82009-12-03 09:13:13 +0000447 OS << " " << (Node->isPostfix() ? "postfix" : "prefix")
448 << " '" << UnaryOperator::getOpcodeStr(Node->getOpcode()) << "'";
Chris Lattnercbe4f772007-08-08 22:51:59 +0000449}
Peter Collingbournee190dee2011-03-11 19:24:49 +0000450void StmtDumper::VisitUnaryExprOrTypeTraitExpr(UnaryExprOrTypeTraitExpr *Node) {
Chris Lattnerdb3b3ff2007-08-09 17:35:30 +0000451 DumpExpr(Node);
Peter Collingbournee190dee2011-03-11 19:24:49 +0000452 switch(Node->getKind()) {
453 case UETT_SizeOf:
454 OS << " sizeof ";
455 break;
456 case UETT_AlignOf:
457 OS << " __alignof ";
458 break;
459 case UETT_VecStep:
460 OS << " vec_step ";
461 break;
462 }
Sebastian Redl6f282892008-11-11 17:56:53 +0000463 if (Node->isArgumentType())
464 DumpType(Node->getArgumentType());
Chris Lattnercbe4f772007-08-08 22:51:59 +0000465}
Chris Lattnerdb3b3ff2007-08-09 17:35:30 +0000466
Chris Lattnercbe4f772007-08-08 22:51:59 +0000467void StmtDumper::VisitMemberExpr(MemberExpr *Node) {
Chris Lattnerdb3b3ff2007-08-09 17:35:30 +0000468 DumpExpr(Node);
Daniel Dunbar34a96c82009-12-03 09:13:13 +0000469 OS << " " << (Node->isArrow() ? "->" : ".")
Benjamin Kramerb11416d2010-04-17 09:33:03 +0000470 << Node->getMemberDecl() << ' '
Daniel Dunbar34a96c82009-12-03 09:13:13 +0000471 << (void*)Node->getMemberDecl();
Chris Lattnercbe4f772007-08-08 22:51:59 +0000472}
Nate Begemance4d7fc2008-04-18 23:10:10 +0000473void StmtDumper::VisitExtVectorElementExpr(ExtVectorElementExpr *Node) {
Chris Lattnerdb3b3ff2007-08-09 17:35:30 +0000474 DumpExpr(Node);
Daniel Dunbar34a96c82009-12-03 09:13:13 +0000475 OS << " " << Node->getAccessor().getNameStart();
Chris Lattnercbe4f772007-08-08 22:51:59 +0000476}
Chris Lattnercbe4f772007-08-08 22:51:59 +0000477void StmtDumper::VisitBinaryOperator(BinaryOperator *Node) {
478 DumpExpr(Node);
Daniel Dunbar34a96c82009-12-03 09:13:13 +0000479 OS << " '" << BinaryOperator::getOpcodeStr(Node->getOpcode()) << "'";
Chris Lattner86928112007-08-25 02:00:02 +0000480}
481void StmtDumper::VisitCompoundAssignOperator(CompoundAssignOperator *Node) {
482 DumpExpr(Node);
Daniel Dunbar34a96c82009-12-03 09:13:13 +0000483 OS << " '" << BinaryOperator::getOpcodeStr(Node->getOpcode())
484 << "' ComputeLHSTy=";
Eli Friedman8b7b1b12009-03-28 01:22:36 +0000485 DumpType(Node->getComputationLHSType());
Daniel Dunbar34a96c82009-12-03 09:13:13 +0000486 OS << " ComputeResultTy=";
Eli Friedman8b7b1b12009-03-28 01:22:36 +0000487 DumpType(Node->getComputationResultType());
Chris Lattnercbe4f772007-08-08 22:51:59 +0000488}
Chris Lattnercbe4f772007-08-08 22:51:59 +0000489
John McCall351762c2011-02-07 10:33:21 +0000490void StmtDumper::VisitBlockExpr(BlockExpr *Node) {
491 DumpExpr(Node);
492
493 IndentLevel++;
494 BlockDecl *block = Node->getBlockDecl();
495 if (block->capturesCXXThis()) {
496 OS << '\n'; Indent(); OS << "(capture this)";
497 }
498 for (BlockDecl::capture_iterator
499 i = block->capture_begin(), e = block->capture_end(); i != e; ++i) {
500 OS << '\n';
501 Indent();
502 OS << "(capture ";
503 if (i->isByRef()) OS << "byref ";
504 if (i->isNested()) OS << "nested ";
505 DumpDeclRef(i->getVariable());
506 if (i->hasCopyExpr()) DumpSubTree(i->getCopyExpr());
507 OS << ")";
508 }
509 IndentLevel--;
510
511 DumpSubTree(block->getBody());
512}
513
Chris Lattnercbe4f772007-08-08 22:51:59 +0000514// GNU extensions.
515
516void StmtDumper::VisitAddrLabelExpr(AddrLabelExpr *Node) {
Chris Lattnerdb3b3ff2007-08-09 17:35:30 +0000517 DumpExpr(Node);
Daniel Dunbar34a96c82009-12-03 09:13:13 +0000518 OS << " " << Node->getLabel()->getName()
519 << " " << (void*)Node->getLabel();
Chris Lattnercbe4f772007-08-08 22:51:59 +0000520}
521
Chris Lattner8f184b12007-08-09 18:03:18 +0000522//===----------------------------------------------------------------------===//
523// C++ Expressions
524//===----------------------------------------------------------------------===//
Chris Lattnercbe4f772007-08-08 22:51:59 +0000525
Douglas Gregore200adc2008-10-27 19:41:14 +0000526void StmtDumper::VisitCXXNamedCastExpr(CXXNamedCastExpr *Node) {
Chris Lattnerdb3b3ff2007-08-09 17:35:30 +0000527 DumpExpr(Node);
Daniel Dunbar34a96c82009-12-03 09:13:13 +0000528 OS << " " << Node->getCastName()
529 << "<" << Node->getTypeAsWritten().getAsString() << ">"
Anders Carlssona70cff62010-04-24 19:06:50 +0000530 << " <" << Node->getCastKindName();
531 DumpBasePath(OS, Node);
532 OS << ">";
Chris Lattnercbe4f772007-08-08 22:51:59 +0000533}
534
535void StmtDumper::VisitCXXBoolLiteralExpr(CXXBoolLiteralExpr *Node) {
Chris Lattnerdb3b3ff2007-08-09 17:35:30 +0000536 DumpExpr(Node);
Daniel Dunbar34a96c82009-12-03 09:13:13 +0000537 OS << " " << (Node->getValue() ? "true" : "false");
Chris Lattnercbe4f772007-08-08 22:51:59 +0000538}
539
Douglas Gregor8ea1f532008-11-04 14:56:14 +0000540void StmtDumper::VisitCXXThisExpr(CXXThisExpr *Node) {
541 DumpExpr(Node);
Daniel Dunbar34a96c82009-12-03 09:13:13 +0000542 OS << " this";
Douglas Gregor8ea1f532008-11-04 14:56:14 +0000543}
544
Douglas Gregore200adc2008-10-27 19:41:14 +0000545void StmtDumper::VisitCXXFunctionalCastExpr(CXXFunctionalCastExpr *Node) {
546 DumpExpr(Node);
Daniel Dunbar34a96c82009-12-03 09:13:13 +0000547 OS << " functional cast to " << Node->getTypeAsWritten().getAsString();
Douglas Gregore200adc2008-10-27 19:41:14 +0000548}
549
Anders Carlsson073846832009-08-12 00:21:52 +0000550void StmtDumper::VisitCXXConstructExpr(CXXConstructExpr *Node) {
551 DumpExpr(Node);
John McCalleba90cd2010-02-02 19:03:45 +0000552 CXXConstructorDecl *Ctor = Node->getConstructor();
553 DumpType(Ctor->getType());
Anders Carlsson073846832009-08-12 00:21:52 +0000554 if (Node->isElidable())
Daniel Dunbar34a96c82009-12-03 09:13:13 +0000555 OS << " elidable";
John McCall85370042010-08-07 06:38:55 +0000556 if (Node->requiresZeroInitialization())
557 OS << " zeroing";
Anders Carlsson073846832009-08-12 00:21:52 +0000558}
559
560void StmtDumper::VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *Node) {
561 DumpExpr(Node);
Daniel Dunbar34a96c82009-12-03 09:13:13 +0000562 OS << " ";
Anders Carlsson073846832009-08-12 00:21:52 +0000563 DumpCXXTemporary(Node->getTemporary());
564}
565
John McCall5d413782010-12-06 08:20:24 +0000566void StmtDumper::VisitExprWithCleanups(ExprWithCleanups *Node) {
Anders Carlsson073846832009-08-12 00:21:52 +0000567 DumpExpr(Node);
568 ++IndentLevel;
569 for (unsigned i = 0, e = Node->getNumTemporaries(); i != e; ++i) {
Daniel Dunbar34a96c82009-12-03 09:13:13 +0000570 OS << "\n";
Anders Carlsson073846832009-08-12 00:21:52 +0000571 Indent();
572 DumpCXXTemporary(Node->getTemporary(i));
573 }
574 --IndentLevel;
575}
576
577void StmtDumper::DumpCXXTemporary(CXXTemporary *Temporary) {
Daniel Dunbar34a96c82009-12-03 09:13:13 +0000578 OS << "(CXXTemporary " << (void *)Temporary << ")";
Anders Carlsson073846832009-08-12 00:21:52 +0000579}
580
Anders Carlsson76f4a902007-08-21 17:43:55 +0000581//===----------------------------------------------------------------------===//
582// Obj-C Expressions
583//===----------------------------------------------------------------------===//
584
Ted Kremenek36748da2008-02-29 22:04:05 +0000585void StmtDumper::VisitObjCMessageExpr(ObjCMessageExpr* Node) {
586 DumpExpr(Node);
Daniel Dunbar34a96c82009-12-03 09:13:13 +0000587 OS << " selector=" << Node->getSelector().getAsString();
Douglas Gregor9a129192010-04-21 00:45:42 +0000588 switch (Node->getReceiverKind()) {
589 case ObjCMessageExpr::Instance:
590 break;
591
592 case ObjCMessageExpr::Class:
593 OS << " class=";
594 DumpType(Node->getClassReceiver());
595 break;
596
597 case ObjCMessageExpr::SuperInstance:
598 OS << " super (instance)";
599 break;
600
601 case ObjCMessageExpr::SuperClass:
602 OS << " super (class)";
603 break;
604 }
Ted Kremenek36748da2008-02-29 22:04:05 +0000605}
606
Douglas Gregor96c79492010-04-23 22:50:49 +0000607void StmtDumper::VisitObjCAtCatchStmt(ObjCAtCatchStmt *Node) {
608 DumpStmt(Node);
Douglas Gregor46a572b2010-04-26 16:46:50 +0000609 if (VarDecl *CatchParam = Node->getCatchParamDecl()) {
Douglas Gregor96c79492010-04-23 22:50:49 +0000610 OS << " catch parm = ";
611 DumpDeclarator(CatchParam);
612 } else {
613 OS << " catch all";
614 }
615}
616
Anders Carlssonc5a81eb2007-08-22 15:14:15 +0000617void StmtDumper::VisitObjCEncodeExpr(ObjCEncodeExpr *Node) {
618 DumpExpr(Node);
Daniel Dunbar34a96c82009-12-03 09:13:13 +0000619 OS << " ";
Anders Carlssonc5a81eb2007-08-22 15:14:15 +0000620 DumpType(Node->getEncodedType());
Anders Carlssonc5a81eb2007-08-22 15:14:15 +0000621}
622
Fariborz Jahanian4bef4622007-10-16 20:40:23 +0000623void StmtDumper::VisitObjCSelectorExpr(ObjCSelectorExpr *Node) {
624 DumpExpr(Node);
Mike Stump11289f42009-09-09 15:08:12 +0000625
Daniel Dunbar34a96c82009-12-03 09:13:13 +0000626 OS << " " << Node->getSelector().getAsString();
Fariborz Jahanian4bef4622007-10-16 20:40:23 +0000627}
628
Fariborz Jahaniana32aaef2007-10-17 16:58:11 +0000629void StmtDumper::VisitObjCProtocolExpr(ObjCProtocolExpr *Node) {
630 DumpExpr(Node);
Mike Stump11289f42009-09-09 15:08:12 +0000631
Benjamin Kramerb11416d2010-04-17 09:33:03 +0000632 OS << ' ' << Node->getProtocol();
Fariborz Jahaniana32aaef2007-10-17 16:58:11 +0000633}
Daniel Dunbar4b8c6db2008-08-30 05:35:15 +0000634
635void StmtDumper::VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *Node) {
636 DumpExpr(Node);
John McCallb7bd14f2010-12-02 01:19:52 +0000637 if (Node->isImplicitProperty()) {
Fariborz Jahanian0f0b3022010-12-22 19:46:35 +0000638 OS << " Kind=MethodRef Getter=\"";
639 if (Node->getImplicitPropertyGetter())
640 OS << Node->getImplicitPropertyGetter()->getSelector().getAsString();
641 else
642 OS << "(null)";
643
644 OS << "\" Setter=\"";
John McCallb7bd14f2010-12-02 01:19:52 +0000645 if (ObjCMethodDecl *Setter = Node->getImplicitPropertySetter())
646 OS << Setter->getSelector().getAsString();
647 else
648 OS << "(null)";
649 OS << "\"";
650 } else {
651 OS << " Kind=PropertyRef Property=\"" << Node->getExplicitProperty() << '"';
652 }
Fariborz Jahanian8a1810f2008-11-22 18:39:36 +0000653
Fariborz Jahanian681c0752010-10-14 16:04:05 +0000654 if (Node->isSuperReceiver())
655 OS << " super";
Douglas Gregor8ea1f532008-11-04 14:56:14 +0000656}
657
Chris Lattnercbe4f772007-08-08 22:51:59 +0000658//===----------------------------------------------------------------------===//
659// Stmt method implementations
660//===----------------------------------------------------------------------===//
661
662/// dump - This does a local dump of the specified AST fragment. It dumps the
663/// specified node and a few nodes underneath it, but not the whole subtree.
664/// This is useful in a debugger.
Chris Lattner11e30d32007-08-30 06:17:34 +0000665void Stmt::dump(SourceManager &SM) const {
Argyrios Kyrtzidisc049f752010-08-09 10:54:31 +0000666 dump(llvm::errs(), SM);
667}
668
669void Stmt::dump(llvm::raw_ostream &OS, SourceManager &SM) const {
670 StmtDumper P(&SM, OS, 4);
Chris Lattnercfb83dd2007-08-30 00:53:54 +0000671 P.DumpSubTree(const_cast<Stmt*>(this));
Argyrios Kyrtzidisc049f752010-08-09 10:54:31 +0000672 OS << "\n";
Chris Lattner779d5d92007-08-30 00:40:08 +0000673}
674
675/// dump - This does a local dump of the specified AST fragment. It dumps the
676/// specified node and a few nodes underneath it, but not the whole subtree.
677/// This is useful in a debugger.
Chris Lattnercbe4f772007-08-08 22:51:59 +0000678void Stmt::dump() const {
Argyrios Kyrtzidisc049f752010-08-09 10:54:31 +0000679 StmtDumper P(0, llvm::errs(), 4);
Chris Lattnercfb83dd2007-08-30 00:53:54 +0000680 P.DumpSubTree(const_cast<Stmt*>(this));
Argyrios Kyrtzidisc049f752010-08-09 10:54:31 +0000681 llvm::errs() << "\n";
Chris Lattner779d5d92007-08-30 00:40:08 +0000682}
683
684/// dumpAll - This does a dump of the specified AST fragment and all subtrees.
Chris Lattner11e30d32007-08-30 06:17:34 +0000685void Stmt::dumpAll(SourceManager &SM) const {
Argyrios Kyrtzidisc049f752010-08-09 10:54:31 +0000686 StmtDumper P(&SM, llvm::errs(), ~0U);
Chris Lattnercfb83dd2007-08-30 00:53:54 +0000687 P.DumpSubTree(const_cast<Stmt*>(this));
Argyrios Kyrtzidisc049f752010-08-09 10:54:31 +0000688 llvm::errs() << "\n";
Chris Lattnercbe4f772007-08-08 22:51:59 +0000689}
690
691/// dumpAll - This does a dump of the specified AST fragment and all subtrees.
692void Stmt::dumpAll() const {
Argyrios Kyrtzidisc049f752010-08-09 10:54:31 +0000693 StmtDumper P(0, llvm::errs(), ~0U);
Chris Lattnercfb83dd2007-08-30 00:53:54 +0000694 P.DumpSubTree(const_cast<Stmt*>(this));
Argyrios Kyrtzidisc049f752010-08-09 10:54:31 +0000695 llvm::errs() << "\n";
Chris Lattnercbe4f772007-08-08 22:51:59 +0000696}