Skip to content

Commit d211ad3

Browse files
authored
[clang] Add error note when if clause is used on teams before 5.2. (#65686)
`if` clause is valid with openmp >= 5.2. It is not supported yet.
1 parent bede46f commit d211ad3

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

clang/test/OpenMP/teams_default_messages.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
// RUN: %clang_cc1 -verify -fopenmp -DOMP51 -o - %s -Wuninitialized
1+
// RUN: %clang_cc1 -verify -fopenmp-version=51 -fopenmp -DOMP51 -o - %s -Wuninitialized
22

3-
// RUN: %clang_cc1 -verify -fopenmp-simd -DOMP51 -o - %s -Wuninitialized
3+
// RUN: %clang_cc1 -verify -fopenmp-version=51 -fopenmp-simd -DOMP51 -o - %s -Wuninitialized
44

55
// RUN: %clang_cc1 -verify -fopenmp-version=50 -fopenmp -o - %s -Wuninitialized
66

@@ -42,6 +42,9 @@ int main(int argc, char **argv) {
4242
#pragma omp parallel default(shared)
4343
++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
4444

45+
#pragma omp teams if(x) // expected-error {{unexpected OpenMP clause 'if' in directive '#pragma omp teams'}}
46+
foo();
47+
4548
#ifdef OMP51
4649
#pragma omp target
4750
#pragma omp teams default(firstprivate) // expected-note 2 {{explicit data sharing attribute requested here}}
@@ -55,6 +58,9 @@ int main(int argc, char **argv) {
5558
++x; // expected-error {{variable 'x' must have explicitly specified data sharing attributes}}
5659
++y; // expected-error {{variable 'y' must have explicitly specified data sharing attributes}}
5760
}
61+
#pragma omp teams if(x) // expected-error {{unexpected OpenMP clause 'if' in directive '#pragma omp teams'}}
62+
foo();
63+
5864
#endif
5965
return 0;
6066
}

llvm/include/llvm/Frontend/OpenMP/OMP.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,7 @@ def OMP_Teams : Directive<"teams"> {
672672
];
673673
let allowedOnceClauses = [
674674
VersionedClause<OMPC_Default>,
675-
VersionedClause<OMPC_If>,
675+
VersionedClause<OMPC_If, 52>,
676676
VersionedClause<OMPC_NumTeams>,
677677
VersionedClause<OMPC_ThreadLimit>
678678
];

0 commit comments

Comments
 (0)