[flang-commits] [flang] [flang][OpenMP] Implement loop construct iterator range (PR #170734)

via flang-commits flang-commits at lists.llvm.org
Thu Dec 4 12:17:30 PST 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp,h -- flang/include/flang/Parser/openmp-utils.h flang/lib/Parser/openmp-utils.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/flang/include/flang/Parser/openmp-utils.h b/flang/include/flang/Parser/openmp-utils.h
index 27e4aa6db..c47cdb295 100644
--- a/flang/include/flang/Parser/openmp-utils.h
+++ b/flang/include/flang/Parser/openmp-utils.h
@@ -238,14 +238,13 @@ struct OmpAllocateInfo {
 OmpAllocateInfo SplitOmpAllocate(const OmpAllocateDirective &x);
 
 namespace detail {
-template <bool IsConst, typename T>
-struct ConstIf {
+template <bool IsConst, typename T> struct ConstIf {
   using type = std::conditional_t<IsConst, std::add_const_t<T>, T>;
 };
 
 template <bool IsConst, typename T>
 using ConstIfT = typename ConstIf<IsConst, T>::type;
-}
+} // namespace detail
 
 template <bool IsConst> struct LoopRange {
   using QualBlock = detail::ConstIfT<IsConst, Block>;
diff --git a/flang/lib/Parser/openmp-utils.cpp b/flang/lib/Parser/openmp-utils.cpp
index 099c7faf3..1593b19d6 100644
--- a/flang/lib/Parser/openmp-utils.cpp
+++ b/flang/lib/Parser/openmp-utils.cpp
@@ -205,8 +205,7 @@ OmpAllocateInfo SplitOmpAllocate(const OmpAllocateDirective &x) {
   return info;
 }
 
-template <bool IsConst>
-LoopRange<IsConst>::LoopRange(QualReference x) {
+template <bool IsConst> LoopRange<IsConst>::LoopRange(QualReference x) {
   if (auto *doLoop{Unwrap<DoConstruct>(x)}) {
     Initialize(std::get<Block>(doLoop->t));
   } else if (auto *omp{Unwrap<OpenMPLoopConstruct>(x)}) {
@@ -214,8 +213,7 @@ LoopRange<IsConst>::LoopRange(QualReference x) {
   }
 }
 
-template <bool IsConst>
-void LoopRange<IsConst>::Initialize(QualBlock &body) {
+template <bool IsConst> void LoopRange<IsConst>::Initialize(QualBlock &body) {
   using QualIterator = decltype(std::declval<QualBlock>().begin());
   auto makeRange{[](auto &container) {
     return llvm::make_range(container.begin(), container.end());

``````````

</details>


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


More information about the flang-commits mailing list