diff options
Diffstat (limited to 'clang/lib/AST/Stmt.cpp')
-rw-r--r-- | clang/lib/AST/Stmt.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/clang/lib/AST/Stmt.cpp b/clang/lib/AST/Stmt.cpp index 826a1d851f1..ead73fc38b4 100644 --- a/clang/lib/AST/Stmt.cpp +++ b/clang/lib/AST/Stmt.cpp @@ -1361,3 +1361,30 @@ OMPSimdDirective *OMPSimdDirective::CreateEmpty(const ASTContext &C, return new (Mem) OMPSimdDirective(CollapsedNum, NumClauses); } +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::CreateEmpty(const ASTContext &C, + unsigned NumClauses, + unsigned CollapsedNum, + EmptyShell) { + unsigned Size = llvm::RoundUpToAlignment(sizeof(OMPForDirective), + llvm::alignOf<OMPClause *>()); + void *Mem = + C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *)); + return new (Mem) OMPForDirective(CollapsedNum, NumClauses); +} + |