diff options
| author | Alexey Bataev <a.bataev@hotmail.com> | 2014-06-26 12:05:45 +0000 |
|---|---|---|
| committer | Alexey Bataev <a.bataev@hotmail.com> | 2014-06-26 12:05:45 +0000 |
| commit | d1e40fbfe1c38f5778c739d1fc1b3bcf156ccb58 (patch) | |
| tree | 30b273a3b64072c964ed33986d2de6362af8c7d8 /clang/lib/AST | |
| parent | aee45418287cdcc1387c56e0c0d08990c322b45b (diff) | |
| download | bcm5719-llvm-d1e40fbfe1c38f5778c739d1fc1b3bcf156ccb58.tar.gz bcm5719-llvm-d1e40fbfe1c38f5778c739d1fc1b3bcf156ccb58.zip | |
[OPENMP] Initial parsing and sema analysis for 'single' directive.
llvm-svn: 211774
Diffstat (limited to 'clang/lib/AST')
| -rw-r--r-- | clang/lib/AST/Stmt.cpp | 26 | ||||
| -rw-r--r-- | clang/lib/AST/StmtPrinter.cpp | 5 | ||||
| -rw-r--r-- | clang/lib/AST/StmtProfile.cpp | 4 |
3 files changed, 35 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); +} + diff --git a/clang/lib/AST/StmtPrinter.cpp b/clang/lib/AST/StmtPrinter.cpp index 0ac683347f0..4a46063df37 100644 --- a/clang/lib/AST/StmtPrinter.cpp +++ b/clang/lib/AST/StmtPrinter.cpp @@ -797,6 +797,11 @@ void StmtPrinter::VisitOMPSectionDirective(OMPSectionDirective *Node) { PrintOMPExecutableDirective(Node); } +void StmtPrinter::VisitOMPSingleDirective(OMPSingleDirective *Node) { + Indent() << "#pragma omp single "; + PrintOMPExecutableDirective(Node); +} + //===----------------------------------------------------------------------===// // Expr printing methods. //===----------------------------------------------------------------------===// diff --git a/clang/lib/AST/StmtProfile.cpp b/clang/lib/AST/StmtProfile.cpp index 804003fb678..f3f3c7ba8e6 100644 --- a/clang/lib/AST/StmtProfile.cpp +++ b/clang/lib/AST/StmtProfile.cpp @@ -368,6 +368,10 @@ void StmtProfiler::VisitOMPSectionDirective(const OMPSectionDirective *S) { VisitOMPExecutableDirective(S); } +void StmtProfiler::VisitOMPSingleDirective(const OMPSingleDirective *S) { + VisitOMPExecutableDirective(S); +} + void StmtProfiler::VisitExpr(const Expr *S) { VisitStmt(S); } |

