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

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


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-flang-parser

Author: Krzysztof Parzyszek (kparzysz)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/194638.diff


2 Files Affected:

- (modified) flang/include/flang/Parser/openmp-utils.h (-22) 
- (modified) flang/lib/Parser/openmp-utils.cpp (+22) 


``````````diff
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(

``````````

</details>


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


More information about the flang-commits mailing list