[flang-commits] [flang] [flang] Mpve ResolveAccParts and ResolveOmpParts into better location… (PR #193497)

Krzysztof Parzyszek via flang-commits flang-commits at lists.llvm.org
Wed Apr 22 06:28:56 PDT 2026


https://github.com/kparzysz created https://github.com/llvm/llvm-project/pull/193497

…, NFC

These two functions, which are the entry points into the framework- specific symbol resolution, somehow ended up in between OpenMP functions. Move them to immediately after the visitor classes that they rely on. Hopefully that will prevent them from drifting into obscure places again.

>From 019920b5e218b08e8d7be9091b14375138b98625 Mon Sep 17 00:00:00 2001
From: Krzysztof Parzyszek <Krzysztof.Parzyszek at amd.com>
Date: Wed, 22 Apr 2026 08:22:49 -0500
Subject: [PATCH] [flang] Mpve ResolveAccParts and ResolveOmpParts into better
 location, NFC

These two functions, which are the entry points into the framework-
specific symbol resolution, somehow ended up in between OpenMP functions.
Move them to immediately after the visitor classes that they rely on.
Hopefully that will prevent them from drifting into obscure places again.
---
 flang/lib/Semantics/resolve-directives.cpp | 44 +++++++++++-----------
 1 file changed, 22 insertions(+), 22 deletions(-)

diff --git a/flang/lib/Semantics/resolve-directives.cpp b/flang/lib/Semantics/resolve-directives.cpp
index 9ba494a1b2821..5bd5b980eb3c5 100644
--- a/flang/lib/Semantics/resolve-directives.cpp
+++ b/flang/lib/Semantics/resolve-directives.cpp
@@ -1165,6 +1165,28 @@ class OmpAttributeVisitor : DirectiveAttributeVisitor<llvm::omp::Directive> {
   }
 };
 
+void ResolveAccParts(SemanticsContext &context, const parser::ProgramUnit &node,
+    Scope *topScope) {
+  if (context.IsEnabled(common::LanguageFeature::OpenACC)) {
+    AccAttributeVisitor{context, topScope}.Walk(node);
+  }
+}
+
+void ResolveOmpParts(
+    SemanticsContext &context, const parser::ProgramUnit &node) {
+  if (context.IsEnabled(common::LanguageFeature::OpenMP)) {
+    OmpAttributeVisitor{context}.Walk(node);
+    if (!context.AnyFatalError()) {
+      // The data-sharing attribute of the loop iteration variable for a
+      // sequential loop (2.15.1.1) can only be determined when visiting
+      // the corresponding DoConstruct, a second walk is to adjust the
+      // symbols for all the data-refs of that loop iteration variable
+      // prior to the DoConstruct.
+      OmpAttributeVisitor{context}.Walk(node);
+    }
+  }
+}
+
 template <typename T>
 bool DirectiveAttributeVisitor<T>::HasDataSharingAttributeObject(
     const Symbol &object) {
@@ -3129,28 +3151,6 @@ void OmpAttributeVisitor::CheckMultipleAppearances(
   }
 }
 
-void ResolveAccParts(SemanticsContext &context, const parser::ProgramUnit &node,
-    Scope *topScope) {
-  if (context.IsEnabled(common::LanguageFeature::OpenACC)) {
-    AccAttributeVisitor{context, topScope}.Walk(node);
-  }
-}
-
-void ResolveOmpParts(
-    SemanticsContext &context, const parser::ProgramUnit &node) {
-  if (context.IsEnabled(common::LanguageFeature::OpenMP)) {
-    OmpAttributeVisitor{context}.Walk(node);
-    if (!context.AnyFatalError()) {
-      // The data-sharing attribute of the loop iteration variable for a
-      // sequential loop (2.15.1.1) can only be determined when visiting
-      // the corresponding DoConstruct, a second walk is to adjust the
-      // symbols for all the data-refs of that loop iteration variable
-      // prior to the DoConstruct.
-      OmpAttributeVisitor{context}.Walk(node);
-    }
-  }
-}
-
 static bool IsSymbolThreadprivate(const Symbol &symbol) {
   const Symbol &ultimate{symbol.GetUltimate()};
 



More information about the flang-commits mailing list