[flang-commits] [flang] [llvm] [Flang][OpenMP][Sema] Adding parsing and semantic support for scan directive. (PR #102792)

Anchu Rajendran S via flang-commits flang-commits at lists.llvm.org
Wed Sep 11 10:12:02 PDT 2024


================
@@ -550,17 +551,23 @@ void OmpStructureChecker::CheckSIMDNest(const parser::OpenMPConstruct &c) {
                         }
                       }
                     },
-                    [&](const parser::OpenMPSimpleStandaloneConstruct &c) {
-                      const auto &dir{
-                          std::get<parser::OmpSimpleStandaloneDirective>(c.t)};
-                      if (dir.v == llvm::omp::Directive::OMPD_ordered) {
-                        const auto &clauses{
-                            std::get<parser::OmpClauseList>(c.t)};
-                        for (const auto &clause : clauses.v) {
-                          if (std::get_if<parser::OmpClause::Simd>(&clause.u)) {
-                            eligibleSIMD = true;
-                            break;
+                    [&](const parser::OpenMPStandaloneConstruct &c) {
+                      if (const auto &simpleConstruct =
+                              std::get_if<parser::OpenMPSimpleStandaloneConstruct>(
+                                  &c.u)) {
+                        const auto &dir{std::get<parser::OmpSimpleStandaloneDirective>(
+                            simpleConstruct->t)};
+                        if (dir.v == llvm::omp::Directive::OMPD_ordered) {
+                          const auto &clauses{
+                              std::get<parser::OmpClauseList>(simpleConstruct->t)};
+                          for (const auto &clause : clauses.v) {
+                            if (std::get_if<parser::OmpClause::Simd>(&clause.u)) {
+                              eligibleSIMD = true;
+                              break;
+                            }
                           }
+                        } else if (dir.v == llvm::omp::Directive::OMPD_scan) {
+                          eligibleSIMD = true;
----------------
anchuraj wrote:

 Thank you for the suggestion. If I am understanding this right, I did the same. For R2, I ignored the formatter and R3 had only formatting change. :)

https://github.com/llvm/llvm-project/pull/102792


More information about the flang-commits mailing list