diff options
author | Alexey Bataev <a.bataev@hotmail.com> | 2015-07-02 11:25:17 +0000 |
---|---|---|
committer | Alexey Bataev <a.bataev@hotmail.com> | 2015-07-02 11:25:17 +0000 |
commit | 80909878adc79d9f1277373af175041718f05953 (patch) | |
tree | c673079a9bf2cc7e6d7635625bdb1691e162686b /clang/lib/AST | |
parent | 3937bc650cad69cbd607ca3ea64ea6623808fc19 (diff) | |
download | bcm5719-llvm-80909878adc79d9f1277373af175041718f05953.tar.gz bcm5719-llvm-80909878adc79d9f1277373af175041718f05953.zip |
[OPENMP 4.0] Initial support for 'omp cancel' construct.
Implemented parsing/sema analysis + (de)serialization.
llvm-svn: 241253
Diffstat (limited to 'clang/lib/AST')
-rw-r--r-- | clang/lib/AST/Stmt.cpp | 20 | ||||
-rw-r--r-- | clang/lib/AST/StmtPrinter.cpp | 6 | ||||
-rw-r--r-- | clang/lib/AST/StmtProfile.cpp | 4 |
3 files changed, 30 insertions, 0 deletions
diff --git a/clang/lib/AST/Stmt.cpp b/clang/lib/AST/Stmt.cpp index 911ec5e30ef..c0aab4c4db7 100644 --- a/clang/lib/AST/Stmt.cpp +++ b/clang/lib/AST/Stmt.cpp @@ -2106,6 +2106,26 @@ OMPCancellationPointDirective::CreateEmpty(const ASTContext &C, EmptyShell) { return new (Mem) OMPCancellationPointDirective(); } +OMPCancelDirective * +OMPCancelDirective::Create(const ASTContext &C, SourceLocation StartLoc, + SourceLocation EndLoc, + OpenMPDirectiveKind CancelRegion) { + unsigned Size = llvm::RoundUpToAlignment(sizeof(OMPCancelDirective), + llvm::alignOf<Stmt *>()); + void *Mem = C.Allocate(Size); + OMPCancelDirective *Dir = new (Mem) OMPCancelDirective(StartLoc, EndLoc); + Dir->setCancelRegion(CancelRegion); + return Dir; +} + +OMPCancelDirective *OMPCancelDirective::CreateEmpty(const ASTContext &C, + EmptyShell) { + unsigned Size = llvm::RoundUpToAlignment(sizeof(OMPCancelDirective), + llvm::alignOf<Stmt *>()); + void *Mem = C.Allocate(Size); + return new (Mem) OMPCancelDirective(); +} + OMPFlushDirective *OMPFlushDirective::Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, diff --git a/clang/lib/AST/StmtPrinter.cpp b/clang/lib/AST/StmtPrinter.cpp index 26019fd530d..79600773f56 100644 --- a/clang/lib/AST/StmtPrinter.cpp +++ b/clang/lib/AST/StmtPrinter.cpp @@ -957,6 +957,12 @@ void StmtPrinter::VisitOMPCancellationPointDirective( << getOpenMPDirectiveName(Node->getCancelRegion()); PrintOMPExecutableDirective(Node); } + +void StmtPrinter::VisitOMPCancelDirective(OMPCancelDirective *Node) { + Indent() << "#pragma omp cancel " + << getOpenMPDirectiveName(Node->getCancelRegion()); + PrintOMPExecutableDirective(Node); +} //===----------------------------------------------------------------------===// // Expr printing methods. //===----------------------------------------------------------------------===// diff --git a/clang/lib/AST/StmtProfile.cpp b/clang/lib/AST/StmtProfile.cpp index 7d1d48be791..63f432ca4c3 100644 --- a/clang/lib/AST/StmtProfile.cpp +++ b/clang/lib/AST/StmtProfile.cpp @@ -542,6 +542,10 @@ void StmtProfiler::VisitOMPCancellationPointDirective( VisitOMPExecutableDirective(S); } +void StmtProfiler::VisitOMPCancelDirective(const OMPCancelDirective *S) { + VisitOMPExecutableDirective(S); +} + void StmtProfiler::VisitExpr(const Expr *S) { VisitStmt(S); } |