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

via flang-commits flang-commits at lists.llvm.org
Tue Apr 28 07:29:36 PDT 2026


Author: Krzysztof Parzyszek
Date: 2026-04-28T09:29:31-05:00
New Revision: 268bac6c2519a94f4ae515e2db540adf7f368621

URL: https://github.com/llvm/llvm-project/commit/268bac6c2519a94f4ae515e2db540adf7f368621
DIFF: https://github.com/llvm/llvm-project/commit/268bac6c2519a94f4ae515e2db540adf7f368621.diff

LOG: [flang][OpenMP] Move implementation detail from header to source, NFC (#194638)

Added: 
    

Modified: 
    flang/include/flang/Parser/openmp-utils.h
    flang/lib/Parser/openmp-utils.cpp

Removed: 
    


################################################################################
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