@@ -3440,13 +3440,33 @@ struct OmpObject {
3440
3440
3441
3441
WRAPPER_CLASS (OmpObjectList, std::list<OmpObject>);
3442
3442
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
+
3443
3463
// Ref: [4.5:169-170], [5.0:255-256], [5.1:288-289]
3444
3464
//
3445
3465
// 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
3450
3470
//
3451
3471
// All of these, except SINK and SOURCE became task-dependence-type in 5.2.
3452
3472
//
@@ -3457,45 +3477,59 @@ WRAPPER_CLASS(OmpObjectList, std::list<OmpObject>);
3457
3477
// vector). This would accept the vector "i, j, k" (although interpreted
3458
3478
// incorrectly), while flagging a syntax error for "i+1, j, k".
3459
3479
struct 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 );
3462
3482
};
3463
3483
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 ]
3465
3485
//
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>);
3473
3490
};
3474
3491
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);
3481
3499
};
3482
3500
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);
3489
3511
std::variant<DefinedOperator, ProcedureDesignator> u;
3490
3512
};
3491
3513
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
+
3492
3526
// --- Clauses
3493
3527
3494
3528
// OMP 5.0 2.10.1 affinity([aff-modifier:] locator-list)
3495
3529
// aff-modifier: interator-modifier
3496
3530
struct OmpAffinityClause {
3497
3531
TUPLE_CLASS_BOILERPLATE (OmpAffinityClause);
3498
- std::tuple<std::optional<OmpIteratorModifier >, OmpObjectList> t;
3532
+ std::tuple<std::optional<OmpIterator >, OmpObjectList> t;
3499
3533
};
3500
3534
3501
3535
// 2.8.1 aligned-clause -> ALIGNED (variable-name-list[ : scalar-constant])
@@ -3566,7 +3600,7 @@ WRAPPER_CLASS(OmpIterationVector, std::list<OmpIteration>);
3566
3600
// OmpDoacrossClause), so that the context in TYPE_CONTEXT_PARSER can be set
3567
3601
// separately for OmpDependClause and OmpDoacrossClause.
3568
3602
struct OmpDoacross {
3569
- OmpDependenceType::Type GetDepType () const ;
3603
+ OmpDependenceType::Value GetDepType () const ;
3570
3604
3571
3605
WRAPPER_CLASS (Sink, OmpIterationVector);
3572
3606
EMPTY_CLASS (Source);
@@ -3586,10 +3620,9 @@ struct OmpDoacross {
3586
3620
struct OmpDependClause {
3587
3621
UNION_CLASS_BOILERPLATE (OmpDependClause);
3588
3622
struct TaskDep {
3589
- OmpTaskDependenceType::Type GetTaskDepType () const ;
3623
+ OmpTaskDependenceType::Value GetTaskDepType () const ;
3590
3624
TUPLE_CLASS_BOILERPLATE (TaskDep);
3591
- std::tuple<std::optional<OmpIteratorModifier>, OmpTaskDependenceType,
3592
- OmpObjectList>
3625
+ std::tuple<std::optional<OmpIterator>, OmpTaskDependenceType, OmpObjectList>
3593
3626
t;
3594
3627
};
3595
3628
std::variant<TaskDep, OmpDoacross> u;
@@ -3632,7 +3665,7 @@ struct OmpFromClause {
3632
3665
// As in the case of MAP, modifiers are parsed as lists, even if they
3633
3666
// are unique. These restrictions will be checked in semantic checks.
3634
3667
std::tuple<std::optional<std::list<Expectation>>,
3635
- std::optional<std::list<OmpIteratorModifier >>, OmpObjectList,
3668
+ std::optional<std::list<OmpIterator >>, OmpObjectList,
3636
3669
bool > // were the modifiers comma-separated?
3637
3670
t;
3638
3671
};
@@ -3661,7 +3694,7 @@ struct OmpDetachClause {
3661
3694
// variable-name-list)
3662
3695
struct OmpInReductionClause {
3663
3696
TUPLE_CLASS_BOILERPLATE (OmpInReductionClause);
3664
- std::tuple<OmpReductionOperator , OmpObjectList> t;
3697
+ std::tuple<OmpReductionIdentifier , OmpObjectList> t;
3665
3698
};
3666
3699
3667
3700
// OMP 5.0 2.19.4.5 lastprivate-clause ->
@@ -3673,12 +3706,6 @@ struct OmpLastprivateClause {
3673
3706
std::tuple<std::optional<LastprivateModifier>, OmpObjectList> t;
3674
3707
};
3675
3708
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
-
3682
3709
// 2.15.3.7 linear-clause -> LINEAR (linear-list[ : linear-step])
3683
3710
// linear-list -> list | linear-modifier(list)
3684
3711
struct OmpLinearClause {
@@ -3723,7 +3750,7 @@ struct OmpMapClause {
3723
3750
// information about separator presence to emit a diagnostic if needed.
3724
3751
std::tuple<OmpMapperIdentifier, // Mapper name
3725
3752
std::optional<std::list<TypeModifier>>,
3726
- std::optional<std::list<OmpIteratorModifier >>, // unique
3753
+ std::optional<std::list<OmpIterator >>, // unique
3727
3754
std::optional<std::list<Type>>, // unique
3728
3755
OmpObjectList,
3729
3756
bool > // were the modifiers comma-separated?
@@ -3753,7 +3780,7 @@ struct OmpProcBindClause {
3753
3780
struct OmpReductionClause {
3754
3781
TUPLE_CLASS_BOILERPLATE (OmpReductionClause);
3755
3782
ENUM_CLASS (ReductionModifier, Inscan, Task, Default)
3756
- std::tuple<std::optional<ReductionModifier>, OmpReductionOperator ,
3783
+ std::tuple<std::optional<ReductionModifier>, OmpReductionIdentifier ,
3757
3784
OmpObjectList>
3758
3785
t;
3759
3786
};
@@ -3798,7 +3825,7 @@ struct OmpToClause {
3798
3825
// As in the case of MAP, modifiers are parsed as lists, even if they
3799
3826
// are unique. These restrictions will be checked in semantic checks.
3800
3827
std::tuple<std::optional<std::list<Expectation>>,
3801
- std::optional<std::list<OmpIteratorModifier >>, OmpObjectList,
3828
+ std::optional<std::list<OmpIterator >>, OmpObjectList,
3802
3829
bool > // were the modifiers comma-separated?
3803
3830
t;
3804
3831
};
@@ -3946,7 +3973,7 @@ WRAPPER_CLASS(OmpReductionInitializerClause, Expr);
3946
3973
struct OpenMPDeclareReductionConstruct {
3947
3974
TUPLE_CLASS_BOILERPLATE (OpenMPDeclareReductionConstruct);
3948
3975
CharBlock source;
3949
- std::tuple<Verbatim, OmpReductionOperator , std::list<DeclarationTypeSpec>,
3976
+ std::tuple<Verbatim, OmpReductionIdentifier , std::list<DeclarationTypeSpec>,
3950
3977
OmpReductionCombiner, std::optional<OmpReductionInitializerClause>>
3951
3978
t;
3952
3979
};
0 commit comments