Skip to content

Commit 668bd37

Browse files
committed
Reuse enum definitions from Fortran::parser
1 parent 9e45fdd commit 668bd37

File tree

1 file changed

+18
-20
lines changed

1 file changed

+18
-20
lines changed

flang/lib/Lower/OpenMP.cpp

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -361,8 +361,7 @@ struct DefinedOperator {
361361
using WrapperTrait = std::true_type;
362362
Object v;
363363
};
364-
ENUM_CLASS(IntrinsicOperator, Power, Multiply, Divide, Add, Subtract, Concat,
365-
LT, LE, EQ, NE, GE, GT, NOT, AND, OR, EQV, NEQV)
364+
using IntrinsicOperator = Fortran::parser::DefinedOperator::IntrinsicOperator;
366365
using UnionTrait = std::true_type;
367366
std::variant<DefinedOpName, IntrinsicOperator> u;
368367
};
@@ -554,10 +553,10 @@ Copyprivate make(const parser::OmpClause::Copyprivate &inp,
554553
}
555554

556555
struct Defaultmap {
557-
ENUM_CLASS(ImplicitBehavior, Alloc, To, From, Tofrom, Firstprivate, None,
558-
Default)
559-
ENUM_CLASS(VariableCategory, Scalar, Aggregate, Allocatable, Pointer)
560-
using TupleTrait = std::true_type;
556+
using ImplicitBehavior =
557+
Fortran::parser::OmpDefaultmapClause::ImplicitBehavior;
558+
using VariableCategory =
559+
Fortran::parser::OmpDefaultmapClause::VariableCategory;
561560
std::tuple<ImplicitBehavior, std::optional<VariableCategory>> t;
562561
};
563562

@@ -576,7 +575,7 @@ Defaultmap make(const parser::OmpClause::Defaultmap &inp,
576575
}
577576

578577
struct Default {
579-
ENUM_CLASS(Type, Private, Firstprivate, Shared, None)
578+
using Type = Fortran::parser::OmpDefaultClause::Type;
580579
using WrapperTrait = std::true_type;
581580
Type v;
582581
};
@@ -597,7 +596,7 @@ struct Depend {
597596
using WrapperTrait = std::true_type;
598597
List<Vec> v;
599598
};
600-
ENUM_CLASS(Type, In, Out, Inout, Source, Sink)
599+
using Type = Fortran::parser::OmpDependenceType::Type;
601600
struct InOut {
602601
using TupleTrait = std::true_type;
603602
std::tuple<Type, ObjectList> t;
@@ -644,7 +643,7 @@ Depend make(const parser::OmpClause::Depend &inp,
644643
}
645644

646645
struct Device {
647-
ENUM_CLASS(DeviceModifier, Ancestor, Device_Num)
646+
using DeviceModifier = Fortran::parser::OmpDeviceClause::DeviceModifier;
648647
using TupleTrait = std::true_type;
649648
std::tuple<std::optional<DeviceModifier>, SomeExpr> t;
650649
};
@@ -663,7 +662,7 @@ Device make(const parser::OmpClause::Device &inp,
663662
}
664663

665664
struct DeviceType {
666-
ENUM_CLASS(Type, Any, Host, Nohost)
665+
using Type = Fortran::parser::OmpDeviceTypeClause::Type;
667666
using WrapperTrait = std::true_type;
668667
Type v;
669668
};
@@ -774,9 +773,8 @@ Hint make(const parser::OmpClause::Hint &inp,
774773
}
775774

776775
struct If {
777-
ENUM_CLASS(DirectiveNameModifier, Parallel, Simd, Target, TargetData,
778-
TargetEnterData, TargetExitData, TargetUpdate, Task, Taskloop,
779-
Teams)
776+
using DirectiveNameModifier =
777+
Fortran::parser::OmpIfClause::DirectiveNameModifier;
780778
using TupleTrait = std::true_type;
781779
std::tuple<std::optional<DirectiveNameModifier>, SomeExpr> t;
782780
};
@@ -831,7 +829,7 @@ Lastprivate make(const parser::OmpClause::Lastprivate &inp,
831829

832830
struct Linear {
833831
struct Modifier {
834-
ENUM_CLASS(Type, Ref, Val, Uval)
832+
using Type = Fortran::parser::OmpLinearModifier::Type;
835833
using WrapperTrait = std::true_type;
836834
Type v;
837835
};
@@ -876,7 +874,7 @@ struct Map {
876874
struct Always {
877875
using EmptyTrait = std::true_type;
878876
};
879-
ENUM_CLASS(Type, To, From, Tofrom, Alloc, Release, Delete)
877+
using Type = Fortran::parser::OmpMapType::Type;
880878
using TupleTrait = std::true_type;
881879
std::tuple<std::optional<Always>, Type> t;
882880
};
@@ -990,8 +988,8 @@ Ordered make(const parser::OmpClause::Ordered &inp,
990988
}
991989

992990
struct Order {
993-
ENUM_CLASS(Kind, Reproducible, Unconstrained)
994-
ENUM_CLASS(Type, Concurrent)
991+
using Kind = Fortran::parser::OmpOrderModifier::Kind;
992+
using Type = Fortran::parser::OmpOrderClause::Type;
995993
using TupleTrait = std::true_type;
996994
std::tuple<std::optional<Kind>, Type> t;
997995
};
@@ -1043,7 +1041,7 @@ Private make(const parser::OmpClause::Private &inp,
10431041
}
10441042

10451043
struct ProcBind {
1046-
ENUM_CLASS(Type, Close, Master, Spread, Primary)
1044+
using Type = Fortran::parser::OmpProcBindClause::Type;
10471045
using WrapperTrait = std::true_type;
10481046
Type v;
10491047
};
@@ -1079,12 +1077,12 @@ Safelen make(const parser::OmpClause::Safelen &inp,
10791077
}
10801078

10811079
struct Schedule {
1082-
ENUM_CLASS(ModType, Monotonic, Nonmonotonic, Simd)
1080+
using ModType = Fortran::parser::OmpScheduleModifierType::ModType;
10831081
struct ScheduleModifier {
10841082
using TupleTrait = std::true_type;
10851083
std::tuple<ModType, std::optional<ModType>> t;
10861084
};
1087-
ENUM_CLASS(ScheduleType, Static, Dynamic, Guided, Auto, Runtime)
1085+
using ScheduleType = Fortran::parser::OmpScheduleClause::ScheduleType;
10881086
using TupleTrait = std::true_type;
10891087
std::tuple<std::optional<ScheduleModifier>, ScheduleType, MaybeExpr> t;
10901088
};

0 commit comments

Comments
 (0)