[flang-commits] [flang] [flang][OpenMP] Rename some symbols in check-omp-syntax.cpp (PR #226484)
via flang-commits
flang-commits at lists.llvm.org
Fri Sep 25 06:21:25 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-flang-semantics
Author: Krzysztof Parzyszek (kparzysz)
<details>
<summary>Changes</summary>
Some function names did not conform to the naming convention. Include a couple of other non-significant changes.
---
Full diff: https://github.com/llvm/llvm-project/pull/226484.diff
4 Files Affected:
- (modified) flang/lib/Semantics/check-omp-structure.cpp (+1-1)
- (modified) flang/lib/Semantics/check-omp-structure.h (+2-2)
- (modified) flang/lib/Semantics/check-omp-syntax.cpp (+36-26)
- (modified) flang/lib/Semantics/check-omp-variant.cpp (+1-1)
``````````diff
diff --git a/flang/lib/Semantics/check-omp-structure.cpp b/flang/lib/Semantics/check-omp-structure.cpp
index c3fc7ced2bfdb..4f9e45d292699 100644
--- a/flang/lib/Semantics/check-omp-structure.cpp
+++ b/flang/lib/Semantics/check-omp-structure.cpp
@@ -4015,7 +4015,7 @@ void OmpStructureChecker::Leave(const parser::OmpClauseList &x) {
void OmpStructureChecker::Enter(const parser::OmpClause &x) {
SetContextClause(x);
CheckArgumentObjectKind(x);
- VerifyModifiers(x);
+ VerifyModifierSyntax(x);
}
// Restrictions specific to each clause are implemented apart from the
diff --git a/flang/lib/Semantics/check-omp-structure.h b/flang/lib/Semantics/check-omp-structure.h
index e0a86b09a5d9a..a77506e329934 100644
--- a/flang/lib/Semantics/check-omp-structure.h
+++ b/flang/lib/Semantics/check-omp-structure.h
@@ -365,9 +365,9 @@ class OmpStructureChecker : public OmpStructureCheckerBase {
const AppliedModifierInfo &info);
bool VerifyModifierUltimate(parser::omp::WithSource<llvm::omp::Clause> clause,
const AppliedModifierInfo &info);
- bool VerifyModifiers(parser::omp::WithSource<llvm::omp::Clause> clause,
+ bool VerifyModifierSyntax(parser::omp::WithSource<llvm::omp::Clause> clause,
const AppliedModifierInfo &info);
- void VerifyModifiers(const parser::OmpClause &x);
+ void VerifyModifierSyntax(const parser::OmpClause &x);
// check-omp-structure.cpp
using ClauseIterator =
diff --git a/flang/lib/Semantics/check-omp-syntax.cpp b/flang/lib/Semantics/check-omp-syntax.cpp
index b1860bdc3bc5b..d8f6c92dcd7b8 100644
--- a/flang/lib/Semantics/check-omp-syntax.cpp
+++ b/flang/lib/Semantics/check-omp-syntax.cpp
@@ -38,20 +38,30 @@ template <typename T> struct SetTypeFor {
llvm::to_underlying(T::Last_) - llvm::to_underlying(T::First_) + 1>;
};
-static llvm::omp::Modifiers getElements(
- const llvm::omp::descriptor::Clause &cdesc, llvm::omp::Version version) {
- return cdesc.getModifiers(version);
+static llvm::omp::Modifiers GetElements(
+ const llvm::omp::descriptor::Clause &desc, llvm::omp::Version version) {
+ return desc.getModifiers(version);
}
-static llvm::omp::Modifiers getElements(
- const llvm::omp::descriptor::ModifierSet &sdesc,
+static llvm::omp::Modifiers GetElements(
+ const llvm::omp::descriptor::ModifierSet &desc,
llvm::omp::Version version) {
- return sdesc.getModifiers(version);
+ return desc.getModifiers(version);
}
-static llvm::omp::ModifierSets getSets(
- const llvm::omp::descriptor::Clause &cdesc, llvm::omp::Version version) {
- return cdesc.getModifierSets(version);
+static llvm::omp::ModifierSets GetSets(
+ const llvm::omp::descriptor::Clause &desc, llvm::omp::Version version) {
+ return desc.getModifierSets(version);
+}
+
+template <typename DescriptorTy>
+static auto GetAllowedElements(
+ const DescriptorTy &desc, llvm::omp::Version version) {
+ auto allowed{GetElements(desc, version)};
+ for (auto s : GetSets(desc, version)) {
+ allowed |= GetElements(GetDescriptor(s), version);
+ }
+ return allowed;
}
template < //
@@ -65,7 +75,7 @@ static ResultTy VerifyVersions(
ResultTy result;
auto &odesc{llvm::omp::getDescriptor(ownerId)};
- auto elements{getElements(odesc, version)};
+ auto elements{GetElements(odesc, version)};
for (const AppliedElementTy &elem : info.elements) {
if (elements.test(elem.id.value)) {
@@ -73,7 +83,7 @@ static ResultTy VerifyVersions(
}
llvm::omp::Version since{~0u}, until{0u};
for (llvm::omp::Version v : odesc.getVersions()) {
- if (getElements(odesc, v).test(elem.id.value)) {
+ if (GetElements(odesc, v).test(elem.id.value)) {
if (v < version) {
until = std::max(until, v);
} else if (v > version) {
@@ -100,13 +110,13 @@ static ResultTy VerifyRequired(
ResultTy required;
auto &odesc{llvm::omp::getDescriptor(ownerId)};
- for (auto e : getElements(odesc, version)) {
+ for (auto e : GetElements(odesc, version)) {
auto &edesc{llvm::omp::getDescriptor(e)};
if (edesc.getProperties(version).test(llvm::omp::Property::Required)) {
required.first.set(e);
}
}
- for (auto s : getSets(odesc, version)) {
+ for (auto s : GetSets(odesc, version)) {
auto &sdesc{llvm::omp::getDescriptor(s)};
if (sdesc.getProperties(version).test(llvm::omp::Property::Required)) {
required.second.set(s);
@@ -132,19 +142,19 @@ static ResultTy VerifyUnique(const AppliedElementInfo<ElemTy, SetsSetTy> &info,
ElemSetTy unique;
auto &odesc{llvm::omp::getDescriptor(ownerId)};
- auto elements{getElements(odesc, version)};
+ auto elements{GetElements(odesc, version)};
for (auto e : elements) {
auto &edesc{llvm::omp::getDescriptor(e)};
- // Exclusive modifiers should have the "unique" property present as well.
+ // Ultimate modifiers should have the "unique" property present as well.
if (edesc.getProperties(version).test(llvm::omp::Property::Unique)) {
unique.set(e);
}
}
- for (auto s : getSets(odesc, version)) {
+ for (auto s : GetSets(odesc, version)) {
auto &sdesc{llvm::omp::getDescriptor(s)};
if (sdesc.getProperties(version).test(llvm::omp::Property::Unique)) {
- unique |= getElements(sdesc, version);
+ unique |= GetElements(sdesc, version);
}
}
@@ -177,7 +187,7 @@ static ResultTy VerifyExclusive(
ResultTy result;
auto &odesc{llvm::omp::getDescriptor(ownerId)};
- auto elements{getElements(odesc, version)};
+ auto elements{GetElements(odesc, version)};
llvm::DenseMap<ElemTy, parser::CharBlock> present;
for (const AppliedElementTy &elem : info.elements) {
@@ -218,7 +228,7 @@ static ResultTy VerifyMutuallyExclusive(
ResultTy result;
auto &odesc{llvm::omp::getDescriptor(ownerId)};
- auto elements{getElements(odesc, version)};
+ auto elements{GetElements(odesc, version)};
llvm::DenseMap<SetTy, const AppliedElementTy *> exclusive;
for (const AppliedElementTy &elem : info.elements) {
@@ -261,7 +271,7 @@ static ResultTy VerifyUltimate(
ElemSetTy ultimate;
auto &odesc{llvm::omp::getDescriptor(ownerId)};
- auto elements{getElements(odesc, version)};
+ auto elements{GetElements(odesc, version)};
for (auto e : elements) {
auto &edesc{llvm::omp::getDescriptor(e)};
@@ -269,10 +279,10 @@ static ResultTy VerifyUltimate(
ultimate.set(e);
}
}
- for (auto s : getSets(odesc, version)) {
+ for (auto s : GetSets(odesc, version)) {
auto &sdesc{llvm::omp::getDescriptor(s)};
if (sdesc.getProperties(version).test(llvm::omp::Property::Ultimate)) {
- ultimate |= getElements(sdesc, version);
+ ultimate |= GetElements(sdesc, version);
}
}
@@ -497,7 +507,7 @@ AppliedModifierInfo GetAppliedModifiers(
clause.u);
}
-bool OmpStructureChecker::VerifyModifiers(
+bool OmpStructureChecker::VerifyModifierSyntax(
WithSource<llvm::omp::Clause> clause, const AppliedModifierInfo &info) {
// Run all checks without short-circuiting, return 'true' if all succeed.
bool valid[]{
@@ -511,7 +521,7 @@ bool OmpStructureChecker::VerifyModifiers(
return llvm::all_of(valid, [](bool x) { return x; });
}
-void OmpStructureChecker::VerifyModifiers(const parser::OmpClause &x) {
+void OmpStructureChecker::VerifyModifierSyntax(const parser::OmpClause &x) {
llvm::omp::Version version{context_.langOptions().getOpenMPVersion()};
llvm::omp::Clause id{x.Id()};
auto clauseId{WithSource(id, x.source)};
@@ -531,14 +541,14 @@ void OmpStructureChecker::VerifyModifiers(const parser::OmpClause &x) {
for (auto &&as : uac.v) {
bool legacy{std::get<bool>(as.t)};
if (!legacy) {
- VerifyModifiers(
+ VerifyModifierSyntax(
clauseId, GetAppliedModifiers(id, version, OmpGetModifiers(as)));
}
}
break;
}
default:
- VerifyModifiers(clauseId, GetAppliedModifiers(x, version));
+ VerifyModifierSyntax(clauseId, GetAppliedModifiers(x, version));
break;
}
}
diff --git a/flang/lib/Semantics/check-omp-variant.cpp b/flang/lib/Semantics/check-omp-variant.cpp
index 7d2dd8e6e0c3e..ac745accf95a3 100644
--- a/flang/lib/Semantics/check-omp-variant.cpp
+++ b/flang/lib/Semantics/check-omp-variant.cpp
@@ -191,7 +191,7 @@ void OmpStructureChecker::Enter(const parser::OmpClause::When &x) {
// controls can be paired with it for static-applicability matching. A
// well-formed WHEN clause has exactly one modifier, its context selector;
// pair it only in that case, which also makes front() safe. Any other count
- // is malformed and already diagnosed by VerifyModifiers.
+ // is malformed and already diagnosed by VerifyModifierSyntax.
if (const auto &modifiers{std::get<0>(x.v.t)};
modifiers && modifiers->size() == 1) {
currentWhenSelector_ =
``````````
</details>
https://github.com/llvm/llvm-project/pull/226484
More information about the flang-commits
mailing list