@@ -3440,13 +3440,33 @@ struct OmpObject {
34403440
34413441WRAPPER_CLASS (OmpObjectList, std::list<OmpObject>);
34423442
3443+ inline namespace modifier {
3444+ // For uniformity, in all keyword modifiers the name of the type defined
3445+ // by ENUM_CLASS is "Value", e.g.
3446+ // struct Foo {
3447+ // ENUM_CLASS(Value, Keyword1, Keyword2);
3448+ // };
3449+
3450+ // Ref: [5.0:47-49], [5.1:49-51], [5.2:67-69]
3451+ //
3452+ // iterator-specifier ->
3453+ // [iterator-type] iterator-identifier
3454+ // = range-specification | // since 5.0
3455+ // [iterator-type ::] iterator-identifier
3456+ // = range-specification // since 5.2
3457+ struct OmpIteratorSpecifier {
3458+ TUPLE_CLASS_BOILERPLATE (OmpIteratorSpecifier);
3459+ CharBlock source;
3460+ std::tuple<TypeDeclarationStmt, SubscriptTriplet> t;
3461+ };
3462+
34433463// Ref: [4.5:169-170], [5.0:255-256], [5.1:288-289]
34443464//
34453465// dependence-type ->
3446- // SINK | SOURCE | // since 4.5
3447- // IN | OUT | INOUT | // since 4.5, until 5.1
3448- // MUTEXINOUTSET | DEPOBJ | // since 5.0, until 5.1
3449- // INOUTSET // since 5.1, until 5.1
3466+ // SINK | SOURCE | // since 4.5
3467+ // IN | OUT | INOUT | // since 4.5, until 5.1
3468+ // MUTEXINOUTSET | DEPOBJ | // since 5.0, until 5.1
3469+ // INOUTSET // since 5.1, until 5.1
34503470//
34513471// All of these, except SINK and SOURCE became task-dependence-type in 5.2.
34523472//
@@ -3457,45 +3477,59 @@ WRAPPER_CLASS(OmpObjectList, std::list<OmpObject>);
34573477// vector). This would accept the vector "i, j, k" (although interpreted
34583478// incorrectly), while flagging a syntax error for "i+1, j, k".
34593479struct OmpDependenceType {
3460- ENUM_CLASS (Type , Sink, Source);
3461- WRAPPER_CLASS_BOILERPLATE (OmpDependenceType, Type );
3480+ ENUM_CLASS (Value , Sink, Source);
3481+ WRAPPER_CLASS_BOILERPLATE (OmpDependenceType, Value );
34623482};
34633483
3464- // Ref: [4.5:169-170], [5 .0:254-256 ], [5.1:287-289 ], [5.2:321 ]
3484+ // Ref: [5 .0:47-49 ], [5.1:49-51 ], [5.2:67-69 ]
34653485//
3466- // task-dependence-type -> // "dependence-type" in 5.1 and before
3467- // IN | OUT | INOUT | // since 4.5
3468- // MUTEXINOUTSET | DEPOBJ | // since 5.0
3469- // INOUTSET // since 5.2
3470- struct OmpTaskDependenceType {
3471- ENUM_CLASS (Type, In, Out, Inout, Inoutset, Mutexinoutset, Depobj)
3472- WRAPPER_CLASS_BOILERPLATE (OmpTaskDependenceType, Type);
3486+ // iterator-modifier ->
3487+ // ITERATOR(iterator-specifier [, ...]) // since 5.0
3488+ struct OmpIterator {
3489+ WRAPPER_CLASS_BOILERPLATE (OmpIterator, std::list<OmpIteratorSpecifier>);
34733490};
34743491
3475- // [5.0] 2.1.6 iterator-specifier -> type-declaration-stmt = subscript-triple
3476- // iterator-modifier -> iterator-specifier-list
3477- struct OmpIteratorSpecifier {
3478- TUPLE_CLASS_BOILERPLATE (OmpIteratorSpecifier);
3479- CharBlock source;
3480- std::tuple<TypeDeclarationStmt, SubscriptTriplet> t;
3492+ // Ref: [4.5:207-210], [5.0:290-293], [5.1:323-325], [5.2:117-120]
3493+ //
3494+ // linear-modifier ->
3495+ // REF | UVAL | VAL // since 4.5
3496+ struct OmpLinearModifier {
3497+ ENUM_CLASS (Value, Ref, Uval, Val);
3498+ WRAPPER_CLASS_BOILERPLATE (OmpLinearModifier, Value);
34813499};
34823500
3483- WRAPPER_CLASS (OmpIteratorModifier, std::list<OmpIteratorSpecifier>);
3484-
3485- // 2.15.3.6 reduction-identifier -> + | - | * | .AND. | .OR. | .EQV. | .NEQV. |
3486- // MAX | MIN | IAND | IOR | IEOR
3487- struct OmpReductionOperator {
3488- UNION_CLASS_BOILERPLATE (OmpReductionOperator);
3501+ // Ref: [4.5:201-207], [5.0:293-299], [5.1:325-331], [5.2:124]
3502+ //
3503+ // reduction-identifier ->
3504+ // base-language-identifier | // since 4.5
3505+ // - | // since 4.5, until 5.2
3506+ // + | * | .AND. | .OR. | .EQV. | .NEQV. | // since 4.5
3507+ // MIN | MAX | IAND | IOR | IEOR // since 4.5
3508+ //
3509+ struct OmpReductionIdentifier {
3510+ UNION_CLASS_BOILERPLATE (OmpReductionIdentifier);
34893511 std::variant<DefinedOperator, ProcedureDesignator> u;
34903512};
34913513
3514+ // Ref: [4.5:169-170], [5.0:254-256], [5.1:287-289], [5.2:321]
3515+ //
3516+ // task-dependence-type -> // "dependence-type" in 5.1 and before
3517+ // IN | OUT | INOUT | // since 4.5
3518+ // MUTEXINOUTSET | DEPOBJ | // since 5.0
3519+ // INOUTSET // since 5.2
3520+ struct OmpTaskDependenceType {
3521+ ENUM_CLASS (Value, In, Out, Inout, Inoutset, Mutexinoutset, Depobj)
3522+ WRAPPER_CLASS_BOILERPLATE (OmpTaskDependenceType, Value);
3523+ };
3524+ } // namespace modifier
3525+
34923526// --- Clauses
34933527
34943528// OMP 5.0 2.10.1 affinity([aff-modifier:] locator-list)
34953529// aff-modifier: interator-modifier
34963530struct OmpAffinityClause {
34973531 TUPLE_CLASS_BOILERPLATE (OmpAffinityClause);
3498- std::tuple<std::optional<OmpIteratorModifier >, OmpObjectList> t;
3532+ std::tuple<std::optional<OmpIterator >, OmpObjectList> t;
34993533};
35003534
35013535// 2.8.1 aligned-clause -> ALIGNED (variable-name-list[ : scalar-constant])
@@ -3566,7 +3600,7 @@ WRAPPER_CLASS(OmpIterationVector, std::list<OmpIteration>);
35663600// OmpDoacrossClause), so that the context in TYPE_CONTEXT_PARSER can be set
35673601// separately for OmpDependClause and OmpDoacrossClause.
35683602struct OmpDoacross {
3569- OmpDependenceType::Type GetDepType () const ;
3603+ OmpDependenceType::Value GetDepType () const ;
35703604
35713605 WRAPPER_CLASS (Sink, OmpIterationVector);
35723606 EMPTY_CLASS (Source);
@@ -3586,10 +3620,9 @@ struct OmpDoacross {
35863620struct OmpDependClause {
35873621 UNION_CLASS_BOILERPLATE (OmpDependClause);
35883622 struct TaskDep {
3589- OmpTaskDependenceType::Type GetTaskDepType () const ;
3623+ OmpTaskDependenceType::Value GetTaskDepType () const ;
35903624 TUPLE_CLASS_BOILERPLATE (TaskDep);
3591- std::tuple<std::optional<OmpIteratorModifier>, OmpTaskDependenceType,
3592- OmpObjectList>
3625+ std::tuple<std::optional<OmpIterator>, OmpTaskDependenceType, OmpObjectList>
35933626 t;
35943627 };
35953628 std::variant<TaskDep, OmpDoacross> u;
@@ -3632,7 +3665,7 @@ struct OmpFromClause {
36323665 // As in the case of MAP, modifiers are parsed as lists, even if they
36333666 // are unique. These restrictions will be checked in semantic checks.
36343667 std::tuple<std::optional<std::list<Expectation>>,
3635- std::optional<std::list<OmpIteratorModifier >>, OmpObjectList,
3668+ std::optional<std::list<OmpIterator >>, OmpObjectList,
36363669 bool > // were the modifiers comma-separated?
36373670 t;
36383671};
@@ -3661,7 +3694,7 @@ struct OmpDetachClause {
36613694// variable-name-list)
36623695struct OmpInReductionClause {
36633696 TUPLE_CLASS_BOILERPLATE (OmpInReductionClause);
3664- std::tuple<OmpReductionOperator , OmpObjectList> t;
3697+ std::tuple<OmpReductionIdentifier , OmpObjectList> t;
36653698};
36663699
36673700// OMP 5.0 2.19.4.5 lastprivate-clause ->
@@ -3673,12 +3706,6 @@ struct OmpLastprivateClause {
36733706 std::tuple<std::optional<LastprivateModifier>, OmpObjectList> t;
36743707};
36753708
3676- // 2.15.3.7 linear-modifier -> REF | VAL | UVAL
3677- struct OmpLinearModifier {
3678- ENUM_CLASS (Type, Ref, Val, Uval)
3679- WRAPPER_CLASS_BOILERPLATE (OmpLinearModifier, Type);
3680- };
3681-
36823709// 2.15.3.7 linear-clause -> LINEAR (linear-list[ : linear-step])
36833710// linear-list -> list | linear-modifier(list)
36843711struct OmpLinearClause {
@@ -3719,7 +3746,7 @@ struct OmpMapClause {
37193746 // In OpenMP 5.2 the non-comma syntax has been deprecated: keep the
37203747 // information about separator presence to emit a diagnostic if needed.
37213748 std::tuple<std::optional<std::list<TypeModifier>>,
3722- std::optional<std::list<OmpIteratorModifier >>, // unique
3749+ std::optional<std::list<OmpIterator >>, // unique
37233750 std::optional<std::list<Type>>, // unique
37243751 OmpObjectList,
37253752 bool > // were the modifiers comma-separated?
@@ -3749,7 +3776,7 @@ struct OmpProcBindClause {
37493776struct OmpReductionClause {
37503777 TUPLE_CLASS_BOILERPLATE (OmpReductionClause);
37513778 ENUM_CLASS (ReductionModifier, Inscan, Task, Default)
3752- std::tuple<std::optional<ReductionModifier>, OmpReductionOperator ,
3779+ std::tuple<std::optional<ReductionModifier>, OmpReductionIdentifier ,
37533780 OmpObjectList>
37543781 t;
37553782};
@@ -3794,7 +3821,7 @@ struct OmpToClause {
37943821 // As in the case of MAP, modifiers are parsed as lists, even if they
37953822 // are unique. These restrictions will be checked in semantic checks.
37963823 std::tuple<std::optional<std::list<Expectation>>,
3797- std::optional<std::list<OmpIteratorModifier >>, OmpObjectList,
3824+ std::optional<std::list<OmpIterator >>, OmpObjectList,
37983825 bool > // were the modifiers comma-separated?
37993826 t;
38003827};
@@ -3942,7 +3969,7 @@ WRAPPER_CLASS(OmpReductionInitializerClause, Expr);
39423969struct OpenMPDeclareReductionConstruct {
39433970 TUPLE_CLASS_BOILERPLATE (OpenMPDeclareReductionConstruct);
39443971 CharBlock source;
3945- std::tuple<Verbatim, OmpReductionOperator , std::list<DeclarationTypeSpec>,
3972+ std::tuple<Verbatim, OmpReductionIdentifier , std::list<DeclarationTypeSpec>,
39463973 OmpReductionCombiner, std::optional<OmpReductionInitializerClause>>
39473974 t;
39483975};
0 commit comments