[flang-commits] [flang] [flang][OpenMP] Consistent names for non-executable directives, NFC (PR #196803)
Krzysztof Parzyszek via flang-commits
flang-commits at lists.llvm.org
Sun May 10 07:05:45 PDT 2026
https://github.com/kparzysz created https://github.com/llvm/llvm-project/pull/196803
Change
OpenMPGroupprivate -> OmpGroupprivateDirective
OpenMPThreadprivate -> OmpThreadprivateDirective
OpenMPRequiresConstruct -> OmpRequiresDirective
OpenMPUtilityConstruct -> OmpUtilityDirective
>From a6344c0a610ee638239498e555b4c98f91692e2f Mon Sep 17 00:00:00 2001
From: Krzysztof Parzyszek <Krzysztof.Parzyszek at amd.com>
Date: Sat, 9 May 2026 18:44:08 -0500
Subject: [PATCH] [flang][OpenMP] Consistent names for non-executable
directives, NFC
Change
OpenMPGroupprivate -> OmpGroupprivateDirective
OpenMPThreadprivate -> OmpThreadprivateDirective
OpenMPRequiresConstruct -> OmpRequiresDirective
OpenMPUtilityConstruct -> OmpUtilityDirective
---
flang/examples/FeatureList/FeatureList.cpp | 4 ++--
flang/include/flang/Parser/dump-parse-tree.h | 8 +++----
flang/include/flang/Parser/parse-tree.h | 24 +++++++++++---------
flang/lib/Lower/OpenMP/OpenMP.cpp | 12 +++++-----
flang/lib/Parser/openmp-parsers.cpp | 20 ++++++++--------
flang/lib/Parser/unparse.cpp | 6 ++---
flang/lib/Semantics/canonicalize-omp.cpp | 8 +++----
flang/lib/Semantics/check-omp-structure.cpp | 14 ++++++------
flang/lib/Semantics/check-omp-structure.h | 12 +++++-----
flang/lib/Semantics/resolve-directives.cpp | 20 ++++++++--------
flang/lib/Semantics/resolve-names.cpp | 8 ++++---
flang/lib/Semantics/rewrite-parse-tree.cpp | 2 +-
flang/lib/Semantics/unparse-with-symbols.cpp | 13 +++++++----
flang/test/Lower/OpenMP/Todo/error.f90 | 2 +-
flang/test/Parser/OpenMP/error-unparse.f90 | 6 ++---
flang/test/Parser/OpenMP/groupprivate.f90 | 4 ++--
flang/test/Parser/OpenMP/nothing.f90 | 8 +++----
flang/test/Parser/OpenMP/requires.f90 | 10 ++++----
flang/test/Parser/OpenMP/threadprivate.f90 | 2 +-
flang/test/Semantics/OpenMP/simd-only.f90 | 2 +-
20 files changed, 97 insertions(+), 88 deletions(-)
diff --git a/flang/examples/FeatureList/FeatureList.cpp b/flang/examples/FeatureList/FeatureList.cpp
index 80683f90654a2..c0f6a1776c2e5 100644
--- a/flang/examples/FeatureList/FeatureList.cpp
+++ b/flang/examples/FeatureList/FeatureList.cpp
@@ -556,12 +556,12 @@ struct NodeVisitor {
READ_FEATURE(OpenMPFlushConstruct)
READ_FEATURE(OpenMPLoopConstruct)
READ_FEATURE(OpenMPAllocatorsConstruct)
- READ_FEATURE(OpenMPRequiresConstruct)
+ READ_FEATURE(OmpRequiresDirective)
READ_FEATURE(OpenMPSimpleStandaloneConstruct)
READ_FEATURE(OpenMPStandaloneConstruct)
READ_FEATURE(OpenMPSectionConstruct)
READ_FEATURE(OpenMPSectionsConstruct)
- READ_FEATURE(OpenMPThreadprivate)
+ READ_FEATURE(OmpThreadprivateDirective)
READ_FEATURE(OpenStmt)
READ_FEATURE(Optional)
READ_FEATURE(OptionalStmt)
diff --git a/flang/include/flang/Parser/dump-parse-tree.h b/flang/include/flang/Parser/dump-parse-tree.h
index da5a00b68ad38..1825db3a3424b 100644
--- a/flang/include/flang/Parser/dump-parse-tree.h
+++ b/flang/include/flang/Parser/dump-parse-tree.h
@@ -630,6 +630,7 @@ class ParseTreeDumper {
NODE(OmpGrainsizeClause, Modifier)
NODE(parser, OmpGraphIdClause)
NODE(parser, OmpGraphResetClause)
+ NODE(parser, OmpGroupprivateDirective)
NODE(parser, OmpHintClause)
NODE(parser, OmpHoldsClause)
NODE(parser, OmpIfClause)
@@ -711,6 +712,7 @@ class ParseTreeDumper {
NODE(parser, OmpRefModifier)
NODE_ENUM(OmpRefModifier, Value)
NODE(parser, OmpReplayableClause)
+ NODE(parser, OmpRequiresDirective)
NODE(parser, OmpReverseOffloadClause)
NODE(parser, OmpScheduleClause)
NODE(OmpScheduleClause, Modifier)
@@ -731,6 +733,7 @@ class ParseTreeDumper {
NODE(OmpTaskReductionClause, Modifier)
NODE(parser, OmpThreadLimitClause)
NODE(OmpThreadLimitClause, Modifier)
+ NODE(parser, OmpThreadprivateDirective)
NODE(parser, OmpThreadsetClause)
NODE_ENUM(OmpThreadsetClause, ThreadsetPolicy)
NODE(parser, OmpToClause)
@@ -754,6 +757,7 @@ class ParseTreeDumper {
NODE(parser, OmpUnifiedSharedMemoryClause)
NODE(parser, OmpUpdateClause)
NODE(parser, OmpUseClause)
+ NODE(parser, OmpUtilityDirective)
NODE(parser, OmpVariableCategory)
NODE_ENUM(OmpVariableCategory, Value)
NODE(parser, OmpWhenClause)
@@ -790,17 +794,13 @@ class ParseTreeDumper {
NODE(parser, OpenMPDepobjConstruct)
NODE(parser, OpenMPDispatchConstruct)
NODE(parser, OpenMPFlushConstruct)
- NODE(parser, OpenMPGroupprivate)
NODE(parser, OpenMPInvalidDirective)
NODE(parser, OpenMPLoopConstruct)
NODE(parser, OpenMPMisplacedEndDirective)
- NODE(parser, OpenMPRequiresConstruct)
NODE(parser, OpenMPSectionConstruct)
NODE(parser, OpenMPSectionsConstruct)
NODE(parser, OpenMPSimpleStandaloneConstruct)
NODE(parser, OpenMPStandaloneConstruct)
- NODE(parser, OpenMPThreadprivate)
- NODE(parser, OpenMPUtilityConstruct)
NODE(parser, OpenStmt)
NODE(parser, Optional)
diff --git a/flang/include/flang/Parser/parse-tree.h b/flang/include/flang/Parser/parse-tree.h
index 628f2ed80abad..58aeaf2280c53 100644
--- a/flang/include/flang/Parser/parse-tree.h
+++ b/flang/include/flang/Parser/parse-tree.h
@@ -5153,8 +5153,8 @@ struct OmpErrorDirective {
WRAPPER_CLASS_BOILERPLATE(OmpErrorDirective, OmpDirectiveSpecification);
};
-struct OpenMPUtilityConstruct {
- UNION_CLASS_BOILERPLATE(OpenMPUtilityConstruct);
+struct OmpUtilityDirective {
+ UNION_CLASS_BOILERPLATE(OmpUtilityDirective);
CharBlock source;
std::variant<OmpErrorDirective, OmpNothingDirective> u;
};
@@ -5271,20 +5271,22 @@ struct OmpDeclareSimdDirective {
//
// groupprivate-directive ->
// GROUPPRIVATE (variable-list-item...) // since 6.0
-struct OpenMPGroupprivate {
- WRAPPER_CLASS_BOILERPLATE(OpenMPGroupprivate, OmpDirectiveSpecification);
+struct OmpGroupprivateDirective {
+ WRAPPER_CLASS_BOILERPLATE(
+ OmpGroupprivateDirective, OmpDirectiveSpecification);
CharBlock source;
};
// 2.4 requires -> REQUIRES requires-clause[ [ [,] requires-clause]...]
-struct OpenMPRequiresConstruct {
- WRAPPER_CLASS_BOILERPLATE(OpenMPRequiresConstruct, OmpDirectiveSpecification);
+struct OmpRequiresDirective {
+ WRAPPER_CLASS_BOILERPLATE(OmpRequiresDirective, OmpDirectiveSpecification);
CharBlock source;
};
// 2.15.2 threadprivate -> THREADPRIVATE (variable-name-list)
-struct OpenMPThreadprivate {
- WRAPPER_CLASS_BOILERPLATE(OpenMPThreadprivate, OmpDirectiveSpecification);
+struct OmpThreadprivateDirective {
+ WRAPPER_CLASS_BOILERPLATE(
+ OmpThreadprivateDirective, OmpDirectiveSpecification);
CharBlock source;
};
@@ -5326,8 +5328,8 @@ struct OpenMPDeclarativeConstruct {
std::variant<OmpAllocateDirective, OpenMPDeclarativeAssumes,
OmpDeclareMapperDirective, OmpDeclareReductionDirective,
OmpDeclareSimdDirective, OmpDeclareTargetDirective,
- OmpDeclareVariantDirective, OpenMPGroupprivate, OpenMPThreadprivate,
- OpenMPRequiresConstruct, OpenMPUtilityConstruct,
+ OmpDeclareVariantDirective, OmpGroupprivateDirective,
+ OmpThreadprivateDirective, OmpRequiresDirective, OmpUtilityDirective,
OmpMetadirectiveDirective>
u;
};
@@ -5473,7 +5475,7 @@ struct OpenMPConstruct {
std::variant<OpenMPStandaloneConstruct, OpenMPSectionsConstruct,
OpenMPSectionConstruct, OpenMPLoopConstruct, OmpBlockConstruct,
OpenMPAtomicConstruct, OmpAllocateDirective, OpenMPDispatchConstruct,
- OpenMPUtilityConstruct, OpenMPAllocatorsConstruct, OpenMPAssumeConstruct,
+ OmpUtilityDirective, OpenMPAllocatorsConstruct, OpenMPAssumeConstruct,
OpenMPCriticalConstruct, OmpDelimitedMetadirectiveDirective>
u;
};
diff --git a/flang/lib/Lower/OpenMP/OpenMP.cpp b/flang/lib/Lower/OpenMP/OpenMP.cpp
index 0ffc7bdae85b9..fb5014f3394be 100644
--- a/flang/lib/Lower/OpenMP/OpenMP.cpp
+++ b/flang/lib/Lower/OpenMP/OpenMP.cpp
@@ -3926,7 +3926,7 @@ static void genOMPDispatch(lower::AbstractConverter &converter,
static void genOMP(lower::AbstractConverter &converter, lower::SymMap &symTable,
semantics::SemanticsContext &semaCtx,
lower::pft::Evaluation &eval,
- const parser::OpenMPUtilityConstruct &);
+ const parser::OmpUtilityDirective &);
static void genOMP(lower::AbstractConverter &converter, lower::SymMap &symTable,
semantics::SemanticsContext &semaCtx,
@@ -4409,14 +4409,14 @@ genOMP(lower::AbstractConverter &converter, lower::SymMap &symTable,
static void genOMP(lower::AbstractConverter &converter, lower::SymMap &symTable,
semantics::SemanticsContext &semaCtx,
lower::pft::Evaluation &eval,
- const parser::OpenMPGroupprivate &directive) {
+ const parser::OmpGroupprivateDirective &directive) {
TODO(converter.getCurrentLocation(), "GROUPPRIVATE");
}
static void genOMP(lower::AbstractConverter &converter, lower::SymMap &symTable,
semantics::SemanticsContext &semaCtx,
lower::pft::Evaluation &eval,
- const parser::OpenMPRequiresConstruct &requiresConstruct) {
+ const parser::OmpRequiresDirective &requiresConstruct) {
// Requires directives are gathered and processed in semantics and
// then combined in the lowering bridge before triggering codegen
// just once. Hence, there is no need to lower each individual
@@ -4426,7 +4426,7 @@ static void genOMP(lower::AbstractConverter &converter, lower::SymMap &symTable,
static void genOMP(lower::AbstractConverter &converter, lower::SymMap &symTable,
semantics::SemanticsContext &semaCtx,
lower::pft::Evaluation &eval,
- const parser::OpenMPThreadprivate &threadprivate) {
+ const parser::OmpThreadprivateDirective &threadprivate) {
// The directive is lowered when instantiating the variable to
// support the case of threadprivate variable declared in module.
}
@@ -4692,9 +4692,9 @@ static void genOMP(lower::AbstractConverter &converter, lower::SymMap &symTable,
static void genOMP(lower::AbstractConverter &converter, lower::SymMap &symTable,
semantics::SemanticsContext &semaCtx,
lower::pft::Evaluation &eval,
- const parser::OpenMPUtilityConstruct &) {
+ const parser::OmpUtilityDirective &) {
if (!semaCtx.langOptions().OpenMPSimd)
- TODO(converter.getCurrentLocation(), "OpenMPUtilityConstruct");
+ TODO(converter.getCurrentLocation(), "OmpUtilityDirective");
}
static void genOMP(lower::AbstractConverter &converter, lower::SymMap &symTable,
diff --git a/flang/lib/Parser/openmp-parsers.cpp b/flang/lib/Parser/openmp-parsers.cpp
index d89bf13e137d8..e9bd97d729b89 100644
--- a/flang/lib/Parser/openmp-parsers.cpp
+++ b/flang/lib/Parser/openmp-parsers.cpp
@@ -1916,8 +1916,8 @@ TYPE_PARSER(construct<OmpNothingDirective>(
OmpDirectiveSpecificationParser{}))
TYPE_PARSER( //
- sourced(construct<OpenMPUtilityConstruct>(Parser<OmpErrorDirective>{})) ||
- sourced(construct<OpenMPUtilityConstruct>(Parser<OmpNothingDirective>{})))
+ sourced(construct<OmpUtilityDirective>(Parser<OmpErrorDirective>{})) ||
+ sourced(construct<OmpUtilityDirective>(Parser<OmpNothingDirective>{})))
TYPE_PARSER(construct<OmpMetadirectiveDirective>(
predicated(Parser<OmpDirectiveName>{},
@@ -2423,20 +2423,20 @@ TYPE_PARSER(sourced(construct<OmpDeclareSimdDirective>(
OmpDirectiveSpecificationParser{})))
TYPE_PARSER(sourced( //
- construct<OpenMPGroupprivate>(
+ construct<OmpGroupprivateDirective>(
predicated(OmpDirectiveNameParser{},
IsDirective(llvm::omp::Directive::OMPD_groupprivate)) >=
OmpDirectiveSpecificationParser{})))
// 2.4 Requires construct
-TYPE_PARSER(sourced(construct<OpenMPRequiresConstruct>(
+TYPE_PARSER(sourced(construct<OmpRequiresDirective>(
predicated(OmpDirectiveNameParser{},
IsDirective(llvm::omp::Directive::OMPD_requires)) >=
OmpDirectiveSpecificationParser{})))
// 2.15.2 Threadprivate directive
TYPE_PARSER(sourced( //
- construct<OpenMPThreadprivate>(
+ construct<OmpThreadprivateDirective>(
predicated(OmpDirectiveNameParser{},
IsDirective(llvm::omp::Directive::OMPD_threadprivate)) >=
OmpDirectiveSpecificationParser{})))
@@ -2465,13 +2465,13 @@ TYPE_PARSER(
construct<OpenMPDeclarativeConstruct>(
sourced(OmpDeclarativeAllocateParser{})) ||
construct<OpenMPDeclarativeConstruct>(
- Parser<OpenMPGroupprivate>{}) ||
+ Parser<OmpGroupprivateDirective>{}) ||
construct<OpenMPDeclarativeConstruct>(
- Parser<OpenMPRequiresConstruct>{}) ||
+ Parser<OmpRequiresDirective>{}) ||
construct<OpenMPDeclarativeConstruct>(
- Parser<OpenMPThreadprivate>{}) ||
+ Parser<OmpThreadprivateDirective>{}) ||
construct<OpenMPDeclarativeConstruct>(
- Parser<OpenMPUtilityConstruct>{}) ||
+ Parser<OmpUtilityDirective>{}) ||
construct<OpenMPDeclarativeConstruct>(
Parser<OmpMetadirectiveDirective>{})) /
endOmpLine))
@@ -2566,7 +2566,7 @@ TYPE_CONTEXT_PARSER("OpenMP construct"_en_US,
// OpenMPStandaloneConstruct to resolve !$OMP ORDERED
construct<OpenMPConstruct>(Parser<OpenMPStandaloneConstruct>{}),
construct<OpenMPConstruct>(Parser<OpenMPAtomicConstruct>{}),
- construct<OpenMPConstruct>(Parser<OpenMPUtilityConstruct>{}),
+ construct<OpenMPConstruct>(Parser<OmpUtilityDirective>{}),
construct<OpenMPConstruct>(Parser<OpenMPDispatchConstruct>{}),
construct<OpenMPConstruct>(Parser<OpenMPAllocatorsConstruct>{}),
construct<OpenMPConstruct>(Parser<OpenMPAssumeConstruct>{}),
diff --git a/flang/lib/Parser/unparse.cpp b/flang/lib/Parser/unparse.cpp
index 8a01f410bd861..355eadaf8e0d4 100644
--- a/flang/lib/Parser/unparse.cpp
+++ b/flang/lib/Parser/unparse.cpp
@@ -2718,7 +2718,7 @@ class UnparseVisitor {
Put("\n");
EndOpenMP();
}
- void Unparse(const OpenMPGroupprivate &x) {
+ void Unparse(const OmpGroupprivateDirective &x) {
BeginOpenMP();
Word("!$OMP ");
Walk(x.v);
@@ -2742,7 +2742,7 @@ class UnparseVisitor {
void Unparse(const OpenMPMisplacedEndDirective &x) {
Unparse(static_cast<const OmpEndDirective &>(x));
}
- void Unparse(const OpenMPRequiresConstruct &x) {
+ void Unparse(const OmpRequiresDirective &x) {
BeginOpenMP();
Word("!$OMP ");
Walk(x.v);
@@ -2772,7 +2772,7 @@ class UnparseVisitor {
Put("\n");
EndOpenMP();
}
- void Unparse(const OpenMPThreadprivate &x) {
+ void Unparse(const OmpThreadprivateDirective &x) {
BeginOpenMP();
Word("!$OMP ");
Walk(x.v);
diff --git a/flang/lib/Semantics/canonicalize-omp.cpp b/flang/lib/Semantics/canonicalize-omp.cpp
index f67ac689add14..bcef673dcdb0b 100644
--- a/flang/lib/Semantics/canonicalize-omp.cpp
+++ b/flang/lib/Semantics/canonicalize-omp.cpp
@@ -278,7 +278,7 @@ class CanonicalizationOfOmp {
// Got OpenMPDeclarativeConstruct. If it's not a utility construct
// then stop.
auto &odc = std::get<OpenMPDeclarativeConstruct>(sc.u).value();
- if (!std::holds_alternative<parser::OpenMPUtilityConstruct>(odc.u)) {
+ if (!std::holds_alternative<parser::OmpUtilityDirective>(odc.u)) {
return rit;
}
}
@@ -291,7 +291,7 @@ class CanonicalizationOfOmp {
using OpenMPDeclarativeConstruct =
common::Indirection<parser::OpenMPDeclarativeConstruct>;
auto &oc = std::get<OpenMPDeclarativeConstruct>(sc.u).value();
- auto &ut = std::get<parser::OpenMPUtilityConstruct>(oc.u);
+ auto &ut = std::get<parser::OmpUtilityDirective>(oc.u);
return parser::ExecutionPartConstruct(parser::ExecutableConstruct(
common::Indirection(parser::OpenMPConstruct(std::move(ut)))));
@@ -309,7 +309,7 @@ class CanonicalizationOfOmp {
std::list<OpenMPDeclarativeConstruct>::reverse_iterator rlast = [&]() {
for (auto rit = omps.rbegin(), rend = omps.rend(); rit != rend; ++rit) {
OpenMPDeclarativeConstruct &dc = *rit;
- if (!std::holds_alternative<parser::OpenMPUtilityConstruct>(dc.u)) {
+ if (!std::holds_alternative<parser::OmpUtilityDirective>(dc.u)) {
return rit;
}
}
@@ -318,7 +318,7 @@ class CanonicalizationOfOmp {
std::transform(omps.rbegin(), rlast, std::front_inserter(block),
[](parser::OpenMPDeclarativeConstruct &dc) {
- auto &ut = std::get<parser::OpenMPUtilityConstruct>(dc.u);
+ auto &ut = std::get<parser::OmpUtilityDirective>(dc.u);
return parser::ExecutionPartConstruct(parser::ExecutableConstruct(
common::Indirection(parser::OpenMPConstruct(std::move(ut)))));
});
diff --git a/flang/lib/Semantics/check-omp-structure.cpp b/flang/lib/Semantics/check-omp-structure.cpp
index e3b623e2e9f95..022003a8e1728 100644
--- a/flang/lib/Semantics/check-omp-structure.cpp
+++ b/flang/lib/Semantics/check-omp-structure.cpp
@@ -891,7 +891,7 @@ template <typename Checker> struct DirectiveSpellingVisitor {
checker_(GetDirName(x.t).source, Directive::OMPD_allocators);
return false;
}
- bool Pre(const parser::OpenMPGroupprivate &x) {
+ bool Pre(const parser::OmpGroupprivateDirective &x) {
checker_(x.v.DirName().source, Directive::OMPD_groupprivate);
return false;
}
@@ -1574,7 +1574,7 @@ void OmpStructureChecker::CheckThreadprivateOrDeclareTargetVar(
}
}
-void OmpStructureChecker::Enter(const parser::OpenMPGroupprivate &x) {
+void OmpStructureChecker::Enter(const parser::OmpGroupprivateDirective &x) {
PushContextAndClauseSets(
x.v.DirName().source, llvm::omp::Directive::OMPD_groupprivate);
@@ -1626,16 +1626,16 @@ void OmpStructureChecker::Enter(const parser::OpenMPGroupprivate &x) {
}
}
-void OmpStructureChecker::Leave(const parser::OpenMPGroupprivate &x) {
+void OmpStructureChecker::Leave(const parser::OmpGroupprivateDirective &x) {
dirContext_.pop_back();
}
-void OmpStructureChecker::Enter(const parser::OpenMPThreadprivate &x) {
+void OmpStructureChecker::Enter(const parser::OmpThreadprivateDirective &x) {
const parser::OmpDirectiveName &dirName{x.v.DirName()};
PushContextAndClauseSets(dirName.source, dirName.v);
}
-void OmpStructureChecker::Leave(const parser::OpenMPThreadprivate &x) {
+void OmpStructureChecker::Leave(const parser::OmpThreadprivateDirective &x) {
const parser::OmpDirectiveSpecification &dirSpec{x.v};
for (const parser::OmpArgument &arg : x.v.Arguments().v) {
if (auto *object{GetArgumentObject(arg)}) {
@@ -1881,7 +1881,7 @@ void OmpStructureChecker::Leave(const parser::OpenMPDepobjConstruct &x) {
dirContext_.pop_back();
}
-void OmpStructureChecker::Enter(const parser::OpenMPRequiresConstruct &x) {
+void OmpStructureChecker::Enter(const parser::OmpRequiresDirective &x) {
const auto &dirName{x.v.DirName()};
PushContextAndClauseSets(dirName.source, dirName.v);
unsigned version{context_.langOptions().OpenMPVersion};
@@ -1924,7 +1924,7 @@ void OmpStructureChecker::Enter(const parser::OpenMPRequiresConstruct &x) {
}
}
-void OmpStructureChecker::Leave(const parser::OpenMPRequiresConstruct &) {
+void OmpStructureChecker::Leave(const parser::OmpRequiresDirective &) {
dirContext_.pop_back();
}
diff --git a/flang/lib/Semantics/check-omp-structure.h b/flang/lib/Semantics/check-omp-structure.h
index 397381e30cccd..f9852bbf77d65 100644
--- a/flang/lib/Semantics/check-omp-structure.h
+++ b/flang/lib/Semantics/check-omp-structure.h
@@ -145,12 +145,12 @@ class OmpStructureChecker : public OmpStructureCheckerBase {
void Leave(const parser::OmpNothingDirective &);
void Enter(const parser::OpenMPAllocatorsConstruct &);
void Leave(const parser::OpenMPAllocatorsConstruct &);
- void Enter(const parser::OpenMPRequiresConstruct &);
- void Leave(const parser::OpenMPRequiresConstruct &);
- void Enter(const parser::OpenMPGroupprivate &);
- void Leave(const parser::OpenMPGroupprivate &);
- void Enter(const parser::OpenMPThreadprivate &);
- void Leave(const parser::OpenMPThreadprivate &);
+ void Enter(const parser::OmpRequiresDirective &);
+ void Leave(const parser::OmpRequiresDirective &);
+ void Enter(const parser::OmpGroupprivateDirective &);
+ void Leave(const parser::OmpGroupprivateDirective &);
+ void Enter(const parser::OmpThreadprivateDirective &);
+ void Leave(const parser::OmpThreadprivateDirective &);
void Enter(const parser::OpenMPSimpleStandaloneConstruct &);
void Leave(const parser::OpenMPSimpleStandaloneConstruct &);
diff --git a/flang/lib/Semantics/resolve-directives.cpp b/flang/lib/Semantics/resolve-directives.cpp
index 52cd445027d37..7ae867e19f276 100644
--- a/flang/lib/Semantics/resolve-directives.cpp
+++ b/flang/lib/Semantics/resolve-directives.cpp
@@ -551,8 +551,8 @@ class OmpAttributeVisitor : DirectiveAttributeVisitor<llvm::omp::Directive> {
GetContext().withinConstruct = true;
}
- bool Pre(const parser::OpenMPGroupprivate &);
- void Post(const parser::OpenMPGroupprivate &) { PopContext(); }
+ bool Pre(const parser::OmpGroupprivateDirective &);
+ void Post(const parser::OmpGroupprivateDirective &) { PopContext(); }
bool Pre(const parser::OpenMPStandaloneConstruct &x) {
common::visit(
@@ -636,7 +636,7 @@ class OmpAttributeVisitor : DirectiveAttributeVisitor<llvm::omp::Directive> {
}
void Post(const parser::OpenMPFlushConstruct &) { PopContext(); }
- bool Pre(const parser::OpenMPRequiresConstruct &x) {
+ bool Pre(const parser::OmpRequiresDirective &x) {
using RequiresClauses = WithOmpDeclarative::RequiresClauses;
PushContext(x.source, llvm::omp::Directive::OMPD_requires);
@@ -689,7 +689,7 @@ class OmpAttributeVisitor : DirectiveAttributeVisitor<llvm::omp::Directive> {
AddOmpRequiresToScope(currScope(), &reqs, memOrder);
return true;
}
- void Post(const parser::OpenMPRequiresConstruct &) { PopContext(); }
+ void Post(const parser::OmpRequiresDirective &) { PopContext(); }
bool Pre(const parser::OmpDeclareTargetDirective &);
void Post(const parser::OmpDeclareTargetDirective &) { PopContext(); }
@@ -700,8 +700,8 @@ class OmpAttributeVisitor : DirectiveAttributeVisitor<llvm::omp::Directive> {
bool Pre(const parser::OmpDeclareReductionDirective &);
void Post(const parser::OmpDeclareReductionDirective &) { PopContext(); }
- bool Pre(const parser::OpenMPThreadprivate &);
- void Post(const parser::OpenMPThreadprivate &) { PopContext(); }
+ bool Pre(const parser::OmpThreadprivateDirective &);
+ void Post(const parser::OmpThreadprivateDirective &) { PopContext(); }
bool Pre(const parser::OmpAllocateDirective &);
@@ -717,11 +717,11 @@ class OmpAttributeVisitor : DirectiveAttributeVisitor<llvm::omp::Directive> {
bool Pre(const parser::OpenMPAllocatorsConstruct &);
void Post(const parser::OpenMPAllocatorsConstruct &);
- bool Pre(const parser::OpenMPUtilityConstruct &x) {
+ bool Pre(const parser::OmpUtilityDirective &x) {
PushContext(x.source, parser::omp::GetOmpDirectiveName(x).v);
return true;
}
- void Post(const parser::OpenMPUtilityConstruct &) { PopContext(); }
+ void Post(const parser::OmpUtilityDirective &) { PopContext(); }
bool Pre(const parser::OmpDeclareVariantDirective &x) {
PushContext(x.source, llvm::omp::Directive::OMPD_declare_variant);
@@ -2142,7 +2142,7 @@ void OmpAttributeVisitor::PrivatizeAssociatedLoopIndex(
}
}
-bool OmpAttributeVisitor::Pre(const parser::OpenMPGroupprivate &x) {
+bool OmpAttributeVisitor::Pre(const parser::OmpGroupprivateDirective &x) {
PushContext(x.source, llvm::omp::Directive::OMPD_groupprivate);
for (const parser::OmpArgument &arg : x.v.Arguments().v) {
if (auto *object{parser::omp::GetArgumentObject(arg)}) {
@@ -2211,7 +2211,7 @@ bool OmpAttributeVisitor::Pre(const parser::OmpDeclareReductionDirective &x) {
return true;
}
-bool OmpAttributeVisitor::Pre(const parser::OpenMPThreadprivate &x) {
+bool OmpAttributeVisitor::Pre(const parser::OmpThreadprivateDirective &x) {
const parser::OmpDirectiveName &dirName{x.v.DirName()};
PushContext(dirName.source, dirName.v);
diff --git a/flang/lib/Semantics/resolve-names.cpp b/flang/lib/Semantics/resolve-names.cpp
index f5478c354b40a..f81eaf11618c4 100644
--- a/flang/lib/Semantics/resolve-names.cpp
+++ b/flang/lib/Semantics/resolve-names.cpp
@@ -1730,7 +1730,7 @@ class OmpVisitor : public virtual DeclarationVisitor {
static bool NeedsScope(const parser::OmpBlockConstruct &);
static bool NeedsScope(const parser::OmpClause &);
- bool Pre(const parser::OpenMPRequiresConstruct &x) {
+ bool Pre(const parser::OmpRequiresDirective &x) {
AddOmpSourceRange(x.source);
return true;
}
@@ -1815,11 +1815,13 @@ class OmpVisitor : public virtual DeclarationVisitor {
void Post(const parser::OmpEndSectionsDirective &x) {
Post(static_cast<const parser::OmpDirectiveSpecification &>(x));
}
- bool Pre(const parser::OpenMPThreadprivate &) {
+ bool Pre(const parser::OmpThreadprivateDirective &) {
SkipImplicitTyping(true);
return true;
}
- void Post(const parser::OpenMPThreadprivate &) { SkipImplicitTyping(false); }
+ void Post(const parser::OmpThreadprivateDirective &) {
+ SkipImplicitTyping(false);
+ }
bool Pre(const parser::OmpDeclareTargetDirective &x) {
auto addObjectName{[&](const parser::OmpObject &object) {
common::visit(
diff --git a/flang/lib/Semantics/rewrite-parse-tree.cpp b/flang/lib/Semantics/rewrite-parse-tree.cpp
index dff5a1cd30a1b..f71a1be50172e 100644
--- a/flang/lib/Semantics/rewrite-parse-tree.cpp
+++ b/flang/lib/Semantics/rewrite-parse-tree.cpp
@@ -131,7 +131,7 @@ void RewriteMutator::OpenMPSimdOnly(parser::SpecificationPart &specPart) {
if (auto *ompDecl{std::get_if<
common::Indirection<parser::OpenMPDeclarativeConstruct>>(
&specConstr->u)}) {
- if (std::holds_alternative<parser::OpenMPThreadprivate>(
+ if (std::holds_alternative<parser::OmpThreadprivateDirective>(
ompDecl->value().u) ||
std::holds_alternative<parser::OmpDeclareMapperDirective>(
ompDecl->value().u)) {
diff --git a/flang/lib/Semantics/unparse-with-symbols.cpp b/flang/lib/Semantics/unparse-with-symbols.cpp
index e202c17835044..a3361f9072f69 100644
--- a/flang/lib/Semantics/unparse-with-symbols.cpp
+++ b/flang/lib/Semantics/unparse-with-symbols.cpp
@@ -7,6 +7,7 @@
//===----------------------------------------------------------------------===//
#include "flang/Semantics/unparse-with-symbols.h"
+
#include "mod-file.h"
#include "flang/Parser/parse-tree-visitor.h"
#include "flang/Parser/parse-tree.h"
@@ -49,16 +50,20 @@ class SymbolDumpVisitor {
return true;
}
void Post(const parser::OmpClause &) { currStmt_ = std::nullopt; }
- bool Pre(const parser::OpenMPGroupprivate &dir) {
+ bool Pre(const parser::OmpGroupprivateDirective &dir) {
currStmt_ = dir.source;
return true;
}
- void Post(const parser::OpenMPGroupprivate &) { currStmt_ = std::nullopt; }
- bool Pre(const parser::OpenMPThreadprivate &dir) {
+ void Post(const parser::OmpGroupprivateDirective &) {
+ currStmt_ = std::nullopt;
+ }
+ bool Pre(const parser::OmpThreadprivateDirective &dir) {
currStmt_ = dir.source;
return true;
}
- void Post(const parser::OpenMPThreadprivate &) { currStmt_ = std::nullopt; }
+ void Post(const parser::OmpThreadprivateDirective &) {
+ currStmt_ = std::nullopt;
+ }
bool Pre(const parser::OmpDeclareMapperDirective &x) {
currStmt_ = x.source;
diff --git a/flang/test/Lower/OpenMP/Todo/error.f90 b/flang/test/Lower/OpenMP/Todo/error.f90
index 6d3bd892da47d..d002f72760b1c 100644
--- a/flang/test/Lower/OpenMP/Todo/error.f90
+++ b/flang/test/Lower/OpenMP/Todo/error.f90
@@ -1,6 +1,6 @@
! RUN: %not_todo_cmd %flang_fc1 -emit-fir -fopenmp -fopenmp-version=51 -o - %s 2>&1 | FileCheck %s
-! CHECK: not yet implemented: OpenMPUtilityConstruct
+! CHECK: not yet implemented: OmpUtilityDirective
program p
integer, allocatable :: x
!$omp error at(compilation) severity(warning) message("an error")
diff --git a/flang/test/Parser/OpenMP/error-unparse.f90 b/flang/test/Parser/OpenMP/error-unparse.f90
index 60ce52b9b88a1..0902d109fd233 100644
--- a/flang/test/Parser/OpenMP/error-unparse.f90
+++ b/flang/test/Parser/OpenMP/error-unparse.f90
@@ -3,7 +3,7 @@
program main
character(*), parameter :: message = "This is an error"
!CHECK: !$OMP ERROR AT(COMPILATION) SEVERITY(WARNING) MESSAGE("some message here")
- !PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPUtilityConstruct -> OmpErrorDirective
+ !PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OmpUtilityDirective -> OmpErrorDirective
!PARSE-TREE: OmpClauseList -> OmpClause -> At -> OmpAtClause -> ActionTime = Compilation
!PARSE-TREE: OmpClause -> Severity -> OmpSeverityClause -> SevLevel = Warning
!PARSE-TREE: OmpClause -> Message -> OmpMessageClause -> Expr = '"some message here"'
@@ -11,14 +11,14 @@ program main
!PARSE-TREE: string = 'some message here'
!$omp error at(compilation) severity(warning) message("some message here")
!CHECK: !$OMP ERROR AT(COMPILATION) SEVERITY(FATAL) MESSAGE("This is an error")
- !PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPUtilityConstruct -> OmpErrorDirective
+ !PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OmpUtilityDirective -> OmpErrorDirective
!PARSE-TREE: OmpClauseList -> OmpClause -> At -> OmpAtClause -> ActionTime = Compilation
!PARSE-TREE: OmpClause -> Severity -> OmpSeverityClause -> SevLevel = Fatal
!PARSE-TREE: OmpClause -> Message -> OmpMessageClause -> Expr = '"This is an error"'
!PARSE-TREE: Designator -> DataRef -> Name = 'message'
!$omp error at(compilation) severity(fatal) message(message)
!CHECK: !$OMP ERROR AT(EXECUTION) SEVERITY(FATAL) MESSAGE("This is an error")
- !PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPUtilityConstruct -> OmpErrorDirective
+ !PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OmpUtilityDirective -> OmpErrorDirective
!PARSE-TREE: OmpClauseList -> OmpClause -> At -> OmpAtClause -> ActionTime = Execution
!PARSE-TREE: OmpClause -> Severity -> OmpSeverityClause -> SevLevel = Fatal
!PARSE-TREE: OmpClause -> Message -> OmpMessageClause -> Expr = '"This is an error"'
diff --git a/flang/test/Parser/OpenMP/groupprivate.f90 b/flang/test/Parser/OpenMP/groupprivate.f90
index b069eb751b90d..ca4d974f6895c 100644
--- a/flang/test/Parser/OpenMP/groupprivate.f90
+++ b/flang/test/Parser/OpenMP/groupprivate.f90
@@ -17,13 +17,13 @@ module m
!UNPARSE: !$OMP GROUPPRIVATE(z)
!UNPARSE: END MODULE
-!PARSE-TREE: DeclarationConstruct -> SpecificationConstruct -> OpenMPDeclarativeConstruct -> OpenMPGroupprivate -> OmpDirectiveSpecification
+!PARSE-TREE: DeclarationConstruct -> SpecificationConstruct -> OpenMPDeclarativeConstruct -> OmpGroupprivateDirective -> OmpDirectiveSpecification
!PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = groupprivate
!PARSE-TREE: | OmpArgumentList -> OmpArgument -> OmpLocator -> OmpObject -> Designator -> DataRef -> Name = 'x'
!PARSE-TREE: | OmpArgument -> OmpLocator -> OmpObject -> Designator -> DataRef -> Name = 'y'
!PARSE-TREE: | OmpClauseList -> OmpClause -> DeviceType -> OmpDeviceTypeClause -> DeviceTypeDescription = Nohost
!PARSE-TREE: | Flags = {}
-!PARSE-TREE: DeclarationConstruct -> SpecificationConstruct -> OpenMPDeclarativeConstruct -> OpenMPGroupprivate -> OmpDirectiveSpecification
+!PARSE-TREE: DeclarationConstruct -> SpecificationConstruct -> OpenMPDeclarativeConstruct -> OmpGroupprivateDirective -> OmpDirectiveSpecification
!PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = groupprivate
!PARSE-TREE: | OmpArgumentList -> OmpArgument -> OmpLocator -> OmpObject -> Designator -> DataRef -> Name = 'z'
!PARSE-TREE: | OmpClauseList ->
diff --git a/flang/test/Parser/OpenMP/nothing.f90 b/flang/test/Parser/OpenMP/nothing.f90
index 22558c493c444..172e303c5bcb9 100644
--- a/flang/test/Parser/OpenMP/nothing.f90
+++ b/flang/test/Parser/OpenMP/nothing.f90
@@ -10,7 +10,7 @@ subroutine f00
!UNPARSE: END SUBROUTINE
!PARSE-TREE: ExecutionPart -> Block
-!PARSE-TREE: | | ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPUtilityConstruct -> OmpNothingDirective
+!PARSE-TREE: | | ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OmpUtilityDirective -> OmpNothingDirective
subroutine f01
block
@@ -39,7 +39,7 @@ subroutine f01
!PARSE-TREE: | | EntityDecl
!PARSE-TREE: | | | Name = 'x'
!PARSE-TREE: Block
-!PARSE-TREE: | ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPUtilityConstruct -> OmpNothingDirective
+!PARSE-TREE: | ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OmpUtilityDirective -> OmpNothingDirective
!PARSE-TREE: | ExecutionPartConstruct -> ExecutableConstruct -> ActionStmt -> AssignmentStmt = 'x=x+1_4'
!PARSE-TREE: | | Variable = 'x'
!PARSE-TREE: | | | Designator -> DataRef -> Name = 'x'
@@ -68,7 +68,7 @@ subroutine f02
!PARSE-TREE: | | EntityDecl
!PARSE-TREE: | | | Name = 'x'
!PARSE-TREE: ExecutionPart -> Block
-!PARSE-TREE: | ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPUtilityConstruct -> OmpNothingDirective
+!PARSE-TREE: | ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OmpUtilityDirective -> OmpNothingDirective
subroutine f03
block
@@ -92,7 +92,7 @@ subroutine f03
!PARSE-TREE: | ExecutionPartConstruct -> ExecutableConstruct -> BlockConstruct
!PARSE-TREE: | | BlockStmt ->
!PARSE-TREE: | | BlockSpecificationPart -> SpecificationPart
-!PARSE-TREE: | | | OpenMPDeclarativeConstruct -> OpenMPUtilityConstruct -> OmpNothingDirective
+!PARSE-TREE: | | | OpenMPDeclarativeConstruct -> OmpUtilityDirective -> OmpNothingDirective
!PARSE-TREE: | | | ImportStmt
!PARSE-TREE: | | | ImplicitPart ->
!PARSE-TREE: | | | DeclarationConstruct -> SpecificationConstruct -> TypeDeclarationStmt
diff --git a/flang/test/Parser/OpenMP/requires.f90 b/flang/test/Parser/OpenMP/requires.f90
index 49d78737f415f..81af7f447ae52 100644
--- a/flang/test/Parser/OpenMP/requires.f90
+++ b/flang/test/Parser/OpenMP/requires.f90
@@ -5,7 +5,7 @@
!UNPARSE: !$OMP REQUIRES ATOMIC_DEFAULT_MEM_ORDER(SEQ_CST)
-!PARSE-TREE: OpenMPDeclarativeConstruct -> OpenMPRequiresConstruct -> OmpDirectiveSpecification
+!PARSE-TREE: OpenMPDeclarativeConstruct -> OmpRequiresDirective -> OmpDirectiveSpecification
!PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = requires
!PARSE-TREE: | OmpClauseList -> OmpClause -> AtomicDefaultMemOrder -> OmpAtomicDefaultMemOrderClause -> OmpMemoryOrderType = Seq_Cst
!PARSE-TREE: | Flags = {}
@@ -14,7 +14,7 @@
!UNPARSE: !$OMP REQUIRES UNIFIED_SHARED_MEMORY UNIFIED_ADDRESS
-!PARSE-TREE: OpenMPDeclarativeConstruct -> OpenMPRequiresConstruct -> OmpDirectiveSpecification
+!PARSE-TREE: OpenMPDeclarativeConstruct -> OmpRequiresDirective -> OmpDirectiveSpecification
!PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = requires
!PARSE-TREE: | OmpClauseList -> OmpClause -> UnifiedSharedMemory
!PARSE-TREE: | OmpClause -> UnifiedAddress
@@ -24,7 +24,7 @@
!UNPARSE: !$OMP REQUIRES DYNAMIC_ALLOCATORS REVERSE_OFFLOAD
-!PARSE-TREE: OpenMPDeclarativeConstruct -> OpenMPRequiresConstruct -> OmpDirectiveSpecification
+!PARSE-TREE: OpenMPDeclarativeConstruct -> OmpRequiresDirective -> OmpDirectiveSpecification
!PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = requires
!PARSE-TREE: | OmpClauseList -> OmpClause -> DynamicAllocators
!PARSE-TREE: | OmpClause -> ReverseOffload
@@ -34,7 +34,7 @@
!UNPARSE: !$OMP REQUIRES SELF_MAPS(.true._4) UNIFIED_ADDRESS(.false._4)
-!PARSE-TREE: OpenMPDeclarativeConstruct -> OpenMPRequiresConstruct -> OmpDirectiveSpecification
+!PARSE-TREE: OpenMPDeclarativeConstruct -> OmpRequiresDirective -> OmpDirectiveSpecification
!PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = requires
!PARSE-TREE: | OmpClauseList -> OmpClause -> SelfMaps -> OmpSelfMapsClause -> Scalar -> Logical -> Constant -> Expr = '.true._4'
!PARSE-TREE: | | LiteralConstant -> LogicalLiteralConstant
@@ -48,7 +48,7 @@
!UNPARSE: !$OMP REQUIRES DEVICE_SAFESYNC
-!PARSE-TREE: OpenMPDeclarativeConstruct -> OpenMPRequiresConstruct -> OmpDirectiveSpecification
+!PARSE-TREE: OpenMPDeclarativeConstruct -> OmpRequiresDirective -> OmpDirectiveSpecification
!PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = requires
!PARSE-TREE: | OmpClauseList -> OmpClause -> DeviceSafesync
!PARSE-TREE: | Flags = {}
diff --git a/flang/test/Parser/OpenMP/threadprivate.f90 b/flang/test/Parser/OpenMP/threadprivate.f90
index b7dfd952bb4a7..e03bf6f7f94b9 100644
--- a/flang/test/Parser/OpenMP/threadprivate.f90
+++ b/flang/test/Parser/OpenMP/threadprivate.f90
@@ -17,7 +17,7 @@ module m
!UNPARSE: !$OMP THREADPRIVATE(/blk/, b)
!UNPARSE: END MODULE
-!PARSE-TREE: DeclarationConstruct -> SpecificationConstruct -> OpenMPDeclarativeConstruct -> OpenMPThreadprivate -> OmpDirectiveSpecification
+!PARSE-TREE: DeclarationConstruct -> SpecificationConstruct -> OpenMPDeclarativeConstruct -> OmpThreadprivateDirective -> OmpDirectiveSpecification
!PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = threadprivate
!PARSE-TREE: | OmpArgumentList -> OmpArgument -> OmpLocator -> OmpObject -> Name = 'blk'
!PARSE-TREE: | OmpArgument -> OmpLocator -> OmpObject -> Designator -> DataRef -> Name = 'b'
diff --git a/flang/test/Semantics/OpenMP/simd-only.f90 b/flang/test/Semantics/OpenMP/simd-only.f90
index 8205b98ac6663..91c3eaf76d43d 100644
--- a/flang/test/Semantics/OpenMP/simd-only.f90
+++ b/flang/test/Semantics/OpenMP/simd-only.f90
@@ -253,7 +253,7 @@ module test_threadprivate_mod
! CHECK: Name = 'x'
! CHECK: Name = 'y'
common /vars/ x, y
- ! CHECK-NOT: DeclarationConstruct -> SpecificationConstruct -> OpenMPDeclarativeConstruct -> OpenMPThreadprivate
+ ! CHECK-NOT: DeclarationConstruct -> SpecificationConstruct -> OpenMPDeclarativeConstruct -> OmpThreadprivateDirective
!$omp threadprivate(/vars/)
end module
More information about the flang-commits
mailing list