[flang-commits] [flang] [flang][OpenMP] Delete no longer used Omp[End]CriticalDirective, NFC (PR #155099)

Krzysztof Parzyszek via flang-commits flang-commits at lists.llvm.org
Sat Aug 23 06:13:56 PDT 2025


https://github.com/kparzysz created https://github.com/llvm/llvm-project/pull/155099

None

>From c44e282fcfdb797866cbf95d8bee818bc38e8d7b Mon Sep 17 00:00:00 2001
From: Krzysztof Parzyszek <Krzysztof.Parzyszek at amd.com>
Date: Sat, 23 Aug 2025 07:52:16 -0500
Subject: [PATCH] [flang][OpenMP] Delete no longer used
 Omp[End]CriticalDirective, NFC

---
 flang/examples/FeatureList/FeatureList.cpp   |  2 --
 flang/include/flang/Parser/dump-parse-tree.h |  2 --
 flang/include/flang/Parser/openmp-utils.h    |  2 --
 flang/include/flang/Parser/parse-tree.h      | 12 ------------
 flang/lib/Parser/unparse.cpp                 | 15 ---------------
 5 files changed, 33 deletions(-)

diff --git a/flang/examples/FeatureList/FeatureList.cpp b/flang/examples/FeatureList/FeatureList.cpp
index b686430e7f583..c2f617462bd71 100644
--- a/flang/examples/FeatureList/FeatureList.cpp
+++ b/flang/examples/FeatureList/FeatureList.cpp
@@ -450,7 +450,6 @@ struct NodeVisitor {
   READ_FEATURE(OmpBeginSectionsDirective)
   READ_FEATURE(OmpClause)
   READ_FEATURE(OmpClauseList)
-  READ_FEATURE(OmpCriticalDirective)
   READ_FEATURE(OmpDeclareTargetSpecifier)
   READ_FEATURE(OmpDeclareTargetWithClause)
   READ_FEATURE(OmpDeclareTargetWithList)
@@ -472,7 +471,6 @@ struct NodeVisitor {
   READ_FEATURE(OmpIterationOffset)
   READ_FEATURE(OmpIterationVector)
   READ_FEATURE(OmpEndDirective)
-  READ_FEATURE(OmpEndCriticalDirective)
   READ_FEATURE(OmpEndLoopDirective)
   READ_FEATURE(OmpEndSectionsDirective)
   READ_FEATURE(OmpGrainsizeClause)
diff --git a/flang/include/flang/Parser/dump-parse-tree.h b/flang/include/flang/Parser/dump-parse-tree.h
index 7170dfb591fae..0f10515c118c8 100644
--- a/flang/include/flang/Parser/dump-parse-tree.h
+++ b/flang/include/flang/Parser/dump-parse-tree.h
@@ -537,7 +537,6 @@ class ParseTreeDumper {
   NODE_ENUM(OmpCloseModifier, Value)
   NODE(parser, OmpContainsClause)
   NODE(parser, OmpContextSelectorSpecification)
-  NODE(parser, OmpCriticalDirective)
   NODE(parser, OmpDeclareTargetSpecifier)
   NODE(parser, OmpDeclareTargetWithClause)
   NODE(parser, OmpDeclareTargetWithList)
@@ -572,7 +571,6 @@ class ParseTreeDumper {
   NODE(parser, OmpDynGroupprivateClause)
   NODE(OmpDynGroupprivateClause, Modifier)
   NODE(parser, OmpEndAssumeDirective)
-  NODE(parser, OmpEndCriticalDirective)
   NODE(parser, OmpEndDirective)
   NODE(parser, OmpEndLoopDirective)
   NODE(parser, OmpEndSectionsDirective)
diff --git a/flang/include/flang/Parser/openmp-utils.h b/flang/include/flang/Parser/openmp-utils.h
index 6bd578b50dc3e..b4aa6f4d41b1c 100644
--- a/flang/include/flang/Parser/openmp-utils.h
+++ b/flang/include/flang/Parser/openmp-utils.h
@@ -39,7 +39,6 @@ struct ConstructId {
   }
 
 MAKE_CONSTR_ID(OmpAssumeDirective, D::OMPD_assume);
-MAKE_CONSTR_ID(OmpCriticalDirective, D::OMPD_critical);
 MAKE_CONSTR_ID(OmpDeclareVariantDirective, D::OMPD_declare_variant);
 MAKE_CONSTR_ID(OmpErrorDirective, D::OMPD_error);
 MAKE_CONSTR_ID(OmpMetadirectiveDirective, D::OMPD_metadirective);
@@ -105,7 +104,6 @@ struct DirectiveNameScope {
       if constexpr (std::is_base_of_v<OmpBlockConstruct, T>) {
         return std::get<OmpBeginDirective>(x.t).DirName();
       } else if constexpr (std::is_same_v<T, OmpAssumeDirective> ||
-          std::is_same_v<T, OmpCriticalDirective> ||
           std::is_same_v<T, OmpDeclareVariantDirective> ||
           std::is_same_v<T, OmpErrorDirective> ||
           std::is_same_v<T, OmpMetadirectiveDirective> ||
diff --git a/flang/include/flang/Parser/parse-tree.h b/flang/include/flang/Parser/parse-tree.h
index 1d1a4a163084b..dcafb90298c23 100644
--- a/flang/include/flang/Parser/parse-tree.h
+++ b/flang/include/flang/Parser/parse-tree.h
@@ -4997,18 +4997,6 @@ struct OpenMPDeclarativeConstruct {
       u;
 };
 
-// 2.13.2 CRITICAL [Name] <block> END CRITICAL [Name]
-struct OmpCriticalDirective {
-  TUPLE_CLASS_BOILERPLATE(OmpCriticalDirective);
-  CharBlock source;
-  std::tuple<Verbatim, std::optional<Name>, OmpClauseList> t;
-};
-struct OmpEndCriticalDirective {
-  TUPLE_CLASS_BOILERPLATE(OmpEndCriticalDirective);
-  CharBlock source;
-  std::tuple<Verbatim, std::optional<Name>> t;
-};
-
 struct OpenMPCriticalConstruct : public OmpBlockConstruct {
   INHERITED_TUPLE_CLASS_BOILERPLATE(OpenMPCriticalConstruct, OmpBlockConstruct);
 };
diff --git a/flang/lib/Parser/unparse.cpp b/flang/lib/Parser/unparse.cpp
index 09dcfe60a46bc..efd351258234c 100644
--- a/flang/lib/Parser/unparse.cpp
+++ b/flang/lib/Parser/unparse.cpp
@@ -2595,21 +2595,6 @@ class UnparseVisitor {
     Word("!$OMP END ASSUME\n");
     EndOpenMP();
   }
-  void Unparse(const OmpCriticalDirective &x) {
-    BeginOpenMP();
-    Word("!$OMP CRITICAL");
-    Walk(" (", std::get<std::optional<Name>>(x.t), ")");
-    Walk(std::get<OmpClauseList>(x.t));
-    Put("\n");
-    EndOpenMP();
-  }
-  void Unparse(const OmpEndCriticalDirective &x) {
-    BeginOpenMP();
-    Word("!$OMP END CRITICAL");
-    Walk(" (", std::get<std::optional<Name>>(x.t), ")");
-    Put("\n");
-    EndOpenMP();
-  }
   void Unparse(const OpenMPCriticalConstruct &x) {
     Unparse(static_cast<const OmpBlockConstruct &>(x));
   }



More information about the flang-commits mailing list