summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseOpenMP.cpp
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2014-07-18 07:47:19 +0000
committerAlexey Bataev <a.bataev@hotmail.com>2014-07-18 07:47:19 +0000
commit68446b72530b7b8badf295a350de43265dbec06a (patch)
treea4c0e485fde8c4ef174df6e53e7f1cf9b4a8cfb9 /clang/lib/Parse/ParseOpenMP.cpp
parent05c30880b6590bc7ca7ead689d2124994f795ffe (diff)
downloadbcm5719-llvm-68446b72530b7b8badf295a350de43265dbec06a.tar.gz
bcm5719-llvm-68446b72530b7b8badf295a350de43265dbec06a.zip
[OPENMP] Initial parsing and sema analysis of 'taskyield' directive.
llvm-svn: 213355
Diffstat (limited to 'clang/lib/Parse/ParseOpenMP.cpp')
-rw-r--r--clang/lib/Parse/ParseOpenMP.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/clang/lib/Parse/ParseOpenMP.cpp b/clang/lib/Parse/ParseOpenMP.cpp
index cfe160216f8..06fe1ad464d 100644
--- a/clang/lib/Parse/ParseOpenMP.cpp
+++ b/clang/lib/Parse/ParseOpenMP.cpp
@@ -83,6 +83,7 @@ Parser::DeclGroupPtrTy Parser::ParseOpenMPDeclarativeDirective() {
case OMPD_parallel:
case OMPD_simd:
case OMPD_task:
+ case OMPD_taskyield:
case OMPD_for:
case OMPD_sections:
case OMPD_section:
@@ -107,9 +108,11 @@ Parser::DeclGroupPtrTy Parser::ParseOpenMPDeclarativeDirective() {
/// executable-directive:
/// annot_pragma_openmp 'parallel' | 'simd' | 'for' | 'sections' |
/// 'section' | 'single' | 'master' | 'parallel for' |
-/// 'parallel sections' | 'task' {clause} annot_pragma_openmp_end
+/// 'parallel sections' | 'task' | 'taskyield' {clause}
+/// annot_pragma_openmp_end
///
-StmtResult Parser::ParseOpenMPDeclarativeOrExecutableDirective() {
+StmtResult
+Parser::ParseOpenMPDeclarativeOrExecutableDirective(bool StandAloneAllowed) {
assert(Tok.is(tok::annot_pragma_openmp) && "Not an OpenMP directive!");
ParenBraceBracketBalancer BalancerRAIIObj(*this);
SmallVector<Expr *, 5> Identifiers;
@@ -123,6 +126,7 @@ StmtResult Parser::ParseOpenMPDeclarativeOrExecutableDirective() {
// Name of critical directive.
DeclarationNameInfo DirName;
StmtResult Directive = StmtError();
+ bool HasAssociatedStatement = true;
switch (DKind) {
case OMPD_threadprivate:
@@ -141,6 +145,12 @@ StmtResult Parser::ParseOpenMPDeclarativeOrExecutableDirective() {
}
SkipUntil(tok::annot_pragma_openmp_end);
break;
+ case OMPD_taskyield:
+ if (!StandAloneAllowed) {
+ Diag(Tok, diag::err_omp_immediate_directive)
+ << getOpenMPDirectiveName(DKind);
+ }
+ HasAssociatedStatement = false;
case OMPD_parallel:
case OMPD_simd:
case OMPD_for:
@@ -183,7 +193,7 @@ StmtResult Parser::ParseOpenMPDeclarativeOrExecutableDirective() {
StmtResult AssociatedStmt;
bool CreateDirective = true;
- {
+ if (HasAssociatedStatement) {
// The body is a block scope like in Lambdas and Blocks.
Sema::CompoundScopeRAII CompoundScope(Actions);
Actions.ActOnOpenMPRegionStart(DKind, getCurScope());
OpenPOWER on IntegriCloud