Skip to content

Commit

Permalink
[OPENMP50]Fix the checks for the nesting of scan directives.
Browse files Browse the repository at this point in the history
Fixed the check for the orhaned scan directives and improved checks for
parallel for and parallel for simd directives.
  • Loading branch information
alexey-bataev committed Mar 26, 2020
1 parent aff75e1 commit 2a43a16
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 53 deletions.
5 changes: 3 additions & 2 deletions clang/include/clang/Basic/DiagnosticSemaKinds.td
Expand Up @@ -9863,7 +9863,7 @@ def err_omp_prohibited_region : Error<
"; perhaps you forget to enclose 'omp %3' directive into a for or a parallel for region with 'ordered' clause?|"
"; perhaps you forget to enclose 'omp %3' directive into a target region?|"
"; perhaps you forget to enclose 'omp %3' directive into a teams region?|"
"; perhaps you forget to enclose 'omp %3' directive into a for, simd, or for simd region?}2">;
"; perhaps you forget to enclose 'omp %3' directive into a for, simd, for simd, parallel for, or parallel for simd region?}2">;
def err_omp_prohibited_region_simd : Error<
"OpenMP constructs may not be nested inside a simd region%select{| except for ordered simd, simd, scan, or atomic directive}0">;
def err_omp_prohibited_region_atomic : Error<
Expand Down Expand Up @@ -10060,7 +10060,8 @@ def warn_omp_nesting_simd : Warning<
InGroup<SourceUsesOpenMP>;
def err_omp_orphaned_device_directive : Error<
"orphaned 'omp %0' directives are prohibited"
"; perhaps you forget to enclose the directive into a %select{|||target |teams|for, simd, or for simd }1region?">;
"; perhaps you forget to enclose the directive into a "
"%select{|||target |teams|for, simd, for simd, parallel for, or parallel for simd }1region?">;
def err_omp_reduction_non_addressable_expression : Error<
"expected addressable reduction item for the task-based directives">;
def err_omp_reduction_with_nogroup : Error<
Expand Down
5 changes: 3 additions & 2 deletions clang/lib/Sema/SemaOpenMP.cpp
Expand Up @@ -4177,7 +4177,7 @@ static bool checkNestingOfRegions(Sema &SemaRef, const DSAStackTy *Stack,
if (ParentRegion == OMPD_unknown &&
!isOpenMPNestingTeamsDirective(CurrentRegion) &&
CurrentRegion != OMPD_cancellation_point &&
CurrentRegion != OMPD_cancel)
CurrentRegion != OMPD_cancel && CurrentRegion != OMPD_scan)
return false;
if (CurrentRegion == OMPD_cancellation_point ||
CurrentRegion == OMPD_cancel) {
Expand Down Expand Up @@ -4298,7 +4298,8 @@ static bool checkNestingOfRegions(Sema &SemaRef, const DSAStackTy *Stack,
NestingProhibited =
SemaRef.LangOpts.OpenMP < 50 ||
(ParentRegion != OMPD_simd && ParentRegion != OMPD_for &&
ParentRegion != OMPD_for_simd);
ParentRegion != OMPD_for_simd && ParentRegion != OMPD_parallel_for &&
ParentRegion != OMPD_parallel_for_simd);
OrphanSeen = ParentRegion == OMPD_unknown;
Recommend = ShouldBeInLoopSimdRegion;
}
Expand Down

0 comments on commit 2a43a16

Please sign in to comment.