File tree Expand file tree Collapse file tree 7 files changed +45
-18
lines changed Expand file tree Collapse file tree 7 files changed +45
-18
lines changed Original file line number Diff line number Diff line change @@ -41,7 +41,6 @@ struct ConstructId {
41
41
MAKE_CONSTR_ID (OpenMPDeclarativeAllocate, D::OMPD_allocate);
42
42
MAKE_CONSTR_ID (OpenMPDeclareReductionConstruct, D::OMPD_declare_reduction);
43
43
MAKE_CONSTR_ID (OpenMPExecutableAllocate, D::OMPD_allocate);
44
- MAKE_CONSTR_ID (OpenMPRequiresConstruct, D::OMPD_requires);
45
44
46
45
#undef MAKE_CONSTR_ID
47
46
@@ -94,8 +93,7 @@ struct DirectiveNameScope {
94
93
return std::get<OmpBeginDirective>(x.t ).DirName ();
95
94
} else if constexpr (std::is_same_v<T, OpenMPDeclarativeAllocate> ||
96
95
std::is_same_v<T, OpenMPDeclareReductionConstruct> ||
97
- std::is_same_v<T, OpenMPExecutableAllocate> ||
98
- std::is_same_v<T, OpenMPRequiresConstruct>) {
96
+ std::is_same_v<T, OpenMPExecutableAllocate>) {
99
97
return MakeName (std::get<Verbatim>(x.t ).source , ConstructId<T>::id);
100
98
} else {
101
99
return GetFromTuple (
Original file line number Diff line number Diff line change @@ -4991,9 +4991,8 @@ struct OpenMPGroupprivate {
4991
4991
4992
4992
// 2.4 requires -> REQUIRES requires-clause[ [ [,] requires-clause]...]
4993
4993
struct OpenMPRequiresConstruct {
4994
- TUPLE_CLASS_BOILERPLATE (OpenMPRequiresConstruct);
4994
+ WRAPPER_CLASS_BOILERPLATE (OpenMPRequiresConstruct, OmpDirectiveSpecification );
4995
4995
CharBlock source;
4996
- std::tuple<Verbatim, OmpClauseList> t;
4997
4996
};
4998
4997
4999
4998
// 2.15.2 threadprivate -> THREADPRIVATE (variable-name-list)
Original file line number Diff line number Diff line change @@ -1836,7 +1836,9 @@ TYPE_PARSER(sourced( //
1836
1836
1837
1837
// 2.4 Requires construct
1838
1838
TYPE_PARSER(sourced(construct<OpenMPRequiresConstruct>(
1839
- verbatim("REQUIRES"_tok), Parser<OmpClauseList>{})))
1839
+ predicated(OmpDirectiveNameParser{},
1840
+ IsDirective(llvm::omp::Directive::OMPD_requires)) >=
1841
+ Parser<OmpDirectiveSpecification>{})))
1840
1842
1841
1843
// 2.15.2 Threadprivate directive
1842
1844
TYPE_PARSER(sourced( //
Original file line number Diff line number Diff line change @@ -2594,10 +2594,10 @@ class UnparseVisitor {
2594
2594
Put (" \n " );
2595
2595
EndOpenMP ();
2596
2596
}
2597
- void Unparse (const OpenMPRequiresConstruct &y ) {
2597
+ void Unparse (const OpenMPRequiresConstruct &x ) {
2598
2598
BeginOpenMP ();
2599
- Word (" !$OMP REQUIRES " );
2600
- Walk (std::get<OmpClauseList>(y. t ) );
2599
+ Word (" !$OMP " );
2600
+ Walk (x. v );
2601
2601
Put (" \n " );
2602
2602
EndOpenMP ();
2603
2603
}
Original file line number Diff line number Diff line change @@ -624,10 +624,6 @@ template <typename Checker> struct DirectiveSpellingVisitor {
624
624
checker_ (x.v .DirName ().source , Directive::OMPD_groupprivate);
625
625
return false ;
626
626
}
627
- bool Pre (const parser::OpenMPRequiresConstruct &x) {
628
- checker_ (std::get<parser::Verbatim>(x.t ).source , Directive::OMPD_requires);
629
- return false ;
630
- }
631
627
bool Pre (const parser::OmpBeginDirective &x) {
632
628
checker_ (x.DirName ().source , x.DirId ());
633
629
return false ;
@@ -1498,14 +1494,13 @@ void OmpStructureChecker::Leave(const parser::OpenMPDepobjConstruct &x) {
1498
1494
}
1499
1495
1500
1496
void OmpStructureChecker::Enter (const parser::OpenMPRequiresConstruct &x) {
1501
- const auto &dir{std::get<parser::Verbatim>(x. t )};
1502
- PushContextAndClauseSets (dir .source , llvm::omp::Directive::OMPD_requires );
1497
+ const auto &dirName{x. v . DirName ( )};
1498
+ PushContextAndClauseSets (dirName .source , dirName. v );
1503
1499
1504
1500
if (visitedAtomicSource_.empty ()) {
1505
1501
return ;
1506
1502
}
1507
- const auto &clauseList{std::get<parser::OmpClauseList>(x.t )};
1508
- for (const parser::OmpClause &clause : clauseList.v ) {
1503
+ for (const parser::OmpClause &clause : x.v .Clauses ().v ) {
1509
1504
llvm::omp::Clause id{clause.Id ()};
1510
1505
if (id == llvm::omp::Clause::OMPC_atomic_default_mem_order) {
1511
1506
parser::MessageFormattedText txt (
Original file line number Diff line number Diff line change @@ -523,7 +523,7 @@ class OmpAttributeVisitor : DirectiveAttributeVisitor<llvm::omp::Directive> {
523
523
// Gather information from the clauses.
524
524
Flags flags;
525
525
std::optional<common::OmpMemoryOrderType> memOrder;
526
- for (const auto &clause : std::get<parser::OmpClauseList>(x. t ).v ) {
526
+ for (const parser::OmpClause &clause : x. v . Clauses ( ).v ) {
527
527
flags |= common::visit (
528
528
common::visitors{
529
529
[&memOrder](
Original file line number Diff line number Diff line change
1
+ ! RUN: %flang_fc1 -fdebug-unparse -fopenmp -fopenmp-version=50 %s | FileCheck --ignore-case --check-prefix="UNPARSE" %s
2
+ ! RUN: %flang_fc1 -fdebug-dump-parse-tree -fopenmp -fopenmp-version=50 %s | FileCheck --check-prefix="PARSE-TREE" %s
3
+
4
+ ! $omp requires atomic_default_mem_order(seq_cst)
5
+
6
+ ! UNPARSE: !$OMP REQUIRES ATOMIC_DEFAULT_MEM_ORDER(SEQ_CST)
7
+
8
+ ! PARSE-TREE: OpenMPDeclarativeConstruct -> OpenMPRequiresConstruct -> OmpDirectiveSpecification
9
+ ! PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = requires
10
+ ! PARSE-TREE: | OmpClauseList -> OmpClause -> AtomicDefaultMemOrder -> OmpAtomicDefaultMemOrderClause -> OmpMemoryOrderType = Seq_Cst
11
+ ! PARSE-TREE: | Flags = None
12
+
13
+ ! $omp requires unified_shared_memory unified_address
14
+
15
+ ! UNPARSE: !$OMP REQUIRES UNIFIED_SHARED_MEMORY UNIFIED_ADDRESS
16
+
17
+ ! PARSE-TREE: OpenMPDeclarativeConstruct -> OpenMPRequiresConstruct -> OmpDirectiveSpecification
18
+ ! PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = requires
19
+ ! PARSE-TREE: | OmpClauseList -> OmpClause -> UnifiedSharedMemory
20
+ ! PARSE-TREE: | OmpClause -> UnifiedAddress
21
+ ! PARSE-TREE: | Flags = None
22
+
23
+ ! $omp requires dynamic_allocators reverse_offload
24
+
25
+ ! UNPARSE: !$OMP REQUIRES DYNAMIC_ALLOCATORS REVERSE_OFFLOAD
26
+
27
+ ! PARSE-TREE: OpenMPDeclarativeConstruct -> OpenMPRequiresConstruct -> OmpDirectiveSpecification
28
+ ! PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = requires
29
+ ! PARSE-TREE: | OmpClauseList -> OmpClause -> DynamicAllocators
30
+ ! PARSE-TREE: | OmpClause -> ReverseOffload
31
+ ! PARSE-TREE: | Flags = None
32
+
33
+ end
You can’t perform that action at this time.
0 commit comments