diff options
Diffstat (limited to 'clang/lib/AST/Stmt.cpp')
-rw-r--r-- | clang/lib/AST/Stmt.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/clang/lib/AST/Stmt.cpp b/clang/lib/AST/Stmt.cpp index b402f6edd25..5245944e854 100644 --- a/clang/lib/AST/Stmt.cpp +++ b/clang/lib/AST/Stmt.cpp @@ -1430,3 +1430,29 @@ OMPSectionDirective *OMPSectionDirective::CreateEmpty(const ASTContext &C, return new (Mem) OMPSectionDirective(); } +OMPSingleDirective *OMPSingleDirective::Create(const ASTContext &C, + SourceLocation StartLoc, + SourceLocation EndLoc, + ArrayRef<OMPClause *> Clauses, + Stmt *AssociatedStmt) { + unsigned Size = llvm::RoundUpToAlignment(sizeof(OMPSingleDirective), + llvm::alignOf<OMPClause *>()); + void *Mem = + C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *)); + OMPSingleDirective *Dir = + new (Mem) OMPSingleDirective(StartLoc, EndLoc, Clauses.size()); + Dir->setClauses(Clauses); + Dir->setAssociatedStmt(AssociatedStmt); + return Dir; +} + +OMPSingleDirective *OMPSingleDirective::CreateEmpty(const ASTContext &C, + unsigned NumClauses, + EmptyShell) { + unsigned Size = llvm::RoundUpToAlignment(sizeof(OMPSingleDirective), + llvm::alignOf<OMPClause *>()); + void *Mem = + C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *)); + return new (Mem) OMPSingleDirective(NumClauses); +} + |