@@ -3457,15 +3457,7 @@ WRAPPER_CLASS(PauseStmt, std::optional<StopCode>);
3457
3457
// --- Common definitions
3458
3458
3459
3459
struct OmpClause ;
3460
- struct OmpClauseList ;
3461
-
3462
- struct OmpDirectiveSpecification {
3463
- TUPLE_CLASS_BOILERPLATE (OmpDirectiveSpecification);
3464
- std::tuple<llvm::omp::Directive,
3465
- std::optional<common::Indirection<OmpClauseList>>>
3466
- t;
3467
- CharBlock source;
3468
- };
3460
+ struct OmpDirectiveSpecification ;
3469
3461
3470
3462
// 2.1 Directives or clauses may accept a list or extended-list.
3471
3463
// A list item is a variable, array section or common block name (enclosed
@@ -3478,15 +3470,76 @@ struct OmpObject {
3478
3470
3479
3471
WRAPPER_CLASS (OmpObjectList, std::list<OmpObject>);
3480
3472
3481
- #define MODIFIER_BOILERPLATE (...) \
3482
- struct Modifier { \
3483
- using Variant = std::variant<__VA_ARGS__>; \
3484
- UNION_CLASS_BOILERPLATE (Modifier); \
3485
- CharBlock source; \
3486
- Variant u; \
3487
- }
3473
+ // Ref: [4.5:201-207], [5.0:293-299], [5.1:325-331], [5.2:124]
3474
+ //
3475
+ // reduction-identifier ->
3476
+ // base-language-identifier | // since 4.5
3477
+ // - | // since 4.5, until 5.2
3478
+ // + | * | .AND. | .OR. | .EQV. | .NEQV. | // since 4.5
3479
+ // MIN | MAX | IAND | IOR | IEOR // since 4.5
3480
+ struct OmpReductionIdentifier {
3481
+ UNION_CLASS_BOILERPLATE (OmpReductionIdentifier);
3482
+ std::variant<DefinedOperator, ProcedureDesignator> u;
3483
+ };
3488
3484
3489
- #define MODIFIERS () std::optional<std::list<Modifier>>
3485
+ // Ref: [4.5:222:6], [5.0:305:27], [5.1:337:19], [5.2:126:3-4], [6.0:240:27-28]
3486
+ //
3487
+ // combiner-expression -> // since 4.5
3488
+ // assignment-statement |
3489
+ // function-reference
3490
+ struct OmpReductionCombiner {
3491
+ UNION_CLASS_BOILERPLATE (OmpReductionCombiner);
3492
+ std::variant<AssignmentStmt, FunctionReference> u;
3493
+ };
3494
+
3495
+ inline namespace arguments {
3496
+ struct OmpTypeSpecifier {
3497
+ UNION_CLASS_BOILERPLATE (OmpTypeSpecifier);
3498
+ std::variant<TypeSpec, DeclarationTypeSpec> u;
3499
+ };
3500
+
3501
+ WRAPPER_CLASS (OmpTypeNameList, std::list<OmpTypeSpecifier>);
3502
+
3503
+ struct OmpLocator {
3504
+ UNION_CLASS_BOILERPLATE (OmpLocator);
3505
+ std::variant<OmpObject, FunctionReference> u;
3506
+ };
3507
+
3508
+ WRAPPER_CLASS (OmpLocatorList, std::list<OmpLocator>);
3509
+
3510
+ // Ref: [5.0:326:10-16], [5.1:359:5-11], [5.2:163:2-7], [6.0:293:16-21]
3511
+ //
3512
+ // mapper-specifier ->
3513
+ // [mapper-identifier :] type :: var | // since 5.0
3514
+ // DEFAULT type :: var
3515
+ struct OmpMapperSpecifier {
3516
+ // Absent mapper-identifier is equivalent to DEFAULT.
3517
+ TUPLE_CLASS_BOILERPLATE (OmpMapperSpecifier);
3518
+ std::tuple<std::optional<Name>, TypeSpec, Name> t;
3519
+ };
3520
+
3521
+ // Ref: [4.5:222:1-5], [5.0:305:20-27], [5.1:337:11-19], [5.2:139:18-23],
3522
+ // [6.0:260:16-20]
3523
+ //
3524
+ // reduction-specifier ->
3525
+ // reduction-identifier : typename-list
3526
+ // : combiner-expression // since 4.5, until 5.2
3527
+ // reduction-identifier : typename-list // since 6.0
3528
+ struct OmpReductionSpecifier {
3529
+ TUPLE_CLASS_BOILERPLATE (OmpReductionSpecifier);
3530
+ std::tuple<OmpReductionIdentifier, OmpTypeNameList,
3531
+ std::optional<OmpReductionCombiner>>
3532
+ t;
3533
+ };
3534
+
3535
+ struct OmpArgument {
3536
+ CharBlock source;
3537
+ UNION_CLASS_BOILERPLATE (OmpArgument);
3538
+ std::variant<OmpLocator, // {variable, extended, locator}-list-item
3539
+ OmpMapperSpecifier, OmpReductionSpecifier>
3540
+ u;
3541
+ };
3542
+ } // namespace arguments
3490
3543
3491
3544
inline namespace traits {
3492
3545
// trait-property-name ->
@@ -3620,6 +3673,16 @@ struct OmpContextSelectorSpecification { // Modifier
3620
3673
};
3621
3674
} // namespace traits
3622
3675
3676
+ #define MODIFIER_BOILERPLATE (...) \
3677
+ struct Modifier { \
3678
+ using Variant = std::variant<__VA_ARGS__>; \
3679
+ UNION_CLASS_BOILERPLATE (Modifier); \
3680
+ CharBlock source; \
3681
+ Variant u; \
3682
+ }
3683
+
3684
+ #define MODIFIERS () std::optional<std::list<Modifier>>
3685
+
3623
3686
inline namespace modifier {
3624
3687
// For uniformity, in all keyword modifiers the name of the type defined
3625
3688
// by ENUM_CLASS is "Value", e.g.
@@ -3832,18 +3895,6 @@ struct OmpPrescriptiveness {
3832
3895
WRAPPER_CLASS_BOILERPLATE (OmpPrescriptiveness, Value);
3833
3896
};
3834
3897
3835
- // Ref: [4.5:201-207], [5.0:293-299], [5.1:325-331], [5.2:124]
3836
- //
3837
- // reduction-identifier ->
3838
- // base-language-identifier | // since 4.5
3839
- // - | // since 4.5, until 5.2
3840
- // + | * | .AND. | .OR. | .EQV. | .NEQV. | // since 4.5
3841
- // MIN | MAX | IAND | IOR | IEOR // since 4.5
3842
- struct OmpReductionIdentifier {
3843
- UNION_CLASS_BOILERPLATE (OmpReductionIdentifier);
3844
- std::variant<DefinedOperator, ProcedureDesignator> u;
3845
- };
3846
-
3847
3898
// Ref: [5.0:300-302], [5.1:332-334], [5.2:134-137]
3848
3899
//
3849
3900
// reduction-modifier ->
@@ -3986,7 +4037,9 @@ struct OmpBindClause {
3986
4037
struct OmpDefaultClause {
3987
4038
ENUM_CLASS (DataSharingAttribute, Private, Firstprivate, Shared, None)
3988
4039
UNION_CLASS_BOILERPLATE (OmpDefaultClause);
3989
- std::variant<DataSharingAttribute, OmpDirectiveSpecification> u;
4040
+ std::variant<DataSharingAttribute,
4041
+ common::Indirection<OmpDirectiveSpecification>>
4042
+ u;
3990
4043
};
3991
4044
3992
4045
// Ref: [4.5:103-107], [5.0:324-325], [5.1:357-358], [5.2:161-162]
@@ -4251,8 +4304,8 @@ struct OmpOrderClause {
4251
4304
// otherwise-clause ->
4252
4305
// OTHERWISE ([directive-specification])] // since 5.2
4253
4306
struct OmpOtherwiseClause {
4254
- WRAPPER_CLASS_BOILERPLATE (
4255
- OmpOtherwiseClause, std::optional<OmpDirectiveSpecification>);
4307
+ WRAPPER_CLASS_BOILERPLATE (OmpOtherwiseClause,
4308
+ std::optional<common::Indirection< OmpDirectiveSpecification> >);
4256
4309
};
4257
4310
4258
4311
// Ref: [4.5:46-50], [5.0:74-78], [5.1:92-96], [5.2:229-230]
@@ -4348,7 +4401,9 @@ struct OmpUpdateClause {
4348
4401
struct OmpWhenClause {
4349
4402
TUPLE_CLASS_BOILERPLATE (OmpWhenClause);
4350
4403
MODIFIER_BOILERPLATE (OmpContextSelector);
4351
- std::tuple<MODIFIERS(), std::optional<OmpDirectiveSpecification>> t;
4404
+ std::tuple<MODIFIERS(),
4405
+ std::optional<common::Indirection<OmpDirectiveSpecification>>>
4406
+ t;
4352
4407
};
4353
4408
4354
4409
// OpenMP Clauses
@@ -4375,6 +4430,14 @@ struct OmpClauseList {
4375
4430
4376
4431
// --- Directives and constructs
4377
4432
4433
+ struct OmpDirectiveSpecification {
4434
+ CharBlock source;
4435
+ TUPLE_CLASS_BOILERPLATE (OmpDirectiveSpecification);
4436
+ std::tuple<llvm::omp::Directive, std::optional<std::list<OmpArgument>>,
4437
+ std::optional<OmpClauseList>>
4438
+ t;
4439
+ };
4440
+
4378
4441
struct OmpMetadirectiveDirective {
4379
4442
TUPLE_CLASS_BOILERPLATE (OmpMetadirectiveDirective);
4380
4443
std::tuple<OmpClauseList> t;
@@ -4475,27 +4538,16 @@ struct OpenMPDeclareTargetConstruct {
4475
4538
std::tuple<Verbatim, OmpDeclareTargetSpecifier> t;
4476
4539
};
4477
4540
4478
- struct OmpDeclareMapperSpecifier {
4479
- TUPLE_CLASS_BOILERPLATE (OmpDeclareMapperSpecifier);
4480
- std::tuple<std::optional<Name>, TypeSpec, Name> t;
4481
- };
4482
-
4483
4541
// OMP v5.2: 5.8.8
4484
4542
// declare-mapper -> DECLARE MAPPER ([mapper-name :] type :: var) map-clauses
4485
4543
struct OpenMPDeclareMapperConstruct {
4486
4544
TUPLE_CLASS_BOILERPLATE (OpenMPDeclareMapperConstruct);
4487
4545
CharBlock source;
4488
- std::tuple<Verbatim, OmpDeclareMapperSpecifier , OmpClauseList> t;
4546
+ std::tuple<Verbatim, OmpMapperSpecifier , OmpClauseList> t;
4489
4547
};
4490
4548
4491
4549
// 2.16 declare-reduction -> DECLARE REDUCTION (reduction-identifier : type-list
4492
4550
// : combiner) [initializer-clause]
4493
- struct OmpReductionCombiner {
4494
- UNION_CLASS_BOILERPLATE (OmpReductionCombiner);
4495
- WRAPPER_CLASS (FunctionCombiner, Call);
4496
- std::variant<AssignmentStmt, FunctionCombiner> u;
4497
- };
4498
-
4499
4551
WRAPPER_CLASS (OmpReductionInitializerClause, Expr);
4500
4552
4501
4553
struct OpenMPDeclareReductionConstruct {
0 commit comments