Clang fails to diagnose cases such as
#pragma omp target
while(0) {
#pragma omp teams
{}
}
A patch by David Sheinkman.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@273908
91177308-0d34-0410-b5e6-
96231b3b80d8
}
assert(I != CS->body_end() && "Not found statement");
S = *I;
+ } else {
+ auto *OED = dyn_cast<OMPExecutableDirective>(S);
+ OMPTeamsFound = OED && isOpenMPTeamsDirective(OED->getDirectiveKind());
}
if (!OMPTeamsFound) {
Diag(StartLoc, diag::err_omp_target_contains_not_only_teams);
#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