diff options
Diffstat (limited to 'clang/lib/Sema/SemaOpenMP.cpp')
-rw-r--r-- | clang/lib/Sema/SemaOpenMP.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp index 7ed582f8446..5c1b39e0b39 100644 --- a/clang/lib/Sema/SemaOpenMP.cpp +++ b/clang/lib/Sema/SemaOpenMP.cpp @@ -3799,7 +3799,10 @@ static bool checkNestingOfRegions(Sema &SemaRef, const DSAStackTy *Stack, ShouldBeInTargetRegion, ShouldBeInTeamsRegion } Recommend = NoRecommend; - if (isOpenMPSimdDirective(ParentRegion) && CurrentRegion != OMPD_ordered) { + if (isOpenMPSimdDirective(ParentRegion) && + ((SemaRef.LangOpts.OpenMP <= 45 && CurrentRegion != OMPD_ordered) || + (SemaRef.LangOpts.OpenMP >= 50 && CurrentRegion != OMPD_ordered && + CurrentRegion != OMPD_simd && CurrentRegion != OMPD_atomic))) { // OpenMP [2.16, Nesting of Regions] // OpenMP constructs may not be nested inside a simd region. // OpenMP [2.8.1,simd Construct, Restrictions] @@ -3808,9 +3811,14 @@ static bool checkNestingOfRegions(Sema &SemaRef, const DSAStackTy *Stack, // Allowing a SIMD construct nested in another SIMD construct is an // extension. The OpenMP 4.5 spec does not allow it. Issue a warning // message. + // OpenMP 5.0 [2.9.3.1, simd Construct, Restrictions] + // The only OpenMP constructs that can be encountered during execution of + // a simd region are the atomic construct, the loop construct, the simd + // construct and the ordered construct with the simd clause. SemaRef.Diag(StartLoc, (CurrentRegion != OMPD_simd) ? diag::err_omp_prohibited_region_simd - : diag::warn_omp_nesting_simd); + : diag::warn_omp_nesting_simd) + << (SemaRef.LangOpts.OpenMP >= 50 ? 1 : 0); return CurrentRegion != OMPD_simd; } if (ParentRegion == OMPD_atomic) { @@ -8165,7 +8173,8 @@ StmtResult Sema::ActOnOpenMPOrderedDirective(ArrayRef<OMPClause *> Clauses, // OpenMP [2.8.1,simd Construct, Restrictions] // An ordered construct with the simd clause is the only OpenMP construct // that can appear in the simd region. - Diag(StartLoc, diag::err_omp_prohibited_region_simd); + Diag(StartLoc, diag::err_omp_prohibited_region_simd) + << (LangOpts.OpenMP >= 50 ? 1 : 0); ErrorFound = true; } else if (DependFound && (TC || SC)) { Diag(DependFound->getBeginLoc(), diag::err_omp_depend_clause_thread_simd) |