diff options
author | Alexey Bataev <a.bataev@hotmail.com> | 2015-09-03 07:23:48 +0000 |
---|---|---|
committer | Alexey Bataev <a.bataev@hotmail.com> | 2015-09-03 07:23:48 +0000 |
commit | 878fd7ec174af3cbfb26977ca93d98dd0f8280f3 (patch) | |
tree | 2c52d099d0c74eec15f994099ec8cb8cfaa94914 /test/OpenMP/parallel_if_messages.cpp | |
parent | fbd2901a30d987614df74465e21879e268f2d3ea (diff) |
[OPENMP 4.1] Parsing/sema analysis for extended format of 'if' clause.
OpenMP 4.1 added special 'directive-name-modifier' to the 'if' clause.
Format of 'if' clause is as follows:
```
if([ directive-name-modifier :] scalar-logical-expression)
```
The restriction rules are also changed.
1. If any 'if' clause on the directive includes a 'directive-name-modifier' then all 'if' clauses on the directive must include a 'directive-name-modifier'.
2. At most one 'if' clause without a 'directive-name-modifier' can appear on the directive.
3. At most one 'if' clause with some particular 'directive-name-modifier' can appear on the directive.
'directive-name-modifier' is important for combined directives and allows to separate conditions in 'if' clause for simple sub-directives in combined directive. This 'directive-name-modifier' identifies the sub-directive to which this 'if' clause must be applied.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@246747 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/OpenMP/parallel_if_messages.cpp')
-rw-r--r-- | test/OpenMP/parallel_if_messages.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/OpenMP/parallel_if_messages.cpp b/test/OpenMP/parallel_if_messages.cpp index 97096dfae3..bba2861e64 100644 --- a/test/OpenMP/parallel_if_messages.cpp +++ b/test/OpenMP/parallel_if_messages.cpp @@ -22,6 +22,13 @@ int tmain(T argc, S **argv) { #pragma omp parallel if (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}} #pragma omp parallel if (argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}} #pragma omp parallel if(argc) + #pragma omp parallel if(parallel // expected-warning {{missing ':' after directive name modifier - ignoring}} expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} + #pragma omp parallel if(parallel : // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} + #pragma omp parallel if(parallel : argc // expected-error {{expected ')'}} expected-note {{to match this '('}} + #pragma omp parallel if(parallel : argc) + #pragma omp parallel if(parallel : argc) if (for:argc) // expected-error {{directive name modifier 'for' is not allowed for '#pragma omp parallel'}} + #pragma omp parallel if(parallel : argc) if (parallel:argc) // expected-error {{directive '#pragma omp parallel' cannot contain more than one 'if' clause with 'parallel' name modifier}} + #pragma omp parallel if(parallel : argc) if (argc) // expected-error {{no more 'if' clause is allowed}} foo(); return 0; @@ -40,6 +47,13 @@ int main(int argc, char **argv) { #pragma omp parallel if (argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}} #pragma omp parallel if (1 0) // expected-error {{expected ')'}} expected-note {{to match this '('}} #pragma omp parallel if(if(tmain(argc, argv) // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} + #pragma omp parallel if(parallel // expected-warning {{missing ':' after directive name modifier - ignoring}} expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} + #pragma omp parallel if(parallel : // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} + #pragma omp parallel if(parallel : argc // expected-error {{expected ')'}} expected-note {{to match this '('}} + #pragma omp parallel if(parallel : argc) + #pragma omp parallel if(parallel : argc) if (for:argc) // expected-error {{directive name modifier 'for' is not allowed for '#pragma omp parallel'}} + #pragma omp parallel if(parallel : argc) if (parallel:argc) // expected-error {{directive '#pragma omp parallel' cannot contain more than one 'if' clause with 'parallel' name modifier}} + #pragma omp parallel if(parallel : argc) if (argc) // expected-error {{no more 'if' clause is allowed}} foo(); return tmain(argc, argv); |