[OPENMP 4.1] Initial support for extended 'ordered' clause.
OpenMP 4.1 introduces optional argument '(n)' for 'ordered' clause, where 'n' is a number of loops that immediately follow the directive.
'n' must be constant positive integer expressions and it must be less or equal than the number of the loops in the resulting loop nest.
Patch adds parsing and semantic analysis for this optional argument.
llvm-svn: 243635
diff --git a/clang/lib/Parse/ParseOpenMP.cpp b/clang/lib/Parse/ParseOpenMP.cpp
index 2234f13..1266e44 100644
--- a/clang/lib/Parse/ParseOpenMP.cpp
+++ b/clang/lib/Parse/ParseOpenMP.cpp
@@ -415,6 +415,7 @@
case OMPC_num_threads:
case OMPC_safelen:
case OMPC_collapse:
+ case OMPC_ordered:
// OpenMP [2.5, Restrictions]
// At most one if clause can appear on the directive.
// At most one num_threads clause can appear on the directive.
@@ -430,7 +431,10 @@
ErrorFound = true;
}
- Clause = ParseOpenMPSingleExprClause(CKind);
+ if (CKind == OMPC_ordered && PP.LookAhead(/*N=*/0).isNot(tok::l_paren))
+ Clause = ParseOpenMPClause(CKind);
+ else
+ Clause = ParseOpenMPSingleExprClause(CKind);
break;
case OMPC_default:
case OMPC_proc_bind:
@@ -458,7 +462,6 @@
Clause = ParseOpenMPSingleExprWithArgClause(CKind);
break;
- case OMPC_ordered:
case OMPC_nowait:
case OMPC_untied:
case OMPC_mergeable: