[flang-commits] [flang] cc25ac4 - [flang][OpenMP] Use DirId() instead of DirName().v, NFC (#171484)
via flang-commits
flang-commits at lists.llvm.org
Tue Dec 9 10:45:50 PST 2025
Author: Krzysztof Parzyszek
Date: 2025-12-09T12:45:45-06:00
New Revision: cc25ac424a856554edb152c09f8217e95b59a7b6
URL: https://github.com/llvm/llvm-project/commit/cc25ac424a856554edb152c09f8217e95b59a7b6
DIFF: https://github.com/llvm/llvm-project/commit/cc25ac424a856554edb152c09f8217e95b59a7b6.diff
LOG: [flang][OpenMP] Use DirId() instead of DirName().v, NFC (#171484)
Added:
Modified:
flang/lib/Parser/openmp-parsers.cpp
flang/lib/Semantics/check-omp-loop.cpp
flang/lib/Semantics/check-omp-structure.cpp
flang/lib/Semantics/resolve-directives.cpp
flang/lib/Semantics/rewrite-parse-tree.cpp
Removed:
################################################################################
diff --git a/flang/lib/Parser/openmp-parsers.cpp b/flang/lib/Parser/openmp-parsers.cpp
index 6b3bcd00c5bec..a0e106d70a5fd 100644
--- a/flang/lib/Parser/openmp-parsers.cpp
+++ b/flang/lib/Parser/openmp-parsers.cpp
@@ -1920,7 +1920,7 @@ struct OmpLoopConstructParser {
auto loopItem{LoopNestParser{} || ompLoopConstruct};
if (auto &&begin{OmpBeginDirectiveParser(dirs_).Parse(state)}) {
- auto loopDir{begin->DirName().v};
+ auto loopDir{begin->DirId()};
auto assoc{llvm::omp::getDirectiveAssociation(loopDir)};
if (assoc == llvm::omp::Association::LoopNest) {
if (auto &&item{attempt(loopItem).Parse(state)}) {
diff --git a/flang/lib/Semantics/check-omp-loop.cpp b/flang/lib/Semantics/check-omp-loop.cpp
index f25cf7eb33817..726dbe865834d 100644
--- a/flang/lib/Semantics/check-omp-loop.cpp
+++ b/flang/lib/Semantics/check-omp-loop.cpp
@@ -271,7 +271,7 @@ void OmpStructureChecker::CheckNestedBlock(const parser::OpenMPLoopConstruct &x,
} else if (parser::Unwrap<parser::DoConstruct>(stmt)) {
++nestedCount;
} else if (auto *omp{parser::Unwrap<parser::OpenMPLoopConstruct>(stmt)}) {
- if (!IsLoopTransforming(omp->BeginDir().DirName().v)) {
+ if (!IsLoopTransforming(omp->BeginDir().DirId())) {
context_.Say(omp->source,
"Only loop-transforming OpenMP constructs are allowed inside OpenMP loop constructs"_err_en_US);
}
@@ -324,7 +324,7 @@ void OmpStructureChecker::CheckFullUnroll(
// since it won't contain a loop.
if (const parser::OpenMPLoopConstruct *nested{x.GetNestedConstruct()}) {
auto &nestedSpec{nested->BeginDir()};
- if (nestedSpec.DirName().v == llvm::omp::Directive::OMPD_unroll) {
+ if (nestedSpec.DirId() == llvm::omp::Directive::OMPD_unroll) {
bool isPartial{
llvm::any_of(nestedSpec.Clauses().v, [](const parser::OmpClause &c) {
return c.Id() == llvm::omp::Clause::OMPC_partial;
diff --git a/flang/lib/Semantics/check-omp-structure.cpp b/flang/lib/Semantics/check-omp-structure.cpp
index b6b0f86eb4cce..7776f0d1f21f9 100644
--- a/flang/lib/Semantics/check-omp-structure.cpp
+++ b/flang/lib/Semantics/check-omp-structure.cpp
@@ -2800,7 +2800,7 @@ void OmpStructureChecker::Leave(const parser::OpenMPCancelConstruct &) {
void OmpStructureChecker::Enter(const parser::OpenMPCriticalConstruct &x) {
const parser::OmpBeginDirective &beginSpec{x.BeginDir()};
const std::optional<parser::OmpEndDirective> &endSpec{x.EndDir()};
- PushContextAndClauseSets(beginSpec.DirName().source, beginSpec.DirName().v);
+ PushContextAndClauseSets(beginSpec.DirName().source, beginSpec.DirId());
const auto &block{std::get<parser::Block>(x.t)};
CheckNoBranching(
diff --git a/flang/lib/Semantics/resolve-directives.cpp b/flang/lib/Semantics/resolve-directives.cpp
index 44be5ffd684a2..6211643b08970 100644
--- a/flang/lib/Semantics/resolve-directives.cpp
+++ b/flang/lib/Semantics/resolve-directives.cpp
@@ -2477,7 +2477,7 @@ bool OmpAttributeVisitor::Pre(const parser::OpenMPSectionConstruct &x) {
bool OmpAttributeVisitor::Pre(const parser::OpenMPCriticalConstruct &x) {
const parser::OmpBeginDirective &beginSpec{x.BeginDir()};
- PushContext(beginSpec.DirName().source, beginSpec.DirName().v);
+ PushContext(beginSpec.DirName().source, beginSpec.DirId());
GetContext().withinConstruct = true;
return true;
}
diff --git a/flang/lib/Semantics/rewrite-parse-tree.cpp b/flang/lib/Semantics/rewrite-parse-tree.cpp
index 285eaac1e2c8f..60e3e6ab3f5f1 100644
--- a/flang/lib/Semantics/rewrite-parse-tree.cpp
+++ b/flang/lib/Semantics/rewrite-parse-tree.cpp
@@ -118,7 +118,7 @@ static bool ReturnsDataPointer(const Symbol &symbol) {
}
static bool LoopConstructIsSIMD(parser::OpenMPLoopConstruct *ompLoop) {
- return llvm::omp::allSimdSet.test(ompLoop->BeginDir().DirName().v);
+ return llvm::omp::allSimdSet.test(ompLoop->BeginDir().DirId());
}
// Remove non-SIMD OpenMPConstructs once they are parsed.
More information about the flang-commits
mailing list