Skip to content

[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

Merged
merged 1 commit into from
Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions clang/test/OpenMP/teams_default_messages.cpp
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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}}
Expand All @@ -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;
}
2 changes: 1 addition & 1 deletion llvm/include/llvm/Frontend/OpenMP/OMP.td
Original file line number Diff line number Diff line change
Expand Up @@ -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>
];
Expand Down