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