[flang-commits] [flang] 6b04214 - [flang][OpenMP] Import ExecutionPartIterator et al into semantics::om… (#185288)
via flang-commits
flang-commits at lists.llvm.org
Mon Mar 9 05:31:13 PDT 2026
Author: Krzysztof Parzyszek
Date: 2026-03-09T07:31:09-05:00
New Revision: 6b0421426e083a915350fc9d3a2edc75621b0799
URL: https://github.com/llvm/llvm-project/commit/6b0421426e083a915350fc9d3a2edc75621b0799
DIFF: https://github.com/llvm/llvm-project/commit/6b0421426e083a915350fc9d3a2edc75621b0799.diff
LOG: [flang][OpenMP] Import ExecutionPartIterator et al into semantics::om… (#185288)
…p, NFC
Issue: https://github.com/llvm/llvm-project/issues/185287
Added:
Modified:
flang/include/flang/Semantics/openmp-utils.h
flang/lib/Semantics/check-omp-loop.cpp
Removed:
################################################################################
diff --git a/flang/include/flang/Semantics/openmp-utils.h b/flang/include/flang/Semantics/openmp-utils.h
index 90fd36708de0e..9e353366cb9b4 100644
--- a/flang/include/flang/Semantics/openmp-utils.h
+++ b/flang/include/flang/Semantics/openmp-utils.h
@@ -27,6 +27,14 @@
#include <type_traits>
#include <utility>
+namespace Fortran::parser::omp {
+struct ExecutionPartIterator;
+struct LoopNestIterator;
+template <typename T> struct ExecutionPartRange;
+using BlockRange = ExecutionPartRange<ExecutionPartIterator>;
+using LoopRange = ExecutionPartRange<LoopNestIterator>;
+} // namespace Fortran::parser::omp
+
namespace Fortran::semantics {
class Scope;
class SemanticsContext;
@@ -34,6 +42,11 @@ class Symbol;
// Add this namespace to avoid potential conflicts
namespace omp {
+using Fortran::parser::omp::BlockRange;
+using Fortran::parser::omp::ExecutionPartIterator;
+using Fortran::parser::omp::LoopNestIterator;
+using Fortran::parser::omp::LoopRange;
+
template <typename T, typename U = std::remove_const_t<T>> U AsRvalue(T &t) {
return U(t);
}
diff --git a/flang/lib/Semantics/check-omp-loop.cpp b/flang/lib/Semantics/check-omp-loop.cpp
index f81bde981594d..e13ea820c7ef6 100644
--- a/flang/lib/Semantics/check-omp-loop.cpp
+++ b/flang/lib/Semantics/check-omp-loop.cpp
@@ -334,7 +334,6 @@ static std::optional<size_t> CountGeneratedNests(const parser::Block &block) {
// messages about a potentially incorrect loop count.
// In such cases reset the count to nullopt. Once it becomes nullopt,
// keep it that way.
- using LoopRange = parser::omp::LoopRange;
std::optional<size_t> numLoops{0};
for (auto &epc : LoopRange(block, LoopRange::Step::Over)) {
if (auto genCount{CountGeneratedNests(epc)}) {
@@ -371,7 +370,6 @@ void OmpStructureChecker::CheckNestedConstruct(
// Check constructs contained in the body of the loop construct.
auto &body{std::get<parser::Block>(x.t)};
- using BlockRange = parser::omp::BlockRange;
for (auto &stmt : BlockRange(body, BlockRange::Step::Over)) {
if (auto *dir{parser::Unwrap<parser::CompilerDirective>(stmt)}) {
context_.Say(dir->source,
@@ -495,7 +493,6 @@ void OmpStructureChecker::SetLoopInfo(const parser::OpenMPLoopConstruct &x) {
void OmpStructureChecker::CheckIterationVariableType(
const parser::OpenMPLoopConstruct &x) {
- using LoopRange = parser::omp::LoopRange;
auto &body{std::get<parser::Block>(x.t)};
for (auto &construct : LoopRange(body, LoopRange::Step::Into)) {
// 'construct' can also be OpenMPLoopConstruct
More information about the flang-commits
mailing list