@@ -748,61 +748,62 @@ void OmpStructureChecker::CheckSIMDNest(const parser::OpenMPConstruct &c) {
748
748
// current context yet.
749
749
// TODO: Check for declare simd regions.
750
750
bool eligibleSIMD{false };
751
- common::visit (Fortran::common::visitors{
752
- // Allow `!$OMP ORDERED SIMD`
753
- [&](const parser::OpenMPBlockConstruct &c) {
754
- const auto &beginBlockDir{
755
- std::get<parser::OmpBeginBlockDirective>(c.t )};
756
- const auto &beginDir{
757
- std::get<parser::OmpBlockDirective>(beginBlockDir.t )};
758
- if (beginDir.v == llvm::omp::Directive::OMPD_ordered) {
759
- const auto &clauses{
760
- std::get<parser::OmpClauseList>(beginBlockDir.t )};
761
- for (const auto &clause : clauses.v ) {
762
- if (std::get_if<parser::OmpClause::Simd>(&clause.u )) {
763
- eligibleSIMD = true ;
764
- break ;
765
- }
766
- }
767
- }
768
- },
769
- [&](const parser::OpenMPStandaloneConstruct &c) {
770
- if (const auto &simpleConstruct =
771
- std::get_if<parser::OpenMPSimpleStandaloneConstruct>(
772
- &c.u )) {
773
- const auto &dir{std::get<parser::OmpSimpleStandaloneDirective>(
774
- simpleConstruct->t )};
775
- if (dir.v == llvm::omp::Directive::OMPD_ordered) {
776
- const auto &clauses{
777
- std::get<parser::OmpClauseList>(simpleConstruct->t )};
778
- for (const auto &clause : clauses.v ) {
779
- if (std::get_if<parser::OmpClause::Simd>(&clause.u )) {
780
- eligibleSIMD = true ;
781
- break ;
782
- }
783
- }
784
- } else if (dir.v == llvm::omp::Directive::OMPD_scan) {
785
- eligibleSIMD = true ;
786
- }
787
- }
788
- },
789
- // Allowing SIMD construct
790
- [&](const parser::OpenMPLoopConstruct &c) {
791
- const auto &beginLoopDir{
792
- std::get<parser::OmpBeginLoopDirective>(c.t )};
793
- const auto &beginDir{
794
- std::get<parser::OmpLoopDirective>(beginLoopDir.t )};
795
- if ((beginDir.v == llvm::omp::Directive::OMPD_simd) ||
796
- (beginDir.v == llvm::omp::Directive::OMPD_do_simd)) {
797
- eligibleSIMD = true ;
798
- }
799
- },
800
- [&](const parser::OpenMPAtomicConstruct &c) {
801
- // Allow `!$OMP ATOMIC`
802
- eligibleSIMD = true ;
803
- },
804
- [&](const auto &c) {},
805
- },
751
+ common::visit (
752
+ Fortran::common::visitors{
753
+ // Allow `!$OMP ORDERED SIMD`
754
+ [&](const parser::OpenMPBlockConstruct &c) {
755
+ const auto &beginBlockDir{
756
+ std::get<parser::OmpBeginBlockDirective>(c.t )};
757
+ const auto &beginDir{
758
+ std::get<parser::OmpBlockDirective>(beginBlockDir.t )};
759
+ if (beginDir.v == llvm::omp::Directive::OMPD_ordered) {
760
+ const auto &clauses{
761
+ std::get<parser::OmpClauseList>(beginBlockDir.t )};
762
+ for (const auto &clause : clauses.v ) {
763
+ if (std::get_if<parser::OmpClause::Simd>(&clause.u )) {
764
+ eligibleSIMD = true ;
765
+ break ;
766
+ }
767
+ }
768
+ }
769
+ },
770
+ [&](const parser::OpenMPStandaloneConstruct &c) {
771
+ if (const auto &simpleConstruct =
772
+ std::get_if<parser::OpenMPSimpleStandaloneConstruct>(
773
+ &c.u )) {
774
+ const auto &dir{std::get<parser::OmpSimpleStandaloneDirective>(
775
+ simpleConstruct->t )};
776
+ if (dir.v == llvm::omp::Directive::OMPD_ordered) {
777
+ const auto &clauses{
778
+ std::get<parser::OmpClauseList>(simpleConstruct->t )};
779
+ for (const auto &clause : clauses.v ) {
780
+ if (std::get_if<parser::OmpClause::Simd>(&clause.u )) {
781
+ eligibleSIMD = true ;
782
+ break ;
783
+ }
784
+ }
785
+ } else if (dir.v == llvm::omp::Directive::OMPD_scan) {
786
+ eligibleSIMD = true ;
787
+ }
788
+ }
789
+ },
790
+ // Allowing SIMD construct
791
+ [&](const parser::OpenMPLoopConstruct &c) {
792
+ const auto &beginLoopDir{
793
+ std::get<parser::OmpBeginLoopDirective>(c.t )};
794
+ const auto &beginDir{
795
+ std::get<parser::OmpLoopDirective>(beginLoopDir.t )};
796
+ if ((beginDir.v == llvm::omp::Directive::OMPD_simd) ||
797
+ (beginDir.v == llvm::omp::Directive::OMPD_do_simd)) {
798
+ eligibleSIMD = true ;
799
+ }
800
+ },
801
+ [&](const parser::OpenMPAtomicConstruct &c) {
802
+ // Allow `!$OMP ATOMIC`
803
+ eligibleSIMD = true ;
804
+ },
805
+ [&](const auto &c) {},
806
+ },
806
807
c.u );
807
808
if (!eligibleSIMD) {
808
809
context_.Say (parser::FindSourceLocation (c),
0 commit comments