@@ -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 {
@@ -3723,7 +3750,7 @@ struct OmpMapClause {
37233750 // information about separator presence to emit a diagnostic if needed.
37243751 std::tuple<OmpMapperIdentifier, // Mapper name
37253752 std::optional<std::list<TypeModifier>>,
3726- std::optional<std::list<OmpIteratorModifier >>, // unique
3753+ std::optional<std::list<OmpIterator >>, // unique
37273754 std::optional<std::list<Type>>, // unique
37283755 OmpObjectList,
37293756 bool > // were the modifiers comma-separated?
@@ -3753,7 +3780,7 @@ struct OmpProcBindClause {
37533780struct OmpReductionClause {
37543781 TUPLE_CLASS_BOILERPLATE (OmpReductionClause);
37553782 ENUM_CLASS (ReductionModifier, Inscan, Task, Default)
3756- std::tuple<std::optional<ReductionModifier>, OmpReductionOperator ,
3783+ std::tuple<std::optional<ReductionModifier>, OmpReductionIdentifier ,
37573784 OmpObjectList>
37583785 t;
37593786};
@@ -3798,7 +3825,7 @@ struct OmpToClause {
37983825 // As in the case of MAP, modifiers are parsed as lists, even if they
37993826 // are unique. These restrictions will be checked in semantic checks.
38003827 std::tuple<std::optional<std::list<Expectation>>,
3801- std::optional<std::list<OmpIteratorModifier >>, OmpObjectList,
3828+ std::optional<std::list<OmpIterator >>, OmpObjectList,
38023829 bool > // were the modifiers comma-separated?
38033830 t;
38043831};
@@ -3946,7 +3973,7 @@ WRAPPER_CLASS(OmpReductionInitializerClause, Expr);
39463973struct OpenMPDeclareReductionConstruct {
39473974 TUPLE_CLASS_BOILERPLATE (OpenMPDeclareReductionConstruct);
39483975 CharBlock source;
3949- std::tuple<Verbatim, OmpReductionOperator , std::list<DeclarationTypeSpec>,
3976+ std::tuple<Verbatim, OmpReductionIdentifier , std::list<DeclarationTypeSpec>,
39503977 OmpReductionCombiner, std::optional<OmpReductionInitializerClause>>
39513978 t;
39523979};
0 commit comments