OMPForDirective *OMPForDirective::Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) { unsigned Size = llvm::RoundUpToAlignment(sizeof(OMPForDirective), llvm::alignOf<OMPClause *>()); void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *)); OMPForDirective *Dir = new (Mem) OMPForDirective(StartLoc, EndLoc, 1, Clauses.size()); Dir->setClauses(Clauses); Dir->setAssociatedStmt(AssociatedStmt); return Dir; }
OMPForDirective * OMPForDirective::Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, const HelperExprs &Exprs, bool HasCancel) { unsigned Size = llvm::alignTo(sizeof(OMPForDirective), llvm::alignOf<OMPClause *>()); void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_for)); OMPForDirective *Dir = new (Mem) OMPForDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size()); Dir->setClauses(Clauses); Dir->setAssociatedStmt(AssociatedStmt); Dir->setIterationVariable(Exprs.IterationVarRef); Dir->setLastIteration(Exprs.LastIteration); Dir->setCalcLastIteration(Exprs.CalcLastIteration); Dir->setPreCond(Exprs.PreCond); Dir->setCond(Exprs.Cond); Dir->setInit(Exprs.Init); Dir->setInc(Exprs.Inc); Dir->setIsLastIterVariable(Exprs.IL); Dir->setLowerBoundVariable(Exprs.LB); Dir->setUpperBoundVariable(Exprs.UB); Dir->setStrideVariable(Exprs.ST); Dir->setEnsureUpperBound(Exprs.EUB); Dir->setNextLowerBound(Exprs.NLB); Dir->setNextUpperBound(Exprs.NUB); Dir->setCounters(Exprs.Counters); Dir->setPrivateCounters(Exprs.PrivateCounters); Dir->setInits(Exprs.Inits); Dir->setUpdates(Exprs.Updates); Dir->setFinals(Exprs.Finals); Dir->setHasCancel(HasCancel); return Dir; }