[flang-commits] [flang] 3ab9975 - Revert "[flang] Enumeration Type: (PR 1/5) Foundation types + Parser" (#202408)

via flang-commits flang-commits at lists.llvm.org
Mon Jun 8 11:52:51 PDT 2026


Author: Krzysztof Parzyszek
Date: 2026-06-08T13:52:46-05:00
New Revision: 3ab997597e8a5f2920efdad01cf8c29673826ba0

URL: https://github.com/llvm/llvm-project/commit/3ab997597e8a5f2920efdad01cf8c29673826ba0
DIFF: https://github.com/llvm/llvm-project/commit/3ab997597e8a5f2920efdad01cf8c29673826ba0.diff

LOG: Revert "[flang] Enumeration Type: (PR 1/5) Foundation types + Parser" (#202408)

Reverts llvm/llvm-project#192651

It seems to be causing linker errors. Verified locally that reverting
this commit helps.
```
/usr/bin/ld: tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/type.cpp.o: in function `Fortran::evaluate::DynamicType::GetAlignment(Fortran::evaluate::TargetCharacteristics const&) const':
type.cpp:(.text._ZNK7Fortran8evaluate11DynamicType12GetAlignmentERKNS0_21TargetCharacteristicsE+0x71): undefined reference to `Fortran::semantics::DerivedTypeSpec::GetScope() const'
/usr/bin/ld: type.cpp:(.text._ZNK7Fortran8evaluate11DynamicType12GetAlignmentERKNS0_21TargetCharacteristicsE+0x87): undefined reference to `Fortran::semantics::DerivedTypeSpec::GetScope() const'
/usr/bin/ld: tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/type.cpp.o: in function `Fortran::evaluate::DynamicType::MeasureSizeInBytes(Fortran::evaluate::FoldingContext&, bool, std::optional<long>) const':
type.cpp:(.text._ZNK7Fortran8evaluate11DynamicType18MeasureSizeInBytesERNS0_14FoldingContextEbSt8optionalIlE+0x1ed): undefined reference to `Fortran::semantics::DerivedTypeSpec::GetScope() const'
/usr/bin/ld: type.cpp:(.text._ZNK7Fortran8evaluate11DynamicType18MeasureSizeInBytesERNS0_14FoldingContextEbSt8optionalIlE+0x202): undefined reference to `Fortran::semantics::DerivedTypeSpec::GetScope() const'
/usr/bin/ld: type.cpp:(.text._ZNK7Fortran8evaluate11DynamicType18MeasureSizeInBytesERNS0_14FoldingContextEbSt8optionalIlE+0x218): undefined reference to `Fortran::semantics::DerivedTypeSpec::GetScope() const'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
```

Added: 
    

Modified: 
    flang/include/flang/Parser/dump-parse-tree.h
    flang/include/flang/Parser/parse-tree.h
    flang/include/flang/Semantics/symbol.h
    flang/include/flang/Semantics/tools.h
    flang/include/flang/Semantics/type.h
    flang/lib/Evaluate/type.cpp
    flang/lib/Lower/ConvertType.cpp
    flang/lib/Parser/Fortran-parsers.cpp
    flang/lib/Parser/program-parsers.cpp
    flang/lib/Parser/unparse.cpp
    flang/lib/Semantics/resolve-names.cpp
    flang/lib/Semantics/symbol.cpp
    flang/lib/Semantics/tools.cpp
    flang/lib/Semantics/type.cpp

Removed: 
    flang/test/Parser/enumeration-type.f90


################################################################################
diff  --git a/flang/include/flang/Parser/dump-parse-tree.h b/flang/include/flang/Parser/dump-parse-tree.h
index a04d11cf817bd..ff5c7a8ec01cf 100644
--- a/flang/include/flang/Parser/dump-parse-tree.h
+++ b/flang/include/flang/Parser/dump-parse-tree.h
@@ -321,7 +321,6 @@ class ParseTreeDumper {
   NODE(parser, EndChangeTeamStmt)
   NODE(parser, EndCriticalStmt)
   NODE(parser, EndDoStmt)
-  NODE(parser, EndEnumerationTypeStmt)
   NODE(parser, EndEnumStmt)
   NODE(parser, EndForallStmt)
   NODE(parser, EndFunctionStmt)
@@ -343,9 +342,6 @@ class ParseTreeDumper {
   NODE(parser, EnumDefStmt)
   NODE(parser, Enumerator)
   NODE(parser, EnumeratorDefStmt)
-  NODE(parser, EnumerationEnumeratorStmt)
-  NODE(parser, EnumerationTypeDef)
-  NODE(parser, EnumerationTypeStmt)
   NODE(parser, EorLabel)
   NODE(parser, EquivalenceObject)
   NODE(parser, EquivalenceStmt)

diff  --git a/flang/include/flang/Parser/parse-tree.h b/flang/include/flang/Parser/parse-tree.h
index 860b92993465f..cb7a8a24e88cb 100644
--- a/flang/include/flang/Parser/parse-tree.h
+++ b/flang/include/flang/Parser/parse-tree.h
@@ -156,7 +156,6 @@ struct SubroutineSubprogram; // R1534
 // with order of the the requirement productions in the grammar.
 struct DerivedTypeDef; // R726
 struct EnumDef; // R759
-struct EnumerationTypeDef; // F2023 R766
 struct TypeDeclarationStmt; // R801
 struct AccessStmt; // R827
 struct AllocatableStmt; // R829
@@ -395,15 +394,13 @@ struct OtherSpecificationStmt {
 };
 
 // R508 specification-construct ->
-//        derived-type-def | enum-def | enumeration-type-def |
-//        generic-stmt | interface-block | parameter-stmt |
-//        procedure-declaration-stmt | other-specification-stmt |
-//        type-declaration-stmt
+//        derived-type-def | enum-def | generic-stmt | interface-block |
+//        parameter-stmt | procedure-declaration-stmt |
+//        other-specification-stmt | type-declaration-stmt
 struct SpecificationConstruct {
   UNION_CLASS_BOILERPLATE(SpecificationConstruct);
   std::variant<common::Indirection<DerivedTypeDef>,
-      common::Indirection<EnumDef>, common::Indirection<EnumerationTypeDef>,
-      Statement<common::Indirection<GenericStmt>>,
+      common::Indirection<EnumDef>, Statement<common::Indirection<GenericStmt>>,
       common::Indirection<InterfaceBlock>,
       Statement<common::Indirection<ParameterStmt>>,
       Statement<common::Indirection<OldParameterStmt>>,
@@ -1238,33 +1235,6 @@ struct EnumDef {
       t;
 };
 
-// F2023 R767 enumeration-type-stmt ->
-//        ENUMERATION TYPE [ [ , access-spec ] :: ] enumeration-type-name
-struct EnumerationTypeStmt {
-  TUPLE_CLASS_BOILERPLATE(EnumerationTypeStmt);
-  std::tuple<std::optional<AccessSpec>, Name> t;
-};
-
-// F2023 R768 enumeration-enumerator-stmt -> ENUMERATOR [ :: ]
-// enumerator-name-list
-WRAPPER_CLASS(EnumerationEnumeratorStmt, std::list<Name>);
-
-// F2023 R769 end-enumeration-type-stmt ->
-//        END ENUMERATION TYPE [ enumeration-type-name ]
-WRAPPER_CLASS(EndEnumerationTypeStmt, std::optional<Name>);
-
-// F2023 R766 enumeration-type-def ->
-//        enumeration-type-stmt
-//        enumeration-enumerator-stmt [ enumeration-enumerator-stmt ]...
-//        end-enumeration-type-stmt
-struct EnumerationTypeDef {
-  TUPLE_CLASS_BOILERPLATE(EnumerationTypeDef);
-  std::tuple<Statement<EnumerationTypeStmt>,
-      std::list<Statement<EnumerationEnumeratorStmt>>,
-      Statement<EndEnumerationTypeStmt>>
-      t;
-};
-
 // R773 ac-value -> expr | ac-implied-do
 struct AcValue {
   struct Triplet { // PGI/Intel extension

diff  --git a/flang/include/flang/Semantics/symbol.h b/flang/include/flang/Semantics/symbol.h
index b4cb768844729..f4ae9a4775743 100644
--- a/flang/include/flang/Semantics/symbol.h
+++ b/flang/include/flang/Semantics/symbol.h
@@ -526,10 +526,6 @@ class DerivedTypeDetails {
   const SymbolVector &paramDeclOrder() const { return paramDeclOrder_; }
   bool sequence() const { return sequence_; }
   bool isDECStructure() const { return isDECStructure_; }
-  bool isEnumerationType() const { return isEnumerationType_; }
-  void set_isEnumerationType(bool x = true) { isEnumerationType_ = x; }
-  int enumeratorCount() const { return enumeratorCount_; }
-  void set_enumeratorCount(int n) { enumeratorCount_ = n; }
   std::map<SourceName, SymbolRef> &finals() { return finals_; }
   const std::map<SourceName, SymbolRef> &finals() const { return finals_; }
   bool isForwardReferenced() const { return isForwardReferenced_; }
@@ -581,10 +577,6 @@ class DerivedTypeDetails {
   bool isForwardReferenced_{false};
   std::map<SourceName, const parser::Expr *> originalKindParameterMap_;
 
-  // These fields are only used if the derived type is an enumeration type.
-  bool isEnumerationType_{false};
-  int enumeratorCount_{0};
-
   friend llvm::raw_ostream &operator<<(
       llvm::raw_ostream &, const DerivedTypeDetails &);
 };

diff  --git a/flang/include/flang/Semantics/tools.h b/flang/include/flang/Semantics/tools.h
index b54204c8328d5..c6e46359ffcb3 100644
--- a/flang/include/flang/Semantics/tools.h
+++ b/flang/include/flang/Semantics/tools.h
@@ -205,8 +205,6 @@ bool IsExternal(const Symbol &);
 bool IsModuleProcedure(const Symbol &);
 bool HasCoarray(const parser::Expr &);
 bool IsAssumedType(const Symbol &);
-bool IsEnumerationType(const Symbol &);
-bool IsEnumerationType(const DerivedTypeSpec &);
 bool IsPolymorphic(const Symbol &);
 bool IsUnlimitedPolymorphic(const Symbol &);
 bool IsPolymorphicAllocatable(const Symbol &);

diff  --git a/flang/include/flang/Semantics/type.h b/flang/include/flang/Semantics/type.h
index f78fc3aeb739e..312f8a4b2075e 100644
--- a/flang/include/flang/Semantics/type.h
+++ b/flang/include/flang/Semantics/type.h
@@ -263,13 +263,7 @@ llvm::raw_ostream &operator<<(llvm::raw_ostream &, const ArraySpec &);
 // The name may not match the symbol's name in case of a USE rename.
 class DerivedTypeSpec {
 public:
-  enum class Category {
-    DerivedType,
-    IntrinsicVector,
-    PairVector,
-    QuadVector,
-    EnumerationType
-  };
+  enum class Category { DerivedType, IntrinsicVector, PairVector, QuadVector };
 
   using RawParameter = std::pair<const parser::Keyword *, ParamValue>;
   using RawParameters = std::vector<RawParameter>;
@@ -344,9 +338,6 @@ class DerivedTypeSpec {
     return category_ == Category::IntrinsicVector ||
         category_ == Category::PairVector || category_ == Category::QuadVector;
   }
-  bool IsEnumerationType() const {
-    return category_ == Category::EnumerationType;
-  }
 
 private:
   SourceName name_;

diff  --git a/flang/lib/Evaluate/type.cpp b/flang/lib/Evaluate/type.cpp
index 3f8acd7b89cd3..5de8bd23c5778 100644
--- a/flang/lib/Evaluate/type.cpp
+++ b/flang/lib/Evaluate/type.cpp
@@ -162,14 +162,6 @@ std::size_t DynamicType::GetAlignment(
         return derived_->scope()->alignment().value_or(1);
       }
       break;
-
-    // EnumerationTypes skip normal instantiation and may not have scope set.
-    case semantics::DerivedTypeSpec::Category::EnumerationType:
-      if (derived_ && derived_->GetScope()) {
-        return derived_->GetScope()->alignment().value_or(1);
-      }
-      break;
-
     case semantics::DerivedTypeSpec::Category::IntrinsicVector:
     case semantics::DerivedTypeSpec::Category::PairVector:
     case semantics::DerivedTypeSpec::Category::QuadVector:
@@ -207,21 +199,6 @@ std::optional<Expr<SubscriptInteger>> DynamicType::MeasureSizeInBytes(
     }
     break;
   case TypeCategory::Derived:
-    // EnumerationTypes might not have scope set yet, so they need to use
-    // GetScope() instead of scope().  Since EnumerationTypes are an internal
-    // only type, they can never be polymorphic, so the check in the
-    // corresponding conditional below is unnecessary here.
-    if (derived_ &&
-        (GetDerivedTypeSpec().category() ==
-            semantics::DerivedTypeSpec::Category::EnumerationType) &&
-        derived_->GetScope()) {
-      auto size{derived_->GetScope()->size()};
-      auto align{aligned ? derived_->GetScope()->alignment().value_or(0) : 0};
-      auto alignedSize{align > 0 ? ((size + align - 1) / align) * align : size};
-      return Expr<SubscriptInteger>{
-          static_cast<ConstantSubscript>(alignedSize)};
-    }
-    // Regular derived type path.
     if (!IsPolymorphic() && derived_ && derived_->scope()) {
       auto size{derived_->scope()->size()};
       auto align{aligned ? derived_->scope()->alignment().value_or(0) : 0};

diff  --git a/flang/lib/Lower/ConvertType.cpp b/flang/lib/Lower/ConvertType.cpp
index 1f5759acce5bc..974fcd44e3b05 100644
--- a/flang/lib/Lower/ConvertType.cpp
+++ b/flang/lib/Lower/ConvertType.cpp
@@ -371,9 +371,6 @@ struct TypeBuilderImpl {
                                   mlir::IntegerType::get(context, 1));
     case (Fortran::semantics::DerivedTypeSpec::Category::DerivedType):
       Fortran::common::die("Vector element type not implemented");
-    case (Fortran::semantics::DerivedTypeSpec::Category::EnumerationType):
-      Fortran::common::die(
-          "Vector element type not implemented for enumeration");
     }
   }
 

diff  --git a/flang/lib/Parser/Fortran-parsers.cpp b/flang/lib/Parser/Fortran-parsers.cpp
index 2d490cde0045a..a86b3cb37a91f 100644
--- a/flang/lib/Parser/Fortran-parsers.cpp
+++ b/flang/lib/Parser/Fortran-parsers.cpp
@@ -676,35 +676,6 @@ TYPE_PARSER(
 TYPE_PARSER(recovery("END ENUM"_tok, constructEndStmtErrorRecovery) >>
     construct<EndEnumStmt>())
 
-// F2023 R766 enumeration-type-def ->
-//        enumeration-type-stmt
-//        enumeration-enumerator-stmt [ enumeration-enumerator-stmt ]...
-//        end-enumeration-type-stmt
-TYPE_CONTEXT_PARSER("enumeration type definition"_en_US,
-    construct<EnumerationTypeDef>(statement(Parser<EnumerationTypeStmt>{}),
-        some(unambiguousStatement(Parser<EnumerationEnumeratorStmt>{})),
-        statement(Parser<EndEnumerationTypeStmt>{})))
-
-// F2023 R767 enumeration-type-stmt ->
-//        ENUMERATION TYPE [ [ , access-spec ] :: ] enumeration-type-name
-TYPE_CONTEXT_PARSER("ENUMERATION TYPE statement"_en_US,
-    construct<EnumerationTypeStmt>(
-        "ENUMERATION TYPE" >> maybe("," >> accessSpec) / "::", name) ||
-        construct<EnumerationTypeStmt>(
-            "ENUMERATION TYPE" >> construct<std::optional<AccessSpec>>(), name))
-
-// F2023 R768 enumeration-enumerator-stmt -> ENUMERATOR [ :: ]
-// enumerator-name-list
-//   (Note: distinct from R761 enumerator-def-stmt — no "= expr" allowed here)
-TYPE_CONTEXT_PARSER("ENUMERATOR statement in ENUMERATION TYPE"_en_US,
-    construct<EnumerationEnumeratorStmt>(
-        "ENUMERATOR" >> maybe("::"_tok) >> nonemptyList(name)))
-
-// F2023 R769 end-enumeration-type-stmt ->
-//        END ENUMERATION TYPE [ enumeration-type-name ]
-TYPE_PARSER(construct<EndEnumerationTypeStmt>(recovery(
-    "END ENUMERATION TYPE" >> maybe(name), namedConstructEndStmtErrorRecovery)))
-
 // R801 type-declaration-stmt ->
 //        declaration-type-spec [[, attr-spec]... ::] entity-decl-list
 constexpr auto entityDeclWithoutEqInit{

diff  --git a/flang/lib/Parser/program-parsers.cpp b/flang/lib/Parser/program-parsers.cpp
index da8cd6fa27b65..591487083a483 100644
--- a/flang/lib/Parser/program-parsers.cpp
+++ b/flang/lib/Parser/program-parsers.cpp
@@ -183,14 +183,12 @@ constexpr auto limitedSpecificationPart{inContext("specification part"_en_US,
         implicitPart, many(limitedDeclarationConstruct)))};
 
 // R508 specification-construct ->
-//        derived-type-def | enum-def |  enumeration-type-def | generic-stmt |
-//        interface-block | parameter-stmt | procedure-declaration-stmt |
+//        derived-type-def | enum-def | generic-stmt | interface-block |
+//        parameter-stmt | procedure-declaration-stmt |
 //        other-specification-stmt | type-declaration-stmt
 TYPE_CONTEXT_PARSER("specification construct"_en_US,
     first(construct<SpecificationConstruct>(indirect(Parser<DerivedTypeDef>{})),
         construct<SpecificationConstruct>(indirect(Parser<EnumDef>{})),
-        construct<SpecificationConstruct>(
-            indirect(Parser<EnumerationTypeDef>{})),
         construct<SpecificationConstruct>(
             statement(indirect(Parser<GenericStmt>{}))),
         construct<SpecificationConstruct>(indirect(interfaceBlock)),

diff  --git a/flang/lib/Parser/unparse.cpp b/flang/lib/Parser/unparse.cpp
index 7bacc3310d1d1..7f1cd3b5e27a3 100644
--- a/flang/lib/Parser/unparse.cpp
+++ b/flang/lib/Parser/unparse.cpp
@@ -431,20 +431,6 @@ class UnparseVisitor {
   void Post(const EndEnumStmt &) { // R763
     Outdent(), Word("END ENUM");
   }
-  void Unparse(const EnumerationTypeStmt &x) { // F2023 R767
-    Word("ENUMERATION TYPE");
-    Walk(", ", std::get<std::optional<AccessSpec>>(x.t));
-    Word(" :: ");
-    Walk(std::get<Name>(x.t));
-    Indent();
-  }
-  void Unparse(const EnumerationEnumeratorStmt &x) { // F2023 R768
-    Word("ENUMERATOR :: "), Walk(x.v, ", ");
-  }
-  void Unparse(const EndEnumerationTypeStmt &x) { // F2023 R769
-    Outdent(), Word("END ENUMERATION TYPE");
-    Walk(" ", x.v);
-  }
   void Unparse(const BOZLiteralConstant &x) { // R764 - R767
     Put(x.v);
   }

diff  --git a/flang/lib/Semantics/resolve-names.cpp b/flang/lib/Semantics/resolve-names.cpp
index 2a2073f29a26e..a92d73ff1bc80 100644
--- a/flang/lib/Semantics/resolve-names.cpp
+++ b/flang/lib/Semantics/resolve-names.cpp
@@ -1000,7 +1000,6 @@ class DeclarationVisitor : public ArraySpecVisitor,
   bool Pre(const parser::NamedConstant &);
   void Post(const parser::EnumDef &);
   bool Pre(const parser::Enumerator &);
-  bool Pre(const parser::EnumerationTypeDef &);
   bool Pre(const parser::AccessSpec &);
   bool Pre(const parser::AsynchronousStmt &);
   bool Pre(const parser::ContiguousStmt &);
@@ -6011,12 +6010,6 @@ bool DeclarationVisitor::Pre(const parser::Enumerator &enumerator) {
   return false;
 }
 
-bool DeclarationVisitor::Pre(const parser::EnumerationTypeDef &x) {
-  Say(std::get<parser::Statement<parser::EnumerationTypeStmt>>(x.t).source,
-      "F2023 ENUMERATION TYPEs are not yet implemented"_err_en_US);
-  return false;
-}
-
 void DeclarationVisitor::Post(const parser::EnumDef &) {
   enumerationState_ = EnumeratorState{};
 }

diff  --git a/flang/lib/Semantics/symbol.cpp b/flang/lib/Semantics/symbol.cpp
index 546ed3e2fa023..49f27ee1f249f 100644
--- a/flang/lib/Semantics/symbol.cpp
+++ b/flang/lib/Semantics/symbol.cpp
@@ -605,7 +605,6 @@ llvm::raw_ostream &operator<<(
 llvm::raw_ostream &operator<<(
     llvm::raw_ostream &os, const DerivedTypeDetails &x) {
   DumpBool(os, "sequence", x.sequence_);
-  DumpBool(os, "isEnumerationType", x.isEnumerationType_);
   DumpList(os, "components", x.componentNames_);
   return os;
 }

diff  --git a/flang/lib/Semantics/tools.cpp b/flang/lib/Semantics/tools.cpp
index 79511c93b79b4..c1ea909f21ff1 100644
--- a/flang/lib/Semantics/tools.cpp
+++ b/flang/lib/Semantics/tools.cpp
@@ -1076,17 +1076,6 @@ bool IsAssumedType(const Symbol &symbol) {
   return false;
 }
 
-bool IsEnumerationType(const Symbol &symbol) {
-  if (const auto *details{symbol.detailsIf<DerivedTypeDetails>()}) {
-    return details->isEnumerationType();
-  }
-  return false;
-}
-
-bool IsEnumerationType(const DerivedTypeSpec &derived) {
-  return derived.IsEnumerationType();
-}
-
 bool IsPolymorphic(const Symbol &symbol) {
   if (const DeclTypeSpec * type{symbol.GetType()}) {
     return type->IsPolymorphic();

diff  --git a/flang/lib/Semantics/type.cpp b/flang/lib/Semantics/type.cpp
index c905a7f29f2f0..cddb83fe6aca6 100644
--- a/flang/lib/Semantics/type.cpp
+++ b/flang/lib/Semantics/type.cpp
@@ -372,20 +372,6 @@ void DerivedTypeSpec::Instantiate(Scope &containingScope) {
     return;
   }
   instantiated_ = true;
-
-  if (IsEnumerationType()) {
-    // Enumeration types have no components, no parameters, and need
-    // no instantiation, but scope_ must be set so that callers of
-    // scope() (e.g., GetAlignment, MeasureSizeInBytes) can access
-    // the type's size and alignment.
-    scope_ = typeSymbol_.scope();
-    Scope &mutableTypeScope{const_cast<Scope &>(*scope_)};
-    if (!mutableTypeScope.derivedTypeSpec()) {
-      mutableTypeScope.set_derivedTypeSpec(*this);
-    }
-    return;
-  }
-
   auto &context{containingScope.context()};
   auto &foldingContext{context.foldingContext()};
   if (IsForwardReferenced()) {
@@ -794,10 +780,6 @@ std::string DerivedTypeSpec::VectorTypeAsFortran() const {
 std::string DerivedTypeSpec::AsFortran() const {
   std::string buf;
   llvm::raw_string_ostream ss{buf};
-  if (IsEnumerationType()) {
-    ss << "ENUMERATION TYPE :: " << originalTypeSymbol_.name();
-    return buf;
-  }
   ss << originalTypeSymbol_.name();
   if (!rawParameters_.empty()) {
     CHECK(parameters_.empty());

diff  --git a/flang/test/Parser/enumeration-type.f90 b/flang/test/Parser/enumeration-type.f90
deleted file mode 100644
index e984c127bb4e0..0000000000000
--- a/flang/test/Parser/enumeration-type.f90
+++ /dev/null
@@ -1,113 +0,0 @@
-! RUN: %flang_fc1 -fdebug-unparse-no-sema %s 2>&1 | FileCheck %s
-! RUN: %flang_fc1 -fdebug-dump-parse-tree-no-sema %s 2>&1 | FileCheck %s -check-prefix=TREE
-
-! Test parsing of F2023 enumeration type definitions (R766-R769)
-
-module m
-  ! Basic enumeration type with double-colon
-  ! CHECK: ENUMERATION TYPE :: color
-  ! CHECK: ENUMERATOR :: red, green, blue
-  ! CHECK: END ENUMERATION TYPE color
-  ! TREE: EnumerationTypeDef
-  ! TREE: EnumerationTypeStmt
-  ! TREE: Name = 'color'
-  ! TREE: EnumerationEnumeratorStmt
-  ! TREE: Name = 'red'
-  ! TREE: Name = 'green'
-  ! TREE: Name = 'blue'
-  ! TREE: EndEnumerationTypeStmt
-  ! TREE: Name = 'color'
-  enumeration type :: color
-    enumerator :: red, green, blue
-  end enumeration type color
-
-  ! Without double-colon on ENUMERATION TYPE statement
-  ! CHECK: ENUMERATION TYPE :: direction
-  ! CHECK: ENUMERATOR :: north, south, east, west
-  ! CHECK: END ENUMERATION TYPE direction
-  ! TREE: EnumerationTypeDef
-  ! TREE: EnumerationTypeStmt
-  ! TREE: Name = 'direction'
-  ! TREE: EnumerationEnumeratorStmt
-  ! TREE: Name = 'north'
-  ! TREE: Name = 'south'
-  ! TREE: Name = 'east'
-  ! TREE: Name = 'west'
-  ! TREE: EndEnumerationTypeStmt
-  ! TREE: Name = 'direction'
-  enumeration type direction
-    enumerator north, south, east, west
-  end enumeration type direction
-
-  ! With access-spec (PUBLIC)
-  ! CHECK: ENUMERATION TYPE, PUBLIC :: priority
-  ! CHECK: ENUMERATOR :: low, medium, high
-  ! CHECK: END ENUMERATION TYPE priority
-  ! TREE: EnumerationTypeDef
-  ! TREE: EnumerationTypeStmt
-  ! TREE: AccessSpec -> Kind = Public
-  ! TREE: Name = 'priority'
-  ! TREE: EnumerationEnumeratorStmt
-  ! TREE: Name = 'low'
-  ! TREE: Name = 'medium'
-  ! TREE: Name = 'high'
-  ! TREE: EndEnumerationTypeStmt
-  enumeration type, public :: priority
-    enumerator :: low, medium, high
-  end enumeration type priority
-
-  ! With access-spec (PRIVATE)
-  ! CHECK: ENUMERATION TYPE, PRIVATE :: internal_state
-  ! CHECK: ENUMERATOR :: idle, running
-  ! CHECK: END ENUMERATION TYPE internal_state
-  ! TREE: EnumerationTypeDef
-  ! TREE: EnumerationTypeStmt
-  ! TREE: AccessSpec -> Kind = Private
-  ! TREE: Name = 'internal_state'
-  ! TREE: EnumerationEnumeratorStmt
-  ! TREE: Name = 'idle'
-  ! TREE: Name = 'running'
-  ! TREE: EndEnumerationTypeStmt
-  enumeration type, private :: internal_state
-    enumerator :: idle, running
-  end enumeration type internal_state
-
-  ! Multiple ENUMERATOR statements
-  ! CHECK: ENUMERATION TYPE :: season
-  ! CHECK: ENUMERATOR :: spring
-  ! CHECK: ENUMERATOR :: summer
-  ! CHECK: ENUMERATOR :: autumn, winter
-  ! CHECK: END ENUMERATION TYPE season
-  ! TREE: EnumerationTypeDef
-  ! TREE: EnumerationTypeStmt
-  ! TREE: Name = 'season'
-  ! TREE: EnumerationEnumeratorStmt
-  ! TREE: Name = 'spring'
-  ! TREE: EnumerationEnumeratorStmt
-  ! TREE: Name = 'summer'
-  ! TREE: EnumerationEnumeratorStmt
-  ! TREE: Name = 'autumn'
-  ! TREE: Name = 'winter'
-  ! TREE: EndEnumerationTypeStmt
-  ! TREE: Name = 'season'
-  enumeration type :: season
-    enumerator :: spring
-    enumerator :: summer
-    enumerator :: autumn, winter
-  end enumeration type season
-
-  ! End statement without name
-  ! CHECK: ENUMERATION TYPE :: simple
-  ! CHECK: ENUMERATOR :: a, b
-  ! CHECK: END ENUMERATION TYPE
-  ! TREE: EnumerationTypeDef
-  ! TREE: EnumerationTypeStmt
-  ! TREE: Name = 'simple'
-  ! TREE: EnumerationEnumeratorStmt
-  ! TREE: Name = 'a'
-  ! TREE: Name = 'b'
-  ! TREE: EndEnumerationTypeStmt
-  enumeration type :: simple
-    enumerator :: a, b
-  end enumeration type
-end module


        


More information about the flang-commits mailing list