-
Notifications
You must be signed in to change notification settings - Fork 14.5k
[clang] Add error note when if clause is used on teams before 5.2. #65686
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Windows buildbot looks stuck. Merging this. |
@llvm/pr-subscribers-clang Author: Shraiysh (shraiysh) Changes
Full diff: https://github.com/llvm/llvm-project/pull/65686.diff 2 Files Affected:
diff --git a/clang/test/OpenMP/teams_default_messages.cpp b/clang/test/OpenMP/teams_default_messages.cpp
index 6afc5576d8341..9131a088adb4a 100644
--- a/clang/test/OpenMP/teams_default_messages.cpp
+++ b/clang/test/OpenMP/teams_default_messages.cpp
@@ -1,6 +1,6 @@
-// RUN: %clang_cc1 -verify -fopenmp -DOMP51 -o - %s -Wuninitialized
+// RUN: %clang_cc1 -verify -fopenmp-version=51 -fopenmp -DOMP51 -o - %s -Wuninitialized
-// RUN: %clang_cc1 -verify -fopenmp-simd -DOMP51 -o - %s -Wuninitialized
+// RUN: %clang_cc1 -verify -fopenmp-version=51 -fopenmp-simd -DOMP51 -o - %s -Wuninitialized
// RUN: %clang_cc1 -verify -fopenmp-version=50 -fopenmp -o - %s -Wuninitialized
@@ -42,6 +42,9 @@ int main(int argc, char **argv) {
#pragma omp parallel default(shared)
++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
+ #pragma omp teams if(x) // expected-error {{unexpected OpenMP clause 'if' in directive '#pragma omp teams'}}
+ foo();
+
#ifdef OMP51
#pragma omp target
#pragma omp teams default(firstprivate) // expected-note 2 {{explicit data sharing attribute requested here}}
@@ -55,6 +58,9 @@ int main(int argc, char **argv) {
++x; // expected-error {{variable 'x' must have explicitly specified data sharing attributes}}
++y; // expected-error {{variable 'y' must have explicitly specified data sharing attributes}}
}
+#pragma omp teams if(x) // expected-error {{unexpected OpenMP clause 'if' in directive '#pragma omp teams'}}
+ foo();
+
#endif
return 0;
}
diff --git a/llvm/include/llvm/Frontend/OpenMP/OMP.td b/llvm/include/llvm/Frontend/OpenMP/OMP.td
index b6639b67a5c52..1aaddcaf3969d 100644
--- a/llvm/include/llvm/Frontend/OpenMP/OMP.td
+++ b/llvm/include/llvm/Frontend/OpenMP/OMP.td
@@ -672,7 +672,7 @@ def OMP_Teams : Directive<"teams"> {
];
let allowedOnceClauses = [
VersionedClause<OMPC_Default>,
- VersionedClause<OMPC_If>,
+ VersionedClause<OMPC_If, 52>,
VersionedClause<OMPC_NumTeams>,
VersionedClause<OMPC_ThreadLimit>
];
|
@llvm/pr-subscribers-openmp Author: Shraiysh (shraiysh) Changes
Full diff: https://github.com/llvm/llvm-project/pull/65686.diff 2 Files Affected:
diff --git a/clang/test/OpenMP/teams_default_messages.cpp b/clang/test/OpenMP/teams_default_messages.cpp
index 6afc5576d8341..9131a088adb4a 100644
--- a/clang/test/OpenMP/teams_default_messages.cpp
+++ b/clang/test/OpenMP/teams_default_messages.cpp
@@ -1,6 +1,6 @@
-// RUN: %clang_cc1 -verify -fopenmp -DOMP51 -o - %s -Wuninitialized
+// RUN: %clang_cc1 -verify -fopenmp-version=51 -fopenmp -DOMP51 -o - %s -Wuninitialized
-// RUN: %clang_cc1 -verify -fopenmp-simd -DOMP51 -o - %s -Wuninitialized
+// RUN: %clang_cc1 -verify -fopenmp-version=51 -fopenmp-simd -DOMP51 -o - %s -Wuninitialized
// RUN: %clang_cc1 -verify -fopenmp-version=50 -fopenmp -o - %s -Wuninitialized
@@ -42,6 +42,9 @@ int main(int argc, char **argv) {
#pragma omp parallel default(shared)
++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
+ #pragma omp teams if(x) // expected-error {{unexpected OpenMP clause 'if' in directive '#pragma omp teams'}}
+ foo();
+
#ifdef OMP51
#pragma omp target
#pragma omp teams default(firstprivate) // expected-note 2 {{explicit data sharing attribute requested here}}
@@ -55,6 +58,9 @@ int main(int argc, char **argv) {
++x; // expected-error {{variable 'x' must have explicitly specified data sharing attributes}}
++y; // expected-error {{variable 'y' must have explicitly specified data sharing attributes}}
}
+#pragma omp teams if(x) // expected-error {{unexpected OpenMP clause 'if' in directive '#pragma omp teams'}}
+ foo();
+
#endif
return 0;
}
diff --git a/llvm/include/llvm/Frontend/OpenMP/OMP.td b/llvm/include/llvm/Frontend/OpenMP/OMP.td
index b6639b67a5c52..1aaddcaf3969d 100644
--- a/llvm/include/llvm/Frontend/OpenMP/OMP.td
+++ b/llvm/include/llvm/Frontend/OpenMP/OMP.td
@@ -672,7 +672,7 @@ def OMP_Teams : Directive<"teams"> {
];
let allowedOnceClauses = [
VersionedClause<OMPC_Default>,
- VersionedClause<OMPC_If>,
+ VersionedClause<OMPC_If, 52>,
VersionedClause<OMPC_NumTeams>,
VersionedClause<OMPC_ThreadLimit>
];
|
if
clause is valid with openmp >= 5.2. It is not supported yet.