diff options
author | Alexey Bataev <a.bataev@hotmail.com> | 2016-01-13 11:18:54 +0000 |
---|---|---|
committer | Alexey Bataev <a.bataev@hotmail.com> | 2016-01-13 11:18:54 +0000 |
commit | c4fad65bfc86c21926e444f2dfc2c9787fbc7551 (patch) | |
tree | 56b5ffaac9be1619fc276e4221e60d4fe18f56bf /clang/lib/Parse/ParseOpenMP.cpp | |
parent | 529b940a77a8abf4e2ba99f5d1b4e821e0b8a696 (diff) | |
download | bcm5719-llvm-c4fad65bfc86c21926e444f2dfc2c9787fbc7551.tar.gz bcm5719-llvm-c4fad65bfc86c21926e444f2dfc2c9787fbc7551.zip |
[OPENMP] Fix for declarative/standalone directives use.
Fixes processing of declarative directives and standalone executable directives. Declarative directives should not be allowed as an immediate statements and standalone executable directives are allowed to be used in case-stmt constructs.
llvm-svn: 257586
Diffstat (limited to 'clang/lib/Parse/ParseOpenMP.cpp')
-rw-r--r-- | clang/lib/Parse/ParseOpenMP.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/clang/lib/Parse/ParseOpenMP.cpp b/clang/lib/Parse/ParseOpenMP.cpp index 078f4c38870..a08db5490fa 100644 --- a/clang/lib/Parse/ParseOpenMP.cpp +++ b/clang/lib/Parse/ParseOpenMP.cpp @@ -165,8 +165,8 @@ Parser::DeclGroupPtrTy Parser::ParseOpenMPDeclarativeDirective() { /// 'distribute' /// annot_pragma_openmp_end /// -StmtResult -Parser::ParseOpenMPDeclarativeOrExecutableDirective(bool StandAloneAllowed) { +StmtResult Parser::ParseOpenMPDeclarativeOrExecutableDirective( + AllowedContsructsKind Allowed) { assert(Tok.is(tok::annot_pragma_openmp) && "Not an OpenMP directive!"); ParenBraceBracketBalancer BalancerRAIIObj(*this); SmallVector<Expr *, 5> Identifiers; @@ -186,6 +186,10 @@ Parser::ParseOpenMPDeclarativeOrExecutableDirective(bool StandAloneAllowed) { switch (DKind) { case OMPD_threadprivate: + if (Allowed != ACK_Any) { + Diag(Tok, diag::err_omp_immediate_directive) + << getOpenMPDirectiveName(DKind) << 0; + } ConsumeToken(); if (!ParseOpenMPSimpleVarList(OMPD_threadprivate, Identifiers, false)) { // The last seen token is annot_pragma_openmp_end - need to check for @@ -213,7 +217,7 @@ Parser::ParseOpenMPDeclarativeOrExecutableDirective(bool StandAloneAllowed) { case OMPD_taskwait: case OMPD_cancellation_point: case OMPD_cancel: - if (!StandAloneAllowed) { + if (Allowed == ACK_StatementsOpenMPNonStandalone) { Diag(Tok, diag::err_omp_immediate_directive) << getOpenMPDirectiveName(DKind) << 0; } @@ -299,7 +303,7 @@ Parser::ParseOpenMPDeclarativeOrExecutableDirective(bool StandAloneAllowed) { // If the depend clause is specified, the ordered construct is a stand-alone // directive. if (DKind == OMPD_ordered && FirstClauses[OMPC_depend].getInt()) { - if (!StandAloneAllowed) { + if (Allowed == ACK_StatementsOpenMPNonStandalone) { Diag(Loc, diag::err_omp_immediate_directive) << getOpenMPDirectiveName(DKind) << 1 << getOpenMPClauseName(OMPC_depend); |