From 87933c7ced4fb99bb9cf6cea4d87cec2825aea7c Mon Sep 17 00:00:00 2001 From: Alexey Bataev Date: Fri, 18 Sep 2015 08:07:34 +0000 Subject: [OPENMP 4.0] Add 'if' clause for 'cancel' directive. Add parsing, sema analysis and codegen for 'if' clause in 'cancel' directive. llvm-svn: 247976 --- clang/lib/Sema/SemaOpenMP.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'clang/lib/Sema/SemaOpenMP.cpp') diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp index ed58e475fe7..3865f2773f9 100644 --- a/clang/lib/Sema/SemaOpenMP.cpp +++ b/clang/lib/Sema/SemaOpenMP.cpp @@ -2245,11 +2245,11 @@ StmtResult Sema::ActOnOpenMPExecutableDirective( Res = ActOnOpenMPCancellationPointDirective(StartLoc, EndLoc, CancelRegion); break; case OMPD_cancel: - assert(ClausesWithImplicit.empty() && - "No clauses are allowed for 'omp cancel' directive"); assert(AStmt == nullptr && "No associated statement allowed for 'omp cancel' directive"); - Res = ActOnOpenMPCancelDirective(StartLoc, EndLoc, CancelRegion); + Res = ActOnOpenMPCancelDirective(ClausesWithImplicit, StartLoc, EndLoc, + CancelRegion); + AllowedNameModifiers.push_back(OMPD_cancel); break; case OMPD_target_data: Res = ActOnOpenMPTargetDataDirective(ClausesWithImplicit, AStmt, StartLoc, @@ -4909,7 +4909,8 @@ Sema::ActOnOpenMPCancellationPointDirective(SourceLocation StartLoc, CancelRegion); } -StmtResult Sema::ActOnOpenMPCancelDirective(SourceLocation StartLoc, +StmtResult Sema::ActOnOpenMPCancelDirective(ArrayRef Clauses, + SourceLocation StartLoc, SourceLocation EndLoc, OpenMPDirectiveKind CancelRegion) { if (CancelRegion != OMPD_parallel && CancelRegion != OMPD_for && @@ -4927,7 +4928,8 @@ StmtResult Sema::ActOnOpenMPCancelDirective(SourceLocation StartLoc, return StmtError(); } DSAStack->setParentCancelRegion(/*Cancel=*/true); - return OMPCancelDirective::Create(Context, StartLoc, EndLoc, CancelRegion); + return OMPCancelDirective::Create(Context, StartLoc, EndLoc, Clauses, + CancelRegion); } OMPClause *Sema::ActOnOpenMPSingleExprClause(OpenMPClauseKind Kind, Expr *Expr, -- cgit v1.2.3