SwitchStmt *SwitchStmt::create(LabeledStmtInfo LabelInfo, SourceLoc SwitchLoc, Expr *SubjectExpr, SourceLoc LBraceLoc, ArrayRef<CaseStmt *> Cases, SourceLoc RBraceLoc, ASTContext &C) { void *p = C.Allocate(sizeof(SwitchStmt) + Cases.size() * sizeof(SwitchStmt*), alignof(SwitchStmt)); SwitchStmt *theSwitch = ::new (p) SwitchStmt(LabelInfo, SwitchLoc, SubjectExpr, LBraceLoc, Cases.size(), RBraceLoc); memcpy(theSwitch->getCaseBuffer(), Cases.data(), Cases.size() * sizeof(CaseStmt*)); return theSwitch; }