diff options
author | Alexey Bataev <a.bataev@hotmail.com> | 2014-02-27 08:29:12 +0000 |
---|---|---|
committer | Alexey Bataev <a.bataev@hotmail.com> | 2014-02-27 08:29:12 +0000 |
commit | 1b59ab568333264eadb4beb81ef9c40446744736 (patch) | |
tree | b7c942713595cd71aa04071fc9c133d9cb2cf2b3 /clang/lib/AST/Stmt.cpp | |
parent | 6edfad4811795789706216bf47b39ff7a4672286 (diff) | |
download | bcm5719-llvm-1b59ab568333264eadb4beb81ef9c40446744736.tar.gz bcm5719-llvm-1b59ab568333264eadb4beb81ef9c40446744736.zip |
[OPENMP] First changes for Parsing and Sema for 'omp simd' directive support
llvm-svn: 202360
Diffstat (limited to 'clang/lib/AST/Stmt.cpp')
-rw-r--r-- | clang/lib/AST/Stmt.cpp | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/clang/lib/AST/Stmt.cpp b/clang/lib/AST/Stmt.cpp index f4d90eaded2..9118751a4b9 100644 --- a/clang/lib/AST/Stmt.cpp +++ b/clang/lib/AST/Stmt.cpp @@ -1217,10 +1217,39 @@ OMPParallelDirective *OMPParallelDirective::Create( } OMPParallelDirective *OMPParallelDirective::CreateEmpty(const ASTContext &C, - unsigned N, + unsigned NumClauses, EmptyShell) { unsigned Size = llvm::RoundUpToAlignment(sizeof(OMPParallelDirective), llvm::alignOf<OMPClause *>()); - void *Mem = C.Allocate(Size + sizeof(OMPClause *) * N + sizeof(Stmt *)); - return new (Mem) OMPParallelDirective(N); + void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses + + sizeof(Stmt *)); + return new (Mem) OMPParallelDirective(NumClauses); +} + +OMPSimdDirective *OMPSimdDirective::Create(const ASTContext &C, + SourceLocation StartLoc, + SourceLocation EndLoc, + ArrayRef<OMPClause *> Clauses, + Stmt *AssociatedStmt) { + unsigned Size = llvm::RoundUpToAlignment(sizeof(OMPSimdDirective), + llvm::alignOf<OMPClause *>()); + void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + + sizeof(Stmt *)); + OMPSimdDirective *Dir = new (Mem) OMPSimdDirective(StartLoc, EndLoc, + 1, Clauses.size()); + Dir->setClauses(Clauses); + Dir->setAssociatedStmt(AssociatedStmt); + return Dir; +} + +OMPSimdDirective *OMPSimdDirective::CreateEmpty(const ASTContext &C, + unsigned NumClauses, + unsigned CollapsedNum, + EmptyShell) { + unsigned Size = llvm::RoundUpToAlignment(sizeof(OMPSimdDirective), + llvm::alignOf<OMPClause *>()); + void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses + + sizeof(Stmt *)); + return new (Mem) OMPSimdDirective(CollapsedNum, NumClauses); } + |