blob: 682a9b1ee48e141eeb20a120be7d996d3eed1fb5 [file] [log] [blame]
Reid Spencer5f016e22007-07-11 17:01:13 +00001//===--- Stmt.cpp - Statement AST Node Implementation ---------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
Chris Lattner0bc735f2007-12-29 19:59:25 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Reid Spencer5f016e22007-07-11 17:01:13 +00007//
8//===----------------------------------------------------------------------===//
9//
10// This file implements the Stmt class and statement subclasses.
11//
12//===----------------------------------------------------------------------===//
13
14#include "clang/AST/Stmt.h"
15#include "clang/AST/ExprCXX.h"
Steve Narofff494b572008-05-29 21:12:08 +000016#include "clang/AST/ExprObjC.h"
Sebastian Redl4b07b292008-12-22 19:15:10 +000017#include "clang/AST/Type.h"
Ted Kremenek11e5a7f2009-02-06 01:42:09 +000018#include "clang/AST/ASTContext.h"
Reid Spencer5f016e22007-07-11 17:01:13 +000019using namespace clang;
20
Reid Spencer5f016e22007-07-11 17:01:13 +000021static struct StmtClassNameTable {
Chris Lattner63381352007-08-25 01:42:24 +000022 const char *Name;
23 unsigned Counter;
24 unsigned Size;
Chris Lattner1f683e92007-08-25 01:55:00 +000025} StmtClassInfo[Stmt::lastExprConstant+1];
Chris Lattner63381352007-08-25 01:42:24 +000026
27static StmtClassNameTable &getStmtInfoTableEntry(Stmt::StmtClass E) {
28 static bool Initialized = false;
29 if (Initialized)
30 return StmtClassInfo[E];
31
32 // Intialize the table on the first use.
33 Initialized = true;
Douglas Gregorf2cad862008-11-14 12:46:07 +000034#define STMT(CLASS, PARENT) \
35 StmtClassInfo[(unsigned)Stmt::CLASS##Class].Name = #CLASS; \
36 StmtClassInfo[(unsigned)Stmt::CLASS##Class].Size = sizeof(CLASS);
Reid Spencer5f016e22007-07-11 17:01:13 +000037#include "clang/AST/StmtNodes.def"
Nico Weber608b17f2008-08-05 23:15:29 +000038
Chris Lattner63381352007-08-25 01:42:24 +000039 return StmtClassInfo[E];
40}
41
Reid Spencer5f016e22007-07-11 17:01:13 +000042const char *Stmt::getStmtClassName() const {
Chris Lattner63381352007-08-25 01:42:24 +000043 return getStmtInfoTableEntry(sClass).Name;
Reid Spencer5f016e22007-07-11 17:01:13 +000044}
45
Chris Lattner24e1e702009-03-04 04:23:07 +000046void Stmt::DestroyChildren(ASTContext &C) {
47 for (child_iterator I = child_begin(), E = child_end(); I !=E; )
Douglas Gregor860f6d42009-01-16 06:50:08 +000048 if (Stmt* Child = *I++) Child->Destroy(C);
Ted Kremenek27f8a282008-05-20 00:43:19 +000049}
50
Chris Lattner24e1e702009-03-04 04:23:07 +000051void Stmt::Destroy(ASTContext &C) {
Ted Kremenek27f8a282008-05-20 00:43:19 +000052 DestroyChildren(C);
Ted Kremenekf809e3b2008-05-20 04:10:52 +000053 // FIXME: Eventually all Stmts should be allocated with the allocator
54 // in ASTContext, just like with Decls.
Ted Kremenek11e5a7f2009-02-06 01:42:09 +000055 this->~Stmt();
56 C.Deallocate((void *)this);
Ted Kremenek9c1863e2008-05-19 22:02:12 +000057}
58
Chris Lattner24e1e702009-03-04 04:23:07 +000059void DeclStmt::Destroy(ASTContext &C) {
Ted Kremenek11e5a7f2009-02-06 01:42:09 +000060 this->~DeclStmt();
61 C.Deallocate((void *)this);
Ted Kremenek8e355f22008-05-21 15:53:55 +000062}
63
Reid Spencer5f016e22007-07-11 17:01:13 +000064void Stmt::PrintStats() {
Chris Lattner63381352007-08-25 01:42:24 +000065 // Ensure the table is primed.
66 getStmtInfoTableEntry(Stmt::NullStmtClass);
Nico Weber608b17f2008-08-05 23:15:29 +000067
Reid Spencer5f016e22007-07-11 17:01:13 +000068 unsigned sum = 0;
69 fprintf(stderr, "*** Stmt/Expr Stats:\n");
Chris Lattner1f683e92007-08-25 01:55:00 +000070 for (int i = 0; i != Stmt::lastExprConstant+1; i++) {
Chris Lattner63381352007-08-25 01:42:24 +000071 if (StmtClassInfo[i].Name == 0) continue;
72 sum += StmtClassInfo[i].Counter;
Reid Spencer5f016e22007-07-11 17:01:13 +000073 }
74 fprintf(stderr, " %d stmts/exprs total.\n", sum);
75 sum = 0;
Chris Lattner1f683e92007-08-25 01:55:00 +000076 for (int i = 0; i != Stmt::lastExprConstant+1; i++) {
Chris Lattner63381352007-08-25 01:42:24 +000077 if (StmtClassInfo[i].Name == 0) continue;
Nico Weber608b17f2008-08-05 23:15:29 +000078 fprintf(stderr, " %d %s, %d each (%d bytes)\n",
Chris Lattner63381352007-08-25 01:42:24 +000079 StmtClassInfo[i].Counter, StmtClassInfo[i].Name,
80 StmtClassInfo[i].Size,
81 StmtClassInfo[i].Counter*StmtClassInfo[i].Size);
82 sum += StmtClassInfo[i].Counter*StmtClassInfo[i].Size;
Reid Spencer5f016e22007-07-11 17:01:13 +000083 }
84 fprintf(stderr, "Total bytes = %d\n", sum);
85}
86
87void Stmt::addStmtClass(StmtClass s) {
Chris Lattner63381352007-08-25 01:42:24 +000088 ++getStmtInfoTableEntry(s).Counter;
Reid Spencer5f016e22007-07-11 17:01:13 +000089}
90
91static bool StatSwitch = false;
92
93bool Stmt::CollectingStats(bool enable) {
94 if (enable) StatSwitch = true;
Chris Lattner63381352007-08-25 01:42:24 +000095 return StatSwitch;
Reid Spencer5f016e22007-07-11 17:01:13 +000096}
97
98
Reid Spencer5f016e22007-07-11 17:01:13 +000099const char *LabelStmt::getName() const {
100 return getID()->getName();
101}
102
Steve Naroff507f2d52007-08-31 23:49:30 +0000103// This is defined here to avoid polluting Stmt.h with importing Expr.h
Nico Weber608b17f2008-08-05 23:15:29 +0000104SourceRange ReturnStmt::getSourceRange() const {
Steve Naroff507f2d52007-08-31 23:49:30 +0000105 if (RetExpr)
106 return SourceRange(RetLoc, RetExpr->getLocEnd());
107 else
108 return SourceRange(RetLoc);
109}
110
Ted Kremenekd48ade62007-10-01 16:34:52 +0000111bool Stmt::hasImplicitControlFlow() const {
112 switch (sClass) {
113 default:
114 return false;
Nico Weber608b17f2008-08-05 23:15:29 +0000115
Ted Kremenekd48ade62007-10-01 16:34:52 +0000116 case CallExprClass:
117 case ConditionalOperatorClass:
118 case ChooseExprClass:
119 case StmtExprClass:
120 case DeclStmtClass:
Nico Weber608b17f2008-08-05 23:15:29 +0000121 return true;
122
Ted Kremenekd48ade62007-10-01 16:34:52 +0000123 case Stmt::BinaryOperatorClass: {
124 const BinaryOperator* B = cast<BinaryOperator>(this);
125 if (B->isLogicalOp() || B->getOpcode() == BinaryOperator::Comma)
126 return true;
127 else
128 return false;
129 }
130 }
131}
132
Chris Lattnerb3277932009-03-10 04:59:06 +0000133Expr *AsmStmt::getOutputExpr(unsigned i) {
Ted Kremenekce2fc3a2008-10-27 18:40:21 +0000134 return cast<Expr>(Exprs[i]);
135}
Chris Lattnerb3277932009-03-10 04:59:06 +0000136
137/// getOutputConstraint - Return the constraint string for the specified
138/// output operand. All output constraints are known to be non-empty (either
139/// '=' or '+').
140std::string AsmStmt::getOutputConstraint(unsigned i) const {
141 return std::string(Constraints[i]->getStrData(),
142 Constraints[i]->getByteLength());
Ted Kremenekce2fc3a2008-10-27 18:40:21 +0000143}
Chris Lattnerb3277932009-03-10 04:59:06 +0000144
145
146Expr *AsmStmt::getInputExpr(unsigned i) {
Ted Kremenekce2fc3a2008-10-27 18:40:21 +0000147 return cast<Expr>(Exprs[i + NumOutputs]);
148}
Chris Lattnerb3277932009-03-10 04:59:06 +0000149
150/// getInputConstraint - Return the specified input constraint. Unlike output
151/// constraints, these can be empty.
152std::string AsmStmt::getInputConstraint(unsigned i) const {
153 return std::string(Constraints[i + NumOutputs]->getStrData(),
154 Constraints[i + NumOutputs]->getByteLength());
Ted Kremenekce2fc3a2008-10-27 18:40:21 +0000155}
156
Chris Lattnerdb6ed172008-01-30 05:01:46 +0000157//===----------------------------------------------------------------------===//
158// Constructors
159//===----------------------------------------------------------------------===//
160
Anders Carlssondfab34a2008-02-05 23:03:50 +0000161AsmStmt::AsmStmt(SourceLocation asmloc, bool issimple, bool isvolatile,
Chris Lattnerdb6ed172008-01-30 05:01:46 +0000162 unsigned numoutputs, unsigned numinputs,
163 std::string *names, StringLiteral **constraints,
164 Expr **exprs, StringLiteral *asmstr, unsigned numclobbers,
165 StringLiteral **clobbers, SourceLocation rparenloc)
Anders Carlssonb235fc22007-11-22 01:36:19 +0000166 : Stmt(AsmStmtClass), AsmLoc(asmloc), RParenLoc(rparenloc), AsmStr(asmstr)
Anders Carlssondfab34a2008-02-05 23:03:50 +0000167 , IsSimple(issimple), IsVolatile(isvolatile)
168 , NumOutputs(numoutputs), NumInputs(numinputs) {
Anders Carlssonb235fc22007-11-22 01:36:19 +0000169 for (unsigned i = 0, e = numinputs + numoutputs; i != e; i++) {
170 Names.push_back(names[i]);
171 Exprs.push_back(exprs[i]);
Nico Weber608b17f2008-08-05 23:15:29 +0000172 Constraints.push_back(constraints[i]);
Anders Carlssonb235fc22007-11-22 01:36:19 +0000173 }
Nico Weber608b17f2008-08-05 23:15:29 +0000174
Anders Carlssonb235fc22007-11-22 01:36:19 +0000175 for (unsigned i = 0; i != numclobbers; i++)
176 Clobbers.push_back(clobbers[i]);
177}
178
Chris Lattnerdb6ed172008-01-30 05:01:46 +0000179ObjCForCollectionStmt::ObjCForCollectionStmt(Stmt *Elem, Expr *Collect,
180 Stmt *Body, SourceLocation FCL,
Nico Weber608b17f2008-08-05 23:15:29 +0000181 SourceLocation RPL)
Chris Lattnerdb6ed172008-01-30 05:01:46 +0000182: Stmt(ObjCForCollectionStmtClass) {
183 SubExprs[ELEM] = Elem;
184 SubExprs[COLLECTION] = reinterpret_cast<Stmt*>(Collect);
185 SubExprs[BODY] = Body;
186 ForLoc = FCL;
187 RParenLoc = RPL;
188}
189
190
Nico Weber608b17f2008-08-05 23:15:29 +0000191ObjCAtCatchStmt::ObjCAtCatchStmt(SourceLocation atCatchLoc,
192 SourceLocation rparenloc,
Steve Naroff7ba138a2009-03-03 19:52:17 +0000193 ParmVarDecl *catchVarDecl, Stmt *atCatchStmt,
Chris Lattnerdb6ed172008-01-30 05:01:46 +0000194 Stmt *atCatchList)
195: Stmt(ObjCAtCatchStmtClass) {
Steve Naroff7ba138a2009-03-03 19:52:17 +0000196 ExceptionDecl = catchVarDecl;
Chris Lattnerdb6ed172008-01-30 05:01:46 +0000197 SubExprs[BODY] = atCatchStmt;
Eli Friedman0613c372008-05-25 04:34:57 +0000198 SubExprs[NEXT_CATCH] = NULL;
Daniel Dunbar93b2bdb2009-03-01 04:28:32 +0000199 // FIXME: O(N^2) in number of catch blocks.
Eli Friedman0613c372008-05-25 04:34:57 +0000200 if (atCatchList) {
Ted Kremenekff981022008-02-01 21:28:59 +0000201 ObjCAtCatchStmt *AtCatchList = static_cast<ObjCAtCatchStmt*>(atCatchList);
202
Nico Weber608b17f2008-08-05 23:15:29 +0000203 while (ObjCAtCatchStmt* NextCatch = AtCatchList->getNextCatchStmt())
Ted Kremenekff981022008-02-01 21:28:59 +0000204 AtCatchList = NextCatch;
Nico Weber608b17f2008-08-05 23:15:29 +0000205
Ted Kremenekff981022008-02-01 21:28:59 +0000206 AtCatchList->SubExprs[NEXT_CATCH] = this;
Chris Lattnerdb6ed172008-01-30 05:01:46 +0000207 }
208 AtCatchLoc = atCatchLoc;
209 RParenLoc = rparenloc;
210}
211
212
Ted Kremenek82977772007-08-24 21:09:09 +0000213//===----------------------------------------------------------------------===//
214// Child Iterators for iterating over subexpressions/substatements
215//===----------------------------------------------------------------------===//
216
217// DeclStmt
Ted Kremenek8ffb1592008-10-07 23:09:49 +0000218Stmt::child_iterator DeclStmt::child_begin() {
219 return StmtIterator(DG.begin(), DG.end());
Ted Kremenek14f8b4f2008-08-05 20:46:55 +0000220}
221
Ted Kremenek8ffb1592008-10-07 23:09:49 +0000222Stmt::child_iterator DeclStmt::child_end() {
223 return StmtIterator(DG.end(), DG.end());
Ted Kremenek65aa3b92008-10-06 20:54:44 +0000224}
225
Ted Kremenek82977772007-08-24 21:09:09 +0000226// NullStmt
Ted Kremenek9ac59282007-10-18 23:28:49 +0000227Stmt::child_iterator NullStmt::child_begin() { return child_iterator(); }
228Stmt::child_iterator NullStmt::child_end() { return child_iterator(); }
Ted Kremenek82977772007-08-24 21:09:09 +0000229
230// CompoundStmt
231Stmt::child_iterator CompoundStmt::child_begin() { return &Body[0]; }
Ted Kremenek8189cde2009-02-07 01:47:29 +0000232Stmt::child_iterator CompoundStmt::child_end() { return &Body[0]+NumStmts; }
Ted Kremenek82977772007-08-24 21:09:09 +0000233
Ted Kremenekd97bb6c2007-08-30 16:50:46 +0000234// CaseStmt
235Stmt::child_iterator CaseStmt::child_begin() { return &SubExprs[0]; }
236Stmt::child_iterator CaseStmt::child_end() { return &SubExprs[END_EXPR]; }
237
238// DefaultStmt
239Stmt::child_iterator DefaultStmt::child_begin() { return &SubStmt; }
240Stmt::child_iterator DefaultStmt::child_end() { return &SubStmt+1; }
Ted Kremenek82977772007-08-24 21:09:09 +0000241
242// LabelStmt
243Stmt::child_iterator LabelStmt::child_begin() { return &SubStmt; }
Chris Lattnerb3938792007-08-30 00:53:54 +0000244Stmt::child_iterator LabelStmt::child_end() { return &SubStmt+1; }
Ted Kremenek82977772007-08-24 21:09:09 +0000245
246// IfStmt
247Stmt::child_iterator IfStmt::child_begin() { return &SubExprs[0]; }
248Stmt::child_iterator IfStmt::child_end() { return &SubExprs[0]+END_EXPR; }
249
250// SwitchStmt
251Stmt::child_iterator SwitchStmt::child_begin() { return &SubExprs[0]; }
252Stmt::child_iterator SwitchStmt::child_end() { return &SubExprs[0]+END_EXPR; }
253
254// WhileStmt
255Stmt::child_iterator WhileStmt::child_begin() { return &SubExprs[0]; }
256Stmt::child_iterator WhileStmt::child_end() { return &SubExprs[0]+END_EXPR; }
257
258// DoStmt
259Stmt::child_iterator DoStmt::child_begin() { return &SubExprs[0]; }
260Stmt::child_iterator DoStmt::child_end() { return &SubExprs[0]+END_EXPR; }
261
262// ForStmt
263Stmt::child_iterator ForStmt::child_begin() { return &SubExprs[0]; }
264Stmt::child_iterator ForStmt::child_end() { return &SubExprs[0]+END_EXPR; }
265
Ted Kremeneka526c5c2008-01-07 19:49:32 +0000266// ObjCForCollectionStmt
Nico Weber608b17f2008-08-05 23:15:29 +0000267Stmt::child_iterator ObjCForCollectionStmt::child_begin() {
268 return &SubExprs[0];
Fariborz Jahanian0196cab2008-01-02 22:54:34 +0000269}
Nico Weber608b17f2008-08-05 23:15:29 +0000270Stmt::child_iterator ObjCForCollectionStmt::child_end() {
271 return &SubExprs[0]+END_EXPR;
Fariborz Jahanian0196cab2008-01-02 22:54:34 +0000272}
273
Ted Kremenek82977772007-08-24 21:09:09 +0000274// GotoStmt
Ted Kremenek9ac59282007-10-18 23:28:49 +0000275Stmt::child_iterator GotoStmt::child_begin() { return child_iterator(); }
276Stmt::child_iterator GotoStmt::child_end() { return child_iterator(); }
Ted Kremenek82977772007-08-24 21:09:09 +0000277
278// IndirectGotoStmt
Ted Kremenek1060aff2008-06-17 03:11:08 +0000279Expr* IndirectGotoStmt::getTarget() { return cast<Expr>(Target); }
280const Expr* IndirectGotoStmt::getTarget() const { return cast<Expr>(Target); }
Ted Kremenek82977772007-08-24 21:09:09 +0000281
Ted Kremenek1060aff2008-06-17 03:11:08 +0000282Stmt::child_iterator IndirectGotoStmt::child_begin() { return &Target; }
283Stmt::child_iterator IndirectGotoStmt::child_end() { return &Target+1; }
Ted Kremenek82977772007-08-24 21:09:09 +0000284
285// ContinueStmt
Ted Kremenek9ac59282007-10-18 23:28:49 +0000286Stmt::child_iterator ContinueStmt::child_begin() { return child_iterator(); }
287Stmt::child_iterator ContinueStmt::child_end() { return child_iterator(); }
Ted Kremenek82977772007-08-24 21:09:09 +0000288
289// BreakStmt
Ted Kremenek9ac59282007-10-18 23:28:49 +0000290Stmt::child_iterator BreakStmt::child_begin() { return child_iterator(); }
291Stmt::child_iterator BreakStmt::child_end() { return child_iterator(); }
Ted Kremenek82977772007-08-24 21:09:09 +0000292
293// ReturnStmt
Ted Kremenek1060aff2008-06-17 03:11:08 +0000294const Expr* ReturnStmt::getRetValue() const {
295 return cast_or_null<Expr>(RetExpr);
296}
297Expr* ReturnStmt::getRetValue() {
298 return cast_or_null<Expr>(RetExpr);
Ted Kremenek82977772007-08-24 21:09:09 +0000299}
300
Ted Kremenek1060aff2008-06-17 03:11:08 +0000301Stmt::child_iterator ReturnStmt::child_begin() {
302 return &RetExpr;
303}
304Stmt::child_iterator ReturnStmt::child_end() {
305 return RetExpr ? &RetExpr+1 : &RetExpr;
Ted Kremenek2298f912007-08-27 20:58:16 +0000306}
Ted Kremenek82977772007-08-24 21:09:09 +0000307
Chris Lattnerfe795952007-10-29 04:04:16 +0000308// AsmStmt
Ted Kremenekce2fc3a2008-10-27 18:40:21 +0000309Stmt::child_iterator AsmStmt::child_begin() {
310 return Exprs.empty() ? 0 : &Exprs[0];
311}
312Stmt::child_iterator AsmStmt::child_end() {
313 return Exprs.empty() ? 0 : &Exprs[0] + Exprs.size();
314}
Chris Lattnerfe795952007-10-29 04:04:16 +0000315
Ted Kremeneka526c5c2008-01-07 19:49:32 +0000316// ObjCAtCatchStmt
317Stmt::child_iterator ObjCAtCatchStmt::child_begin() { return &SubExprs[0]; }
Nico Weber608b17f2008-08-05 23:15:29 +0000318Stmt::child_iterator ObjCAtCatchStmt::child_end() {
319 return &SubExprs[0]+END_EXPR;
Fariborz Jahanian3b1191d2007-11-01 23:59:59 +0000320}
Fariborz Jahanianb210bd02007-11-01 21:12:44 +0000321
Ted Kremeneka526c5c2008-01-07 19:49:32 +0000322// ObjCAtFinallyStmt
323Stmt::child_iterator ObjCAtFinallyStmt::child_begin() { return &AtFinallyStmt; }
324Stmt::child_iterator ObjCAtFinallyStmt::child_end() { return &AtFinallyStmt+1; }
Fariborz Jahanianb210bd02007-11-01 21:12:44 +0000325
Ted Kremeneka526c5c2008-01-07 19:49:32 +0000326// ObjCAtTryStmt
327Stmt::child_iterator ObjCAtTryStmt::child_begin() { return &SubStmts[0]; }
Nico Weber608b17f2008-08-05 23:15:29 +0000328Stmt::child_iterator ObjCAtTryStmt::child_end() {
329 return &SubStmts[0]+END_EXPR;
Fariborz Jahanian3b1191d2007-11-01 23:59:59 +0000330}
Fariborz Jahanianb210bd02007-11-01 21:12:44 +0000331
Ted Kremeneka526c5c2008-01-07 19:49:32 +0000332// ObjCAtThrowStmt
333Stmt::child_iterator ObjCAtThrowStmt::child_begin() {
Fariborz Jahanian39f8f152007-11-07 02:00:49 +0000334 return &Throw;
335}
336
Ted Kremeneka526c5c2008-01-07 19:49:32 +0000337Stmt::child_iterator ObjCAtThrowStmt::child_end() {
Fariborz Jahanian39f8f152007-11-07 02:00:49 +0000338 return &Throw+1;
339}
Fariborz Jahanianfa3ee8e2008-01-29 19:14:59 +0000340
341// ObjCAtSynchronizedStmt
342Stmt::child_iterator ObjCAtSynchronizedStmt::child_begin() {
Fariborz Jahaniana0f55792008-01-29 22:59:37 +0000343 return &SubStmts[0];
Fariborz Jahanianfa3ee8e2008-01-29 19:14:59 +0000344}
345
346Stmt::child_iterator ObjCAtSynchronizedStmt::child_end() {
Fariborz Jahaniana0f55792008-01-29 22:59:37 +0000347 return &SubStmts[0]+END_EXPR;
Fariborz Jahanianfa3ee8e2008-01-29 19:14:59 +0000348}
349
Sebastian Redl4b07b292008-12-22 19:15:10 +0000350// CXXCatchStmt
351Stmt::child_iterator CXXCatchStmt::child_begin() {
352 return &HandlerBlock;
353}
354
355Stmt::child_iterator CXXCatchStmt::child_end() {
356 return &HandlerBlock + 1;
357}
358
359QualType CXXCatchStmt::getCaughtType() {
360 if (ExceptionDecl)
361 return llvm::cast<VarDecl>(ExceptionDecl)->getType();
362 return QualType();
363}
364
365void CXXCatchStmt::Destroy(ASTContext& C) {
Sebastian Redl8351da02008-12-22 21:35:02 +0000366 if (ExceptionDecl)
367 ExceptionDecl->Destroy(C);
Sebastian Redl4b07b292008-12-22 19:15:10 +0000368 Stmt::Destroy(C);
369}
Sebastian Redl8351da02008-12-22 21:35:02 +0000370
371// CXXTryStmt
372Stmt::child_iterator CXXTryStmt::child_begin() { return &Stmts[0]; }
373Stmt::child_iterator CXXTryStmt::child_end() { return &Stmts[0]+Stmts.size(); }
374
375CXXTryStmt::CXXTryStmt(SourceLocation tryLoc, Stmt *tryBlock,
376 Stmt **handlers, unsigned numHandlers)
377 : Stmt(CXXTryStmtClass), TryLoc(tryLoc) {
378 Stmts.push_back(tryBlock);
379 Stmts.insert(Stmts.end(), handlers, handlers + numHandlers);
380}