davidsh updated this revision to Diff 61612. http://reviews.llvm.org/D21617
Files: lib/Sema/SemaOpenMP.cpp test/OpenMP/nesting_of_regions.cpp Index: test/OpenMP/nesting_of_regions.cpp =================================================================== --- test/OpenMP/nesting_of_regions.cpp +++ test/OpenMP/nesting_of_regions.cpp @@ -2867,6 +2867,12 @@ #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}} + { + while (0) // expected-note {{statement outside teams construct here}} +#pragma omp teams // expected-note {{nested teams construct here}} + ++a; + } #pragma omp target { #pragma omp taskloop Index: lib/Sema/SemaOpenMP.cpp =================================================================== --- lib/Sema/SemaOpenMP.cpp +++ lib/Sema/SemaOpenMP.cpp @@ -6380,6 +6380,10 @@ } assert(I != CS->body_end() && "Not found statement"); S = *I; + } else { + auto *OED = dyn_cast<OMPExecutableDirective>(S); + if (!OED || !isOpenMPTeamsDirective(OED->getDirectiveKind())) + OMPTeamsFound = false; } if (!OMPTeamsFound) { Diag(StartLoc, diag::err_omp_target_contains_not_only_teams);
Index: test/OpenMP/nesting_of_regions.cpp =================================================================== --- test/OpenMP/nesting_of_regions.cpp +++ test/OpenMP/nesting_of_regions.cpp @@ -2867,6 +2867,12 @@ #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}} + { + while (0) // expected-note {{statement outside teams construct here}} +#pragma omp teams // expected-note {{nested teams construct here}} + ++a; + } #pragma omp target { #pragma omp taskloop Index: lib/Sema/SemaOpenMP.cpp =================================================================== --- lib/Sema/SemaOpenMP.cpp +++ lib/Sema/SemaOpenMP.cpp @@ -6380,6 +6380,10 @@ } assert(I != CS->body_end() && "Not found statement"); S = *I; + } else { + auto *OED = dyn_cast<OMPExecutableDirective>(S); + if (!OED || !isOpenMPTeamsDirective(OED->getDirectiveKind())) + OMPTeamsFound = false; } if (!OMPTeamsFound) { Diag(StartLoc, diag::err_omp_target_contains_not_only_teams);
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits