davidsh created this revision. davidsh added reviewers: kkwli0, hubert.reinterpretcast. davidsh added a subscriber: cfe-commits.
Clang fails to diagnose cases such as #pragma omp target while(0) { #pragma omp teams {} } http://reviews.llvm.org/D21617 Files: lib/Sema/SemaOpenMP.cpp 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: 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