diff options
author | Alexander Musman <alexander.musman@gmail.com> | 2014-06-03 10:16:47 +0000 |
---|---|---|
committer | Alexander Musman <alexander.musman@gmail.com> | 2014-06-03 10:16:47 +0000 |
commit | a8e9d2eccc6e6325cff41741de871c73cebf7f23 (patch) | |
tree | dde2e402f5f5c0df928cd89900c4b01ac5abf491 /clang/lib/Sema/SemaStmt.cpp | |
parent | fd5b2346cce2a0dba21520217b7f8c13b7b0f6c9 (diff) | |
download | bcm5719-llvm-a8e9d2eccc6e6325cff41741de871c73cebf7f23.tar.gz bcm5719-llvm-a8e9d2eccc6e6325cff41741de871c73cebf7f23.zip |
[OPENMP] Loop canonical form analysis (Sema)
This patch implements semantic analysis to make sure that the loop is in OpenMP canonical form.
This is the form required for 'omp simd', 'omp for' and other loop pragmas.
Differential revision: http://reviews.llvm.org/D3778
llvm-svn: 210095
Diffstat (limited to 'clang/lib/Sema/SemaStmt.cpp')
-rw-r--r-- | clang/lib/Sema/SemaStmt.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp index ec11daddf84..cdcbaeae04d 100644 --- a/clang/lib/Sema/SemaStmt.cpp +++ b/clang/lib/Sema/SemaStmt.cpp @@ -2417,6 +2417,9 @@ Sema::ActOnBreakStmt(SourceLocation BreakLoc, Scope *CurScope) { // C99 6.8.6.3p1: A break shall appear only in or as a switch/loop body. return StmtError(Diag(BreakLoc, diag::err_break_not_in_loop_or_switch)); } + if (S->isOpenMPLoopScope()) + return StmtError(Diag(BreakLoc, diag::err_omp_loop_cannot_use_stmt) + << "break"); return new (Context) BreakStmt(BreakLoc); } @@ -3188,6 +3191,9 @@ StmtResult Sema::ActOnCXXTryBlock(SourceLocation TryLoc, Stmt *TryBlock, !getSourceManager().isInSystemHeader(TryLoc)) Diag(TryLoc, diag::err_exceptions_disabled) << "try"; + if (getCurScope() && getCurScope()->isOpenMPSimdDirectiveScope()) + Diag(TryLoc, diag::err_omp_simd_region_cannot_use_stmt) << "try"; + const unsigned NumHandlers = Handlers.size(); assert(NumHandlers > 0 && "The parser shouldn't call this if there are no handlers."); |