[flang-commits] [flang] [flang][OpenMP] Move implementation detail from header to source, NFC (PR #194638)

Krzysztof Parzyszek via flang-commits flang-commits at lists.llvm.org
Tue Apr 28 07:13:20 PDT 2026


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

None

>From cf2708f6137afe8878bb396e24470f21c9c472f8 Mon Sep 17 00:00:00 2001
From: Krzysztof Parzyszek <Krzysztof.Parzyszek at amd.com>
Date: Tue, 28 Apr 2026 09:11:51 -0500
Subject: [PATCH] [flang][OpenMP] Move implementation detail from header to
 source, NFC

---
 flang/include/flang/Parser/openmp-utils.h | 22 ----------------------
 flang/lib/Parser/openmp-utils.cpp         | 22 ++++++++++++++++++++++
 2 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/flang/include/flang/Parser/openmp-utils.h b/flang/include/flang/Parser/openmp-utils.h
index 482fd77799689..1952c4297f828 100644
--- a/flang/include/flang/Parser/openmp-utils.h
+++ b/flang/include/flang/Parser/openmp-utils.h
@@ -44,28 +44,6 @@ std::optional<parser::CharBlock> GetObjectSource(
     const parser::OmpObject &object);
 const parser::OmpObject *GetArgumentObject(const parser::OmpArgument &argument);
 
-namespace detail {
-struct DirectiveSpecificationScope {
-  using ODS = OmpDirectiveSpecification;
-  template <typename T> static const ODS &GetODS(const T &x) {
-    if constexpr ( //
-        std::is_base_of_v<OmpBlockConstruct, T> ||
-        std::is_same_v<OpenMPSectionsConstruct, T>) {
-      return x.BeginDir();
-    } else if constexpr (WrapperTrait<T>) {
-      return GetODS(x.v);
-    } else if constexpr (UnionTrait<T>) {
-      return std::visit(
-          [](auto &&s) -> decltype(auto) { return GetODS(s); }, x.u);
-    } else {
-      static_assert(std::is_same_v<OpenMPSectionConstruct, T>);
-      llvm_unreachable("This function does not work for SECTION");
-    }
-  }
-  static inline const ODS &GetODS(const ODS &x) { return x; }
-};
-} // namespace detail
-
 const OmpDirectiveSpecification &GetOmpDirectiveSpecification(
     const OpenMPConstruct &x);
 const OmpDirectiveSpecification &GetOmpDirectiveSpecification(
diff --git a/flang/lib/Parser/openmp-utils.cpp b/flang/lib/Parser/openmp-utils.cpp
index ac34853ad6a75..b1824d13b2dab 100644
--- a/flang/lib/Parser/openmp-utils.cpp
+++ b/flang/lib/Parser/openmp-utils.cpp
@@ -66,6 +66,28 @@ const parser::OmpObject *GetArgumentObject(
   return nullptr;
 }
 
+namespace detail {
+struct DirectiveSpecificationScope {
+  using ODS = OmpDirectiveSpecification;
+  template <typename T> static const ODS &GetODS(const T &x) {
+    if constexpr ( //
+        std::is_base_of_v<OmpBlockConstruct, T> ||
+        std::is_same_v<OpenMPSectionsConstruct, T>) {
+      return x.BeginDir();
+    } else if constexpr (WrapperTrait<T>) {
+      return GetODS(x.v);
+    } else if constexpr (UnionTrait<T>) {
+      return std::visit(
+          [](auto &&s) -> decltype(auto) { return GetODS(s); }, x.u);
+    } else {
+      static_assert(std::is_same_v<OpenMPSectionConstruct, T>);
+      llvm_unreachable("This function does not work for SECTION");
+    }
+  }
+  static inline const ODS &GetODS(const ODS &x) { return x; }
+};
+} // namespace detail
+
 const OmpDirectiveSpecification &GetOmpDirectiveSpecification(
     const OpenMPConstruct &x) {
   return std::visit(



More information about the flang-commits mailing list