Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 1 | //===--- Stmt.cpp - Statement AST Node Implementation ---------------------===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
Chris Lattner | 0bc735f | 2007-12-29 19:59:25 +0000 | [diff] [blame] | 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 7 | // |
| 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 Naroff | f494b57 | 2008-05-29 21:12:08 +0000 | [diff] [blame] | 16 | #include "clang/AST/ExprObjC.h" |
Chris Lattner | 16f0049 | 2009-04-26 01:32:48 +0000 | [diff] [blame] | 17 | #include "clang/AST/StmtCXX.h" |
| 18 | #include "clang/AST/StmtObjC.h" |
Sebastian Redl | 4b07b29 | 2008-12-22 19:15:10 +0000 | [diff] [blame] | 19 | #include "clang/AST/Type.h" |
Ted Kremenek | 11e5a7f | 2009-02-06 01:42:09 +0000 | [diff] [blame] | 20 | #include "clang/AST/ASTContext.h" |
Chris Lattner | 3182db1 | 2009-03-10 23:51:40 +0000 | [diff] [blame] | 21 | #include "clang/AST/ASTDiagnostic.h" |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 22 | using namespace clang; |
| 23 | |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 24 | static struct StmtClassNameTable { |
Chris Lattner | 6338135 | 2007-08-25 01:42:24 +0000 | [diff] [blame] | 25 | const char *Name; |
| 26 | unsigned Counter; |
| 27 | unsigned Size; |
Chris Lattner | 1f683e9 | 2007-08-25 01:55:00 +0000 | [diff] [blame] | 28 | } StmtClassInfo[Stmt::lastExprConstant+1]; |
Chris Lattner | 6338135 | 2007-08-25 01:42:24 +0000 | [diff] [blame] | 29 | |
| 30 | static StmtClassNameTable &getStmtInfoTableEntry(Stmt::StmtClass E) { |
| 31 | static bool Initialized = false; |
| 32 | if (Initialized) |
| 33 | return StmtClassInfo[E]; |
| 34 | |
| 35 | // Intialize the table on the first use. |
| 36 | Initialized = true; |
Douglas Gregor | f2cad86 | 2008-11-14 12:46:07 +0000 | [diff] [blame] | 37 | #define STMT(CLASS, PARENT) \ |
| 38 | StmtClassInfo[(unsigned)Stmt::CLASS##Class].Name = #CLASS; \ |
| 39 | StmtClassInfo[(unsigned)Stmt::CLASS##Class].Size = sizeof(CLASS); |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 40 | #include "clang/AST/StmtNodes.def" |
Nico Weber | 608b17f | 2008-08-05 23:15:29 +0000 | [diff] [blame] | 41 | |
Chris Lattner | 6338135 | 2007-08-25 01:42:24 +0000 | [diff] [blame] | 42 | return StmtClassInfo[E]; |
| 43 | } |
| 44 | |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 45 | const char *Stmt::getStmtClassName() const { |
Chris Lattner | 6338135 | 2007-08-25 01:42:24 +0000 | [diff] [blame] | 46 | return getStmtInfoTableEntry(sClass).Name; |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 47 | } |
| 48 | |
Chris Lattner | 24e1e70 | 2009-03-04 04:23:07 +0000 | [diff] [blame] | 49 | void Stmt::DestroyChildren(ASTContext &C) { |
| 50 | for (child_iterator I = child_begin(), E = child_end(); I !=E; ) |
Douglas Gregor | 860f6d4 | 2009-01-16 06:50:08 +0000 | [diff] [blame] | 51 | if (Stmt* Child = *I++) Child->Destroy(C); |
Ted Kremenek | 27f8a28 | 2008-05-20 00:43:19 +0000 | [diff] [blame] | 52 | } |
| 53 | |
Douglas Gregor | 42602bb | 2009-08-07 06:08:38 +0000 | [diff] [blame^] | 54 | void Stmt::DoDestroy(ASTContext &C) { |
Ted Kremenek | 27f8a28 | 2008-05-20 00:43:19 +0000 | [diff] [blame] | 55 | DestroyChildren(C); |
Ted Kremenek | 11e5a7f | 2009-02-06 01:42:09 +0000 | [diff] [blame] | 56 | this->~Stmt(); |
| 57 | C.Deallocate((void *)this); |
Ted Kremenek | 9c1863e | 2008-05-19 22:02:12 +0000 | [diff] [blame] | 58 | } |
| 59 | |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 60 | void Stmt::PrintStats() { |
Chris Lattner | 6338135 | 2007-08-25 01:42:24 +0000 | [diff] [blame] | 61 | // Ensure the table is primed. |
| 62 | getStmtInfoTableEntry(Stmt::NullStmtClass); |
Nico Weber | 608b17f | 2008-08-05 23:15:29 +0000 | [diff] [blame] | 63 | |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 64 | unsigned sum = 0; |
| 65 | fprintf(stderr, "*** Stmt/Expr Stats:\n"); |
Chris Lattner | 1f683e9 | 2007-08-25 01:55:00 +0000 | [diff] [blame] | 66 | for (int i = 0; i != Stmt::lastExprConstant+1; i++) { |
Chris Lattner | 6338135 | 2007-08-25 01:42:24 +0000 | [diff] [blame] | 67 | if (StmtClassInfo[i].Name == 0) continue; |
| 68 | sum += StmtClassInfo[i].Counter; |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 69 | } |
| 70 | fprintf(stderr, " %d stmts/exprs total.\n", sum); |
| 71 | sum = 0; |
Chris Lattner | 1f683e9 | 2007-08-25 01:55:00 +0000 | [diff] [blame] | 72 | for (int i = 0; i != Stmt::lastExprConstant+1; i++) { |
Chris Lattner | 6338135 | 2007-08-25 01:42:24 +0000 | [diff] [blame] | 73 | if (StmtClassInfo[i].Name == 0) continue; |
Douglas Gregor | dbe833d | 2009-05-26 14:40:08 +0000 | [diff] [blame] | 74 | if (StmtClassInfo[i].Counter == 0) continue; |
Nico Weber | 608b17f | 2008-08-05 23:15:29 +0000 | [diff] [blame] | 75 | fprintf(stderr, " %d %s, %d each (%d bytes)\n", |
Chris Lattner | 6338135 | 2007-08-25 01:42:24 +0000 | [diff] [blame] | 76 | StmtClassInfo[i].Counter, StmtClassInfo[i].Name, |
| 77 | StmtClassInfo[i].Size, |
| 78 | StmtClassInfo[i].Counter*StmtClassInfo[i].Size); |
| 79 | sum += StmtClassInfo[i].Counter*StmtClassInfo[i].Size; |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 80 | } |
| 81 | fprintf(stderr, "Total bytes = %d\n", sum); |
| 82 | } |
| 83 | |
| 84 | void Stmt::addStmtClass(StmtClass s) { |
Chris Lattner | 6338135 | 2007-08-25 01:42:24 +0000 | [diff] [blame] | 85 | ++getStmtInfoTableEntry(s).Counter; |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 86 | } |
| 87 | |
| 88 | static bool StatSwitch = false; |
| 89 | |
| 90 | bool Stmt::CollectingStats(bool enable) { |
| 91 | if (enable) StatSwitch = true; |
Chris Lattner | 6338135 | 2007-08-25 01:42:24 +0000 | [diff] [blame] | 92 | return StatSwitch; |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 93 | } |
| 94 | |
Anders Carlsson | d19cd90 | 2009-05-15 00:21:21 +0000 | [diff] [blame] | 95 | NullStmt* NullStmt::Clone(ASTContext &C) const { |
| 96 | return new (C) NullStmt(SemiLoc); |
| 97 | } |
| 98 | |
Douglas Gregor | 861ce31 | 2009-05-15 22:32:39 +0000 | [diff] [blame] | 99 | ContinueStmt* ContinueStmt::Clone(ASTContext &C) const { |
| 100 | return new (C) ContinueStmt(ContinueLoc); |
| 101 | } |
| 102 | |
| 103 | BreakStmt* BreakStmt::Clone(ASTContext &C) const { |
| 104 | return new (C) BreakStmt(BreakLoc); |
| 105 | } |
| 106 | |
Douglas Gregor | 025452f | 2009-04-17 00:04:06 +0000 | [diff] [blame] | 107 | void CompoundStmt::setStmts(ASTContext &C, Stmt **Stmts, unsigned NumStmts) { |
| 108 | if (this->Body) |
| 109 | C.Deallocate(Body); |
| 110 | this->NumStmts = NumStmts; |
| 111 | |
| 112 | Body = new (C) Stmt*[NumStmts]; |
| 113 | memcpy(Body, Stmts, sizeof(Stmt *) * NumStmts); |
| 114 | } |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 115 | |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 116 | const char *LabelStmt::getName() const { |
| 117 | return getID()->getName(); |
| 118 | } |
| 119 | |
Steve Naroff | 507f2d5 | 2007-08-31 23:49:30 +0000 | [diff] [blame] | 120 | // This is defined here to avoid polluting Stmt.h with importing Expr.h |
Nico Weber | 608b17f | 2008-08-05 23:15:29 +0000 | [diff] [blame] | 121 | SourceRange ReturnStmt::getSourceRange() const { |
Steve Naroff | 507f2d5 | 2007-08-31 23:49:30 +0000 | [diff] [blame] | 122 | if (RetExpr) |
| 123 | return SourceRange(RetLoc, RetExpr->getLocEnd()); |
| 124 | else |
| 125 | return SourceRange(RetLoc); |
| 126 | } |
| 127 | |
Ted Kremenek | d48ade6 | 2007-10-01 16:34:52 +0000 | [diff] [blame] | 128 | bool Stmt::hasImplicitControlFlow() const { |
| 129 | switch (sClass) { |
| 130 | default: |
| 131 | return false; |
Nico Weber | 608b17f | 2008-08-05 23:15:29 +0000 | [diff] [blame] | 132 | |
Ted Kremenek | d48ade6 | 2007-10-01 16:34:52 +0000 | [diff] [blame] | 133 | case CallExprClass: |
| 134 | case ConditionalOperatorClass: |
| 135 | case ChooseExprClass: |
| 136 | case StmtExprClass: |
| 137 | case DeclStmtClass: |
Nico Weber | 608b17f | 2008-08-05 23:15:29 +0000 | [diff] [blame] | 138 | return true; |
| 139 | |
Ted Kremenek | d48ade6 | 2007-10-01 16:34:52 +0000 | [diff] [blame] | 140 | case Stmt::BinaryOperatorClass: { |
| 141 | const BinaryOperator* B = cast<BinaryOperator>(this); |
| 142 | if (B->isLogicalOp() || B->getOpcode() == BinaryOperator::Comma) |
| 143 | return true; |
| 144 | else |
| 145 | return false; |
| 146 | } |
| 147 | } |
| 148 | } |
| 149 | |
Chris Lattner | b327793 | 2009-03-10 04:59:06 +0000 | [diff] [blame] | 150 | Expr *AsmStmt::getOutputExpr(unsigned i) { |
Ted Kremenek | ce2fc3a | 2008-10-27 18:40:21 +0000 | [diff] [blame] | 151 | return cast<Expr>(Exprs[i]); |
| 152 | } |
Chris Lattner | b327793 | 2009-03-10 04:59:06 +0000 | [diff] [blame] | 153 | |
| 154 | /// getOutputConstraint - Return the constraint string for the specified |
| 155 | /// output operand. All output constraints are known to be non-empty (either |
| 156 | /// '=' or '+'). |
| 157 | std::string AsmStmt::getOutputConstraint(unsigned i) const { |
| 158 | return std::string(Constraints[i]->getStrData(), |
| 159 | Constraints[i]->getByteLength()); |
Ted Kremenek | ce2fc3a | 2008-10-27 18:40:21 +0000 | [diff] [blame] | 160 | } |
Chris Lattner | b327793 | 2009-03-10 04:59:06 +0000 | [diff] [blame] | 161 | |
Chris Lattner | 8575927 | 2009-03-11 00:23:13 +0000 | [diff] [blame] | 162 | /// getNumPlusOperands - Return the number of output operands that have a "+" |
| 163 | /// constraint. |
| 164 | unsigned AsmStmt::getNumPlusOperands() const { |
| 165 | unsigned Res = 0; |
| 166 | for (unsigned i = 0, e = getNumOutputs(); i != e; ++i) |
| 167 | if (isOutputPlusConstraint(i)) |
| 168 | ++Res; |
| 169 | return Res; |
| 170 | } |
| 171 | |
| 172 | |
Chris Lattner | b327793 | 2009-03-10 04:59:06 +0000 | [diff] [blame] | 173 | |
| 174 | Expr *AsmStmt::getInputExpr(unsigned i) { |
Ted Kremenek | ce2fc3a | 2008-10-27 18:40:21 +0000 | [diff] [blame] | 175 | return cast<Expr>(Exprs[i + NumOutputs]); |
| 176 | } |
Chris Lattner | b327793 | 2009-03-10 04:59:06 +0000 | [diff] [blame] | 177 | |
| 178 | /// getInputConstraint - Return the specified input constraint. Unlike output |
| 179 | /// constraints, these can be empty. |
| 180 | std::string AsmStmt::getInputConstraint(unsigned i) const { |
| 181 | return std::string(Constraints[i + NumOutputs]->getStrData(), |
| 182 | Constraints[i + NumOutputs]->getByteLength()); |
Ted Kremenek | ce2fc3a | 2008-10-27 18:40:21 +0000 | [diff] [blame] | 183 | } |
| 184 | |
Chris Lattner | 10ca96a | 2009-03-10 06:33:24 +0000 | [diff] [blame] | 185 | |
Douglas Gregor | cd7d5a9 | 2009-04-17 20:57:14 +0000 | [diff] [blame] | 186 | void AsmStmt::setOutputsAndInputs(unsigned NumOutputs, |
| 187 | unsigned NumInputs, |
| 188 | const std::string *Names, |
| 189 | StringLiteral **Constraints, |
| 190 | Stmt **Exprs) { |
| 191 | this->NumOutputs = NumOutputs; |
| 192 | this->NumInputs = NumInputs; |
| 193 | this->Names.clear(); |
| 194 | this->Names.insert(this->Names.end(), Names, Names + NumOutputs + NumInputs); |
| 195 | this->Constraints.clear(); |
| 196 | this->Constraints.insert(this->Constraints.end(), |
| 197 | Constraints, Constraints + NumOutputs + NumInputs); |
| 198 | this->Exprs.clear(); |
| 199 | this->Exprs.insert(this->Exprs.end(), Exprs, Exprs + NumOutputs + NumInputs); |
| 200 | } |
| 201 | |
Chris Lattner | 10ca96a | 2009-03-10 06:33:24 +0000 | [diff] [blame] | 202 | /// getNamedOperand - Given a symbolic operand reference like %[foo], |
| 203 | /// translate this into a numeric value needed to reference the same operand. |
| 204 | /// This returns -1 if the operand name is invalid. |
| 205 | int AsmStmt::getNamedOperand(const std::string &SymbolicName) const { |
| 206 | unsigned NumPlusOperands = 0; |
| 207 | |
| 208 | // Check if this is an output operand. |
| 209 | for (unsigned i = 0, e = getNumOutputs(); i != e; ++i) { |
| 210 | if (getOutputName(i) == SymbolicName) |
| 211 | return i; |
Chris Lattner | 10ca96a | 2009-03-10 06:33:24 +0000 | [diff] [blame] | 212 | } |
| 213 | |
| 214 | for (unsigned i = 0, e = getNumInputs(); i != e; ++i) |
| 215 | if (getInputName(i) == SymbolicName) |
| 216 | return getNumOutputs() + NumPlusOperands + i; |
| 217 | |
| 218 | // Not found. |
| 219 | return -1; |
| 220 | } |
| 221 | |
Douglas Gregor | cd7d5a9 | 2009-04-17 20:57:14 +0000 | [diff] [blame] | 222 | void AsmStmt::setClobbers(StringLiteral **Clobbers, unsigned NumClobbers) { |
| 223 | this->Clobbers.clear(); |
| 224 | this->Clobbers.insert(this->Clobbers.end(), Clobbers, Clobbers + NumClobbers); |
| 225 | } |
Chris Lattner | 10ca96a | 2009-03-10 06:33:24 +0000 | [diff] [blame] | 226 | |
Chris Lattner | 458cd9c | 2009-03-10 23:21:44 +0000 | [diff] [blame] | 227 | /// AnalyzeAsmString - Analyze the asm string of the current asm, decomposing |
| 228 | /// it into pieces. If the asm string is erroneous, emit errors and return |
| 229 | /// true, otherwise return false. |
Chris Lattner | fb5058e | 2009-03-10 23:41:04 +0000 | [diff] [blame] | 230 | unsigned AsmStmt::AnalyzeAsmString(llvm::SmallVectorImpl<AsmStringPiece>&Pieces, |
| 231 | ASTContext &C, unsigned &DiagOffs) const { |
Chris Lattner | 458cd9c | 2009-03-10 23:21:44 +0000 | [diff] [blame] | 232 | const char *StrStart = getAsmString()->getStrData(); |
| 233 | const char *StrEnd = StrStart + getAsmString()->getByteLength(); |
Chris Lattner | 3182db1 | 2009-03-10 23:51:40 +0000 | [diff] [blame] | 234 | const char *CurPtr = StrStart; |
Chris Lattner | 458cd9c | 2009-03-10 23:21:44 +0000 | [diff] [blame] | 235 | |
| 236 | // "Simple" inline asms have no constraints or operands, just convert the asm |
| 237 | // string to escape $'s. |
| 238 | if (isSimple()) { |
| 239 | std::string Result; |
Chris Lattner | 3182db1 | 2009-03-10 23:51:40 +0000 | [diff] [blame] | 240 | for (; CurPtr != StrEnd; ++CurPtr) { |
| 241 | switch (*CurPtr) { |
Chris Lattner | 458cd9c | 2009-03-10 23:21:44 +0000 | [diff] [blame] | 242 | case '$': |
| 243 | Result += "$$"; |
| 244 | break; |
| 245 | default: |
Chris Lattner | 3182db1 | 2009-03-10 23:51:40 +0000 | [diff] [blame] | 246 | Result += *CurPtr; |
Chris Lattner | 458cd9c | 2009-03-10 23:21:44 +0000 | [diff] [blame] | 247 | break; |
| 248 | } |
| 249 | } |
| 250 | Pieces.push_back(AsmStringPiece(Result)); |
Chris Lattner | 3182db1 | 2009-03-10 23:51:40 +0000 | [diff] [blame] | 251 | return 0; |
Chris Lattner | 458cd9c | 2009-03-10 23:21:44 +0000 | [diff] [blame] | 252 | } |
| 253 | |
| 254 | // CurStringPiece - The current string that we are building up as we scan the |
| 255 | // asm string. |
| 256 | std::string CurStringPiece; |
| 257 | |
| 258 | while (1) { |
| 259 | // Done with the string? |
Chris Lattner | 3182db1 | 2009-03-10 23:51:40 +0000 | [diff] [blame] | 260 | if (CurPtr == StrEnd) { |
Chris Lattner | 458cd9c | 2009-03-10 23:21:44 +0000 | [diff] [blame] | 261 | if (!CurStringPiece.empty()) |
| 262 | Pieces.push_back(AsmStringPiece(CurStringPiece)); |
Chris Lattner | 3182db1 | 2009-03-10 23:51:40 +0000 | [diff] [blame] | 263 | return 0; |
Chris Lattner | 458cd9c | 2009-03-10 23:21:44 +0000 | [diff] [blame] | 264 | } |
| 265 | |
Chris Lattner | 3182db1 | 2009-03-10 23:51:40 +0000 | [diff] [blame] | 266 | char CurChar = *CurPtr++; |
Chris Lattner | 458cd9c | 2009-03-10 23:21:44 +0000 | [diff] [blame] | 267 | if (CurChar == '$') { |
| 268 | CurStringPiece += "$$"; |
| 269 | continue; |
| 270 | } else if (CurChar != '%') { |
| 271 | CurStringPiece += CurChar; |
| 272 | continue; |
| 273 | } |
| 274 | |
| 275 | // Escaped "%" character in asm string. |
Chris Lattner | eab8cfb | 2009-03-11 00:06:36 +0000 | [diff] [blame] | 276 | if (CurPtr == StrEnd) { |
| 277 | // % at end of string is invalid (no escape). |
| 278 | DiagOffs = CurPtr-StrStart-1; |
| 279 | return diag::err_asm_invalid_escape; |
| 280 | } |
Chris Lattner | 458cd9c | 2009-03-10 23:21:44 +0000 | [diff] [blame] | 281 | |
Chris Lattner | 3182db1 | 2009-03-10 23:51:40 +0000 | [diff] [blame] | 282 | char EscapedChar = *CurPtr++; |
Chris Lattner | 458cd9c | 2009-03-10 23:21:44 +0000 | [diff] [blame] | 283 | if (EscapedChar == '%') { // %% -> % |
| 284 | // Escaped percentage sign. |
| 285 | CurStringPiece += '%'; |
| 286 | continue; |
| 287 | } |
| 288 | |
| 289 | if (EscapedChar == '=') { // %= -> Generate an unique ID. |
| 290 | CurStringPiece += "${:uid}"; |
| 291 | continue; |
| 292 | } |
| 293 | |
| 294 | // Otherwise, we have an operand. If we have accumulated a string so far, |
| 295 | // add it to the Pieces list. |
| 296 | if (!CurStringPiece.empty()) { |
| 297 | Pieces.push_back(AsmStringPiece(CurStringPiece)); |
| 298 | CurStringPiece.clear(); |
| 299 | } |
| 300 | |
| 301 | // Handle %x4 and %x[foo] by capturing x as the modifier character. |
| 302 | char Modifier = '\0'; |
| 303 | if (isalpha(EscapedChar)) { |
| 304 | Modifier = EscapedChar; |
Chris Lattner | 3182db1 | 2009-03-10 23:51:40 +0000 | [diff] [blame] | 305 | EscapedChar = *CurPtr++; |
Chris Lattner | 458cd9c | 2009-03-10 23:21:44 +0000 | [diff] [blame] | 306 | } |
| 307 | |
| 308 | if (isdigit(EscapedChar)) { |
| 309 | // %n - Assembler operand n |
Chris Lattner | cafc222 | 2009-03-11 22:52:17 +0000 | [diff] [blame] | 310 | unsigned N = 0; |
| 311 | |
| 312 | --CurPtr; |
| 313 | while (CurPtr != StrEnd && isdigit(*CurPtr)) |
Chris Lattner | 32a47ed | 2009-03-11 23:09:16 +0000 | [diff] [blame] | 314 | N = N*10 + ((*CurPtr++)-'0'); |
Chris Lattner | 8575927 | 2009-03-11 00:23:13 +0000 | [diff] [blame] | 315 | |
| 316 | unsigned NumOperands = |
| 317 | getNumOutputs() + getNumPlusOperands() + getNumInputs(); |
| 318 | if (N >= NumOperands) { |
| 319 | DiagOffs = CurPtr-StrStart-1; |
| 320 | return diag::err_asm_invalid_operand_number; |
| 321 | } |
| 322 | |
Chris Lattner | 458cd9c | 2009-03-10 23:21:44 +0000 | [diff] [blame] | 323 | Pieces.push_back(AsmStringPiece(N, Modifier)); |
| 324 | continue; |
| 325 | } |
| 326 | |
| 327 | // Handle %[foo], a symbolic operand reference. |
| 328 | if (EscapedChar == '[') { |
Chris Lattner | eab8cfb | 2009-03-11 00:06:36 +0000 | [diff] [blame] | 329 | DiagOffs = CurPtr-StrStart-1; |
| 330 | |
| 331 | // Find the ']'. |
Chris Lattner | 3182db1 | 2009-03-10 23:51:40 +0000 | [diff] [blame] | 332 | const char *NameEnd = (const char*)memchr(CurPtr, ']', StrEnd-CurPtr); |
Chris Lattner | eab8cfb | 2009-03-11 00:06:36 +0000 | [diff] [blame] | 333 | if (NameEnd == 0) |
| 334 | return diag::err_asm_unterminated_symbolic_operand_name; |
| 335 | if (NameEnd == CurPtr) |
| 336 | return diag::err_asm_empty_symbolic_operand_name; |
| 337 | |
Chris Lattner | 3182db1 | 2009-03-10 23:51:40 +0000 | [diff] [blame] | 338 | std::string SymbolicName(CurPtr, NameEnd); |
Chris Lattner | 458cd9c | 2009-03-10 23:21:44 +0000 | [diff] [blame] | 339 | |
| 340 | int N = getNamedOperand(SymbolicName); |
Chris Lattner | eab8cfb | 2009-03-11 00:06:36 +0000 | [diff] [blame] | 341 | if (N == -1) { |
| 342 | // Verify that an operand with that name exists. |
| 343 | DiagOffs = CurPtr-StrStart; |
| 344 | return diag::err_asm_unknown_symbolic_operand_name; |
| 345 | } |
Chris Lattner | 458cd9c | 2009-03-10 23:21:44 +0000 | [diff] [blame] | 346 | Pieces.push_back(AsmStringPiece(N, Modifier)); |
Chris Lattner | eab8cfb | 2009-03-11 00:06:36 +0000 | [diff] [blame] | 347 | |
| 348 | CurPtr = NameEnd+1; |
Chris Lattner | 458cd9c | 2009-03-10 23:21:44 +0000 | [diff] [blame] | 349 | continue; |
| 350 | } |
| 351 | |
Chris Lattner | 2ff0f42 | 2009-03-10 23:57:07 +0000 | [diff] [blame] | 352 | DiagOffs = CurPtr-StrStart-1; |
Chris Lattner | 3182db1 | 2009-03-10 23:51:40 +0000 | [diff] [blame] | 353 | return diag::err_asm_invalid_escape; |
Chris Lattner | 458cd9c | 2009-03-10 23:21:44 +0000 | [diff] [blame] | 354 | } |
| 355 | } |
| 356 | |
Chris Lattner | db6ed17 | 2008-01-30 05:01:46 +0000 | [diff] [blame] | 357 | //===----------------------------------------------------------------------===// |
| 358 | // Constructors |
| 359 | //===----------------------------------------------------------------------===// |
| 360 | |
Anders Carlsson | dfab34a | 2008-02-05 23:03:50 +0000 | [diff] [blame] | 361 | AsmStmt::AsmStmt(SourceLocation asmloc, bool issimple, bool isvolatile, |
Chris Lattner | db6ed17 | 2008-01-30 05:01:46 +0000 | [diff] [blame] | 362 | unsigned numoutputs, unsigned numinputs, |
| 363 | std::string *names, StringLiteral **constraints, |
| 364 | Expr **exprs, StringLiteral *asmstr, unsigned numclobbers, |
| 365 | StringLiteral **clobbers, SourceLocation rparenloc) |
Anders Carlsson | b235fc2 | 2007-11-22 01:36:19 +0000 | [diff] [blame] | 366 | : Stmt(AsmStmtClass), AsmLoc(asmloc), RParenLoc(rparenloc), AsmStr(asmstr) |
Anders Carlsson | dfab34a | 2008-02-05 23:03:50 +0000 | [diff] [blame] | 367 | , IsSimple(issimple), IsVolatile(isvolatile) |
| 368 | , NumOutputs(numoutputs), NumInputs(numinputs) { |
Anders Carlsson | b235fc2 | 2007-11-22 01:36:19 +0000 | [diff] [blame] | 369 | for (unsigned i = 0, e = numinputs + numoutputs; i != e; i++) { |
| 370 | Names.push_back(names[i]); |
| 371 | Exprs.push_back(exprs[i]); |
Nico Weber | 608b17f | 2008-08-05 23:15:29 +0000 | [diff] [blame] | 372 | Constraints.push_back(constraints[i]); |
Anders Carlsson | b235fc2 | 2007-11-22 01:36:19 +0000 | [diff] [blame] | 373 | } |
Nico Weber | 608b17f | 2008-08-05 23:15:29 +0000 | [diff] [blame] | 374 | |
Anders Carlsson | b235fc2 | 2007-11-22 01:36:19 +0000 | [diff] [blame] | 375 | for (unsigned i = 0; i != numclobbers; i++) |
| 376 | Clobbers.push_back(clobbers[i]); |
| 377 | } |
| 378 | |
Chris Lattner | db6ed17 | 2008-01-30 05:01:46 +0000 | [diff] [blame] | 379 | ObjCForCollectionStmt::ObjCForCollectionStmt(Stmt *Elem, Expr *Collect, |
| 380 | Stmt *Body, SourceLocation FCL, |
Nico Weber | 608b17f | 2008-08-05 23:15:29 +0000 | [diff] [blame] | 381 | SourceLocation RPL) |
Chris Lattner | db6ed17 | 2008-01-30 05:01:46 +0000 | [diff] [blame] | 382 | : Stmt(ObjCForCollectionStmtClass) { |
| 383 | SubExprs[ELEM] = Elem; |
| 384 | SubExprs[COLLECTION] = reinterpret_cast<Stmt*>(Collect); |
| 385 | SubExprs[BODY] = Body; |
| 386 | ForLoc = FCL; |
| 387 | RParenLoc = RPL; |
| 388 | } |
| 389 | |
| 390 | |
Nico Weber | 608b17f | 2008-08-05 23:15:29 +0000 | [diff] [blame] | 391 | ObjCAtCatchStmt::ObjCAtCatchStmt(SourceLocation atCatchLoc, |
| 392 | SourceLocation rparenloc, |
Steve Naroff | 7ba138a | 2009-03-03 19:52:17 +0000 | [diff] [blame] | 393 | ParmVarDecl *catchVarDecl, Stmt *atCatchStmt, |
Chris Lattner | db6ed17 | 2008-01-30 05:01:46 +0000 | [diff] [blame] | 394 | Stmt *atCatchList) |
| 395 | : Stmt(ObjCAtCatchStmtClass) { |
Steve Naroff | 7ba138a | 2009-03-03 19:52:17 +0000 | [diff] [blame] | 396 | ExceptionDecl = catchVarDecl; |
Chris Lattner | db6ed17 | 2008-01-30 05:01:46 +0000 | [diff] [blame] | 397 | SubExprs[BODY] = atCatchStmt; |
Eli Friedman | 0613c37 | 2008-05-25 04:34:57 +0000 | [diff] [blame] | 398 | SubExprs[NEXT_CATCH] = NULL; |
Daniel Dunbar | 93b2bdb | 2009-03-01 04:28:32 +0000 | [diff] [blame] | 399 | // FIXME: O(N^2) in number of catch blocks. |
Eli Friedman | 0613c37 | 2008-05-25 04:34:57 +0000 | [diff] [blame] | 400 | if (atCatchList) { |
Ted Kremenek | ff98102 | 2008-02-01 21:28:59 +0000 | [diff] [blame] | 401 | ObjCAtCatchStmt *AtCatchList = static_cast<ObjCAtCatchStmt*>(atCatchList); |
| 402 | |
Nico Weber | 608b17f | 2008-08-05 23:15:29 +0000 | [diff] [blame] | 403 | while (ObjCAtCatchStmt* NextCatch = AtCatchList->getNextCatchStmt()) |
Ted Kremenek | ff98102 | 2008-02-01 21:28:59 +0000 | [diff] [blame] | 404 | AtCatchList = NextCatch; |
Nico Weber | 608b17f | 2008-08-05 23:15:29 +0000 | [diff] [blame] | 405 | |
Ted Kremenek | ff98102 | 2008-02-01 21:28:59 +0000 | [diff] [blame] | 406 | AtCatchList->SubExprs[NEXT_CATCH] = this; |
Chris Lattner | db6ed17 | 2008-01-30 05:01:46 +0000 | [diff] [blame] | 407 | } |
| 408 | AtCatchLoc = atCatchLoc; |
| 409 | RParenLoc = rparenloc; |
| 410 | } |
| 411 | |
| 412 | |
Ted Kremenek | 8297777 | 2007-08-24 21:09:09 +0000 | [diff] [blame] | 413 | //===----------------------------------------------------------------------===// |
| 414 | // Child Iterators for iterating over subexpressions/substatements |
| 415 | //===----------------------------------------------------------------------===// |
| 416 | |
| 417 | // DeclStmt |
Ted Kremenek | 8ffb159 | 2008-10-07 23:09:49 +0000 | [diff] [blame] | 418 | Stmt::child_iterator DeclStmt::child_begin() { |
| 419 | return StmtIterator(DG.begin(), DG.end()); |
Ted Kremenek | 14f8b4f | 2008-08-05 20:46:55 +0000 | [diff] [blame] | 420 | } |
| 421 | |
Ted Kremenek | 8ffb159 | 2008-10-07 23:09:49 +0000 | [diff] [blame] | 422 | Stmt::child_iterator DeclStmt::child_end() { |
| 423 | return StmtIterator(DG.end(), DG.end()); |
Ted Kremenek | 65aa3b9 | 2008-10-06 20:54:44 +0000 | [diff] [blame] | 424 | } |
| 425 | |
Ted Kremenek | 8297777 | 2007-08-24 21:09:09 +0000 | [diff] [blame] | 426 | // NullStmt |
Ted Kremenek | 9ac5928 | 2007-10-18 23:28:49 +0000 | [diff] [blame] | 427 | Stmt::child_iterator NullStmt::child_begin() { return child_iterator(); } |
| 428 | Stmt::child_iterator NullStmt::child_end() { return child_iterator(); } |
Ted Kremenek | 8297777 | 2007-08-24 21:09:09 +0000 | [diff] [blame] | 429 | |
| 430 | // CompoundStmt |
| 431 | Stmt::child_iterator CompoundStmt::child_begin() { return &Body[0]; } |
Ted Kremenek | 8189cde | 2009-02-07 01:47:29 +0000 | [diff] [blame] | 432 | Stmt::child_iterator CompoundStmt::child_end() { return &Body[0]+NumStmts; } |
Ted Kremenek | 8297777 | 2007-08-24 21:09:09 +0000 | [diff] [blame] | 433 | |
Ted Kremenek | d97bb6c | 2007-08-30 16:50:46 +0000 | [diff] [blame] | 434 | // CaseStmt |
| 435 | Stmt::child_iterator CaseStmt::child_begin() { return &SubExprs[0]; } |
| 436 | Stmt::child_iterator CaseStmt::child_end() { return &SubExprs[END_EXPR]; } |
| 437 | |
| 438 | // DefaultStmt |
| 439 | Stmt::child_iterator DefaultStmt::child_begin() { return &SubStmt; } |
| 440 | Stmt::child_iterator DefaultStmt::child_end() { return &SubStmt+1; } |
Ted Kremenek | 8297777 | 2007-08-24 21:09:09 +0000 | [diff] [blame] | 441 | |
| 442 | // LabelStmt |
| 443 | Stmt::child_iterator LabelStmt::child_begin() { return &SubStmt; } |
Chris Lattner | b393879 | 2007-08-30 00:53:54 +0000 | [diff] [blame] | 444 | Stmt::child_iterator LabelStmt::child_end() { return &SubStmt+1; } |
Ted Kremenek | 8297777 | 2007-08-24 21:09:09 +0000 | [diff] [blame] | 445 | |
| 446 | // IfStmt |
| 447 | Stmt::child_iterator IfStmt::child_begin() { return &SubExprs[0]; } |
| 448 | Stmt::child_iterator IfStmt::child_end() { return &SubExprs[0]+END_EXPR; } |
| 449 | |
| 450 | // SwitchStmt |
| 451 | Stmt::child_iterator SwitchStmt::child_begin() { return &SubExprs[0]; } |
| 452 | Stmt::child_iterator SwitchStmt::child_end() { return &SubExprs[0]+END_EXPR; } |
| 453 | |
| 454 | // WhileStmt |
| 455 | Stmt::child_iterator WhileStmt::child_begin() { return &SubExprs[0]; } |
| 456 | Stmt::child_iterator WhileStmt::child_end() { return &SubExprs[0]+END_EXPR; } |
| 457 | |
| 458 | // DoStmt |
| 459 | Stmt::child_iterator DoStmt::child_begin() { return &SubExprs[0]; } |
| 460 | Stmt::child_iterator DoStmt::child_end() { return &SubExprs[0]+END_EXPR; } |
| 461 | |
| 462 | // ForStmt |
| 463 | Stmt::child_iterator ForStmt::child_begin() { return &SubExprs[0]; } |
| 464 | Stmt::child_iterator ForStmt::child_end() { return &SubExprs[0]+END_EXPR; } |
| 465 | |
Ted Kremenek | a526c5c | 2008-01-07 19:49:32 +0000 | [diff] [blame] | 466 | // ObjCForCollectionStmt |
Nico Weber | 608b17f | 2008-08-05 23:15:29 +0000 | [diff] [blame] | 467 | Stmt::child_iterator ObjCForCollectionStmt::child_begin() { |
| 468 | return &SubExprs[0]; |
Fariborz Jahanian | 0196cab | 2008-01-02 22:54:34 +0000 | [diff] [blame] | 469 | } |
Nico Weber | 608b17f | 2008-08-05 23:15:29 +0000 | [diff] [blame] | 470 | Stmt::child_iterator ObjCForCollectionStmt::child_end() { |
| 471 | return &SubExprs[0]+END_EXPR; |
Fariborz Jahanian | 0196cab | 2008-01-02 22:54:34 +0000 | [diff] [blame] | 472 | } |
| 473 | |
Ted Kremenek | 8297777 | 2007-08-24 21:09:09 +0000 | [diff] [blame] | 474 | // GotoStmt |
Ted Kremenek | 9ac5928 | 2007-10-18 23:28:49 +0000 | [diff] [blame] | 475 | Stmt::child_iterator GotoStmt::child_begin() { return child_iterator(); } |
| 476 | Stmt::child_iterator GotoStmt::child_end() { return child_iterator(); } |
Ted Kremenek | 8297777 | 2007-08-24 21:09:09 +0000 | [diff] [blame] | 477 | |
| 478 | // IndirectGotoStmt |
Ted Kremenek | 1060aff | 2008-06-17 03:11:08 +0000 | [diff] [blame] | 479 | Expr* IndirectGotoStmt::getTarget() { return cast<Expr>(Target); } |
| 480 | const Expr* IndirectGotoStmt::getTarget() const { return cast<Expr>(Target); } |
Ted Kremenek | 8297777 | 2007-08-24 21:09:09 +0000 | [diff] [blame] | 481 | |
Ted Kremenek | 1060aff | 2008-06-17 03:11:08 +0000 | [diff] [blame] | 482 | Stmt::child_iterator IndirectGotoStmt::child_begin() { return &Target; } |
| 483 | Stmt::child_iterator IndirectGotoStmt::child_end() { return &Target+1; } |
Ted Kremenek | 8297777 | 2007-08-24 21:09:09 +0000 | [diff] [blame] | 484 | |
| 485 | // ContinueStmt |
Ted Kremenek | 9ac5928 | 2007-10-18 23:28:49 +0000 | [diff] [blame] | 486 | Stmt::child_iterator ContinueStmt::child_begin() { return child_iterator(); } |
| 487 | Stmt::child_iterator ContinueStmt::child_end() { return child_iterator(); } |
Ted Kremenek | 8297777 | 2007-08-24 21:09:09 +0000 | [diff] [blame] | 488 | |
| 489 | // BreakStmt |
Ted Kremenek | 9ac5928 | 2007-10-18 23:28:49 +0000 | [diff] [blame] | 490 | Stmt::child_iterator BreakStmt::child_begin() { return child_iterator(); } |
| 491 | Stmt::child_iterator BreakStmt::child_end() { return child_iterator(); } |
Ted Kremenek | 8297777 | 2007-08-24 21:09:09 +0000 | [diff] [blame] | 492 | |
| 493 | // ReturnStmt |
Ted Kremenek | 1060aff | 2008-06-17 03:11:08 +0000 | [diff] [blame] | 494 | const Expr* ReturnStmt::getRetValue() const { |
| 495 | return cast_or_null<Expr>(RetExpr); |
| 496 | } |
| 497 | Expr* ReturnStmt::getRetValue() { |
| 498 | return cast_or_null<Expr>(RetExpr); |
Ted Kremenek | 8297777 | 2007-08-24 21:09:09 +0000 | [diff] [blame] | 499 | } |
| 500 | |
Ted Kremenek | 1060aff | 2008-06-17 03:11:08 +0000 | [diff] [blame] | 501 | Stmt::child_iterator ReturnStmt::child_begin() { |
| 502 | return &RetExpr; |
| 503 | } |
| 504 | Stmt::child_iterator ReturnStmt::child_end() { |
| 505 | return RetExpr ? &RetExpr+1 : &RetExpr; |
Ted Kremenek | 2298f91 | 2007-08-27 20:58:16 +0000 | [diff] [blame] | 506 | } |
Ted Kremenek | 8297777 | 2007-08-24 21:09:09 +0000 | [diff] [blame] | 507 | |
Chris Lattner | fe79595 | 2007-10-29 04:04:16 +0000 | [diff] [blame] | 508 | // AsmStmt |
Ted Kremenek | ce2fc3a | 2008-10-27 18:40:21 +0000 | [diff] [blame] | 509 | Stmt::child_iterator AsmStmt::child_begin() { |
| 510 | return Exprs.empty() ? 0 : &Exprs[0]; |
| 511 | } |
| 512 | Stmt::child_iterator AsmStmt::child_end() { |
| 513 | return Exprs.empty() ? 0 : &Exprs[0] + Exprs.size(); |
| 514 | } |
Chris Lattner | fe79595 | 2007-10-29 04:04:16 +0000 | [diff] [blame] | 515 | |
Ted Kremenek | a526c5c | 2008-01-07 19:49:32 +0000 | [diff] [blame] | 516 | // ObjCAtCatchStmt |
| 517 | Stmt::child_iterator ObjCAtCatchStmt::child_begin() { return &SubExprs[0]; } |
Nico Weber | 608b17f | 2008-08-05 23:15:29 +0000 | [diff] [blame] | 518 | Stmt::child_iterator ObjCAtCatchStmt::child_end() { |
| 519 | return &SubExprs[0]+END_EXPR; |
Fariborz Jahanian | 3b1191d | 2007-11-01 23:59:59 +0000 | [diff] [blame] | 520 | } |
Fariborz Jahanian | b210bd0 | 2007-11-01 21:12:44 +0000 | [diff] [blame] | 521 | |
Ted Kremenek | a526c5c | 2008-01-07 19:49:32 +0000 | [diff] [blame] | 522 | // ObjCAtFinallyStmt |
| 523 | Stmt::child_iterator ObjCAtFinallyStmt::child_begin() { return &AtFinallyStmt; } |
| 524 | Stmt::child_iterator ObjCAtFinallyStmt::child_end() { return &AtFinallyStmt+1; } |
Fariborz Jahanian | b210bd0 | 2007-11-01 21:12:44 +0000 | [diff] [blame] | 525 | |
Ted Kremenek | a526c5c | 2008-01-07 19:49:32 +0000 | [diff] [blame] | 526 | // ObjCAtTryStmt |
| 527 | Stmt::child_iterator ObjCAtTryStmt::child_begin() { return &SubStmts[0]; } |
Nico Weber | 608b17f | 2008-08-05 23:15:29 +0000 | [diff] [blame] | 528 | Stmt::child_iterator ObjCAtTryStmt::child_end() { |
| 529 | return &SubStmts[0]+END_EXPR; |
Fariborz Jahanian | 3b1191d | 2007-11-01 23:59:59 +0000 | [diff] [blame] | 530 | } |
Fariborz Jahanian | b210bd0 | 2007-11-01 21:12:44 +0000 | [diff] [blame] | 531 | |
Ted Kremenek | a526c5c | 2008-01-07 19:49:32 +0000 | [diff] [blame] | 532 | // ObjCAtThrowStmt |
| 533 | Stmt::child_iterator ObjCAtThrowStmt::child_begin() { |
Fariborz Jahanian | 39f8f15 | 2007-11-07 02:00:49 +0000 | [diff] [blame] | 534 | return &Throw; |
| 535 | } |
| 536 | |
Ted Kremenek | a526c5c | 2008-01-07 19:49:32 +0000 | [diff] [blame] | 537 | Stmt::child_iterator ObjCAtThrowStmt::child_end() { |
Fariborz Jahanian | 39f8f15 | 2007-11-07 02:00:49 +0000 | [diff] [blame] | 538 | return &Throw+1; |
| 539 | } |
Fariborz Jahanian | fa3ee8e | 2008-01-29 19:14:59 +0000 | [diff] [blame] | 540 | |
| 541 | // ObjCAtSynchronizedStmt |
| 542 | Stmt::child_iterator ObjCAtSynchronizedStmt::child_begin() { |
Fariborz Jahanian | a0f5579 | 2008-01-29 22:59:37 +0000 | [diff] [blame] | 543 | return &SubStmts[0]; |
Fariborz Jahanian | fa3ee8e | 2008-01-29 19:14:59 +0000 | [diff] [blame] | 544 | } |
| 545 | |
| 546 | Stmt::child_iterator ObjCAtSynchronizedStmt::child_end() { |
Fariborz Jahanian | a0f5579 | 2008-01-29 22:59:37 +0000 | [diff] [blame] | 547 | return &SubStmts[0]+END_EXPR; |
Fariborz Jahanian | fa3ee8e | 2008-01-29 19:14:59 +0000 | [diff] [blame] | 548 | } |
| 549 | |
Sebastian Redl | 4b07b29 | 2008-12-22 19:15:10 +0000 | [diff] [blame] | 550 | // CXXCatchStmt |
| 551 | Stmt::child_iterator CXXCatchStmt::child_begin() { |
| 552 | return &HandlerBlock; |
| 553 | } |
| 554 | |
| 555 | Stmt::child_iterator CXXCatchStmt::child_end() { |
| 556 | return &HandlerBlock + 1; |
| 557 | } |
| 558 | |
| 559 | QualType CXXCatchStmt::getCaughtType() { |
| 560 | if (ExceptionDecl) |
Douglas Gregor | d308e62 | 2009-05-18 20:51:54 +0000 | [diff] [blame] | 561 | return ExceptionDecl->getType(); |
Sebastian Redl | 4b07b29 | 2008-12-22 19:15:10 +0000 | [diff] [blame] | 562 | return QualType(); |
| 563 | } |
| 564 | |
Douglas Gregor | 42602bb | 2009-08-07 06:08:38 +0000 | [diff] [blame^] | 565 | void CXXCatchStmt::DoDestroy(ASTContext& C) { |
Sebastian Redl | 8351da0 | 2008-12-22 21:35:02 +0000 | [diff] [blame] | 566 | if (ExceptionDecl) |
| 567 | ExceptionDecl->Destroy(C); |
Douglas Gregor | 42602bb | 2009-08-07 06:08:38 +0000 | [diff] [blame^] | 568 | Stmt::DoDestroy(C); |
Sebastian Redl | 4b07b29 | 2008-12-22 19:15:10 +0000 | [diff] [blame] | 569 | } |
Sebastian Redl | 8351da0 | 2008-12-22 21:35:02 +0000 | [diff] [blame] | 570 | |
| 571 | // CXXTryStmt |
| 572 | Stmt::child_iterator CXXTryStmt::child_begin() { return &Stmts[0]; } |
| 573 | Stmt::child_iterator CXXTryStmt::child_end() { return &Stmts[0]+Stmts.size(); } |
| 574 | |
| 575 | CXXTryStmt::CXXTryStmt(SourceLocation tryLoc, Stmt *tryBlock, |
| 576 | Stmt **handlers, unsigned numHandlers) |
| 577 | : Stmt(CXXTryStmtClass), TryLoc(tryLoc) { |
| 578 | Stmts.push_back(tryBlock); |
| 579 | Stmts.insert(Stmts.end(), handlers, handlers + numHandlers); |
| 580 | } |