r353186 - [OPENMP] issue error messages for multiple teams contructs in a target construct
Kelvin Li via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 5 08:43:00 PST 2019
Author: kli
Date: Tue Feb 5 08:43:00 2019
New Revision: 353186
URL: http://llvm.org/viewvc/llvm-project?rev=353186&view=rev
Log:
[OPENMP] issue error messages for multiple teams contructs in a target construct
The fix is to issue error messages if there are more than one
teams construct inside a target constructs.
#pragma omp target
{
#pragma omp teams
{ ... }
#pragma omp teams
{ ... }
}
Modified:
cfe/trunk/lib/Sema/SemaOpenMP.cpp
cfe/trunk/test/OpenMP/nesting_of_regions.cpp
Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOpenMP.cpp?rev=353186&r1=353185&r2=353186&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOpenMP.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOpenMP.cpp Tue Feb 5 08:43:00 2019
@@ -7067,7 +7067,9 @@ StmtResult Sema::ActOnOpenMPTargetDirect
auto I = CS->body_begin();
while (I != CS->body_end()) {
const auto *OED = dyn_cast<OMPExecutableDirective>(*I);
- if (!OED || !isOpenMPTeamsDirective(OED->getDirectiveKind())) {
+ if (!OED || !isOpenMPTeamsDirective(OED->getDirectiveKind()) ||
+ OMPTeamsFound) {
+
OMPTeamsFound = false;
break;
}
Modified: cfe/trunk/test/OpenMP/nesting_of_regions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/nesting_of_regions.cpp?rev=353186&r1=353185&r2=353186&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/nesting_of_regions.cpp (original)
+++ cfe/trunk/test/OpenMP/nesting_of_regions.cpp Tue Feb 5 08:43:00 2019
@@ -4080,6 +4080,13 @@ void foo() {
}
#pragma omp target // expected-error {{target construct with nested teams region contains statements outside of the teams construct}}
{
+#pragma omp teams // expected-note {{directive outside teams construct here}}
+ ++a;
+#pragma omp teams // expected-note {{nested teams construct here}}
+ ++a;
+ }
+#pragma omp target // expected-error {{target construct with nested teams region contains statements outside of the teams construct}}
+ {
++a; // expected-note {{statement outside teams construct here}}
#pragma omp teams // expected-note {{nested teams construct here}}
++a;
@@ -12692,6 +12699,13 @@ void foo() {
++a;
}
#pragma omp target // expected-error {{target construct with nested teams region contains statements outside of the teams construct}}
+ {
+#pragma omp teams // expected-note {{directive outside teams construct here}}
+ ++a;
+#pragma omp teams // expected-note {{nested teams construct here}}
+ ++a;
+ }
+#pragma omp target // expected-error {{target construct with nested teams region contains statements outside of the teams construct}}
{
++a; // expected-note {{statement outside teams construct here}}
#pragma omp teams // expected-note {{nested teams construct here}}
More information about the cfe-commits
mailing list