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