From d893374b85b0469e36b6603849c021c98b64684c Mon Sep 17 00:00:00 2001 From: Krzysztof Parzyszek Date: Wed, 25 Mar 2026 11:12:24 -0500 Subject: [PATCH] [flang][OpenMP] Rename GetAllDesignators to GetTopLevelDesignators, NFC (#188520) The function collects all top-level designators. Emphasize the "top level" part for clarity. --- flang/include/flang/Semantics/openmp-utils.h | 2 +- flang/lib/Semantics/check-omp-atomic.cpp | 2 +- flang/lib/Semantics/openmp-utils.cpp | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/flang/include/flang/Semantics/openmp-utils.h b/flang/include/flang/Semantics/openmp-utils.h index d48de055b926..c29cc4e3a33e 100644 --- a/flang/include/flang/Semantics/openmp-utils.h +++ b/flang/include/flang/Semantics/openmp-utils.h @@ -105,7 +105,7 @@ std::optional GetLogicalValue(const SomeExpr &expr); std::optional IsContiguous( SemanticsContext &semaCtx, const parser::OmpObject &object); -std::vector GetAllDesignators(const SomeExpr &expr); +std::vector GetTopLevelDesignators(const SomeExpr &expr); const SomeExpr *HasStorageOverlap( const SomeExpr &base, llvm::ArrayRef exprs); bool IsAssignment(const parser::ActionStmt *x); diff --git a/flang/lib/Semantics/check-omp-atomic.cpp b/flang/lib/Semantics/check-omp-atomic.cpp index 2218acce9537..96a3618f782c 100644 --- a/flang/lib/Semantics/check-omp-atomic.cpp +++ b/flang/lib/Semantics/check-omp-atomic.cpp @@ -586,7 +586,7 @@ void OmpStructureChecker::CheckAtomicVariable( atom.AsFortran()); } - std::vector dsgs{GetAllDesignators(atom)}; + std::vector dsgs{GetTopLevelDesignators(atom)}; // Procedure references are valid if they return a pointer to a scalar. // Just return if we don't have exactly one designator - other checks will diff --git a/flang/lib/Semantics/openmp-utils.cpp b/flang/lib/Semantics/openmp-utils.cpp index 8149aafea18f..2a04b423f56f 100644 --- a/flang/lib/Semantics/openmp-utils.cpp +++ b/flang/lib/Semantics/openmp-utils.cpp @@ -418,7 +418,7 @@ struct DesignatorCollector : public evaluate::Traverse GetAllDesignators(const SomeExpr &expr) { +std::vector GetTopLevelDesignators(const SomeExpr &expr) { return DesignatorCollector{}(expr); } @@ -480,7 +480,7 @@ static bool HasCommonTopLevelDesignators( // Compare designators directly as expressions. This will ensure // that x(y) and x(y+1) are not flagged as overlapping, whereas // the symbol vectors for both of these would be identical. - std::vector otherDsgs{GetAllDesignators(other)}; + std::vector otherDsgs{GetTopLevelDesignators(other)}; for (auto &s : baseDsgs) { if (llvm::any_of(otherDsgs, [&](auto &&t) { return s == t; })) { @@ -493,7 +493,7 @@ static bool HasCommonTopLevelDesignators( const SomeExpr *HasStorageOverlap( const SomeExpr &base, llvm::ArrayRef exprs) { evaluate::SymbolVector baseSyms{evaluate::GetSymbolVector(base)}; - std::vector baseDsgs{GetAllDesignators(base)}; + std::vector baseDsgs{GetTopLevelDesignators(base)}; for (const SomeExpr &expr : exprs) { if (!HasCommonDesignatorSymbols(baseSyms, expr)) {