Skip to content

Commit 9a07a37

Browse files
committed
Revert "Remove DirectiveSpecification"
This reverts commit 0e317db.
1 parent 7347b9b commit 9a07a37

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

flang/include/flang/Parser/parse-tree.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3456,6 +3456,14 @@ WRAPPER_CLASS(PauseStmt, std::optional<StopCode>);
34563456
struct OmpClause;
34573457
struct OmpClauseList;
34583458

3459+
struct OmpDirectiveSpecification {
3460+
TUPLE_CLASS_BOILERPLATE(OmpDirectiveSpecification);
3461+
std::tuple<llvm::omp::Directive,
3462+
std::optional<common::Indirection<OmpClauseList>>>
3463+
t;
3464+
CharBlock source;
3465+
};
3466+
34593467
// 2.1 Directives or clauses may accept a list or extended-list.
34603468
// A list item is a variable, array section or common block name (enclosed
34613469
// in slashes). An extended list item is a list item or a procedure Name.

flang/lib/Parser/openmp-parsers.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,9 @@ static TypeDeclarationStmt makeIterSpecDecl(std::list<ObjectName> &&names) {
153153
makeEntityList(std::move(names)));
154154
}
155155

156+
TYPE_PARSER(sourced(construct<OmpDirectiveSpecification>(
157+
OmpDirectiveNameParser{}, maybe(indirect(Parser<OmpClauseList>{})))))
158+
156159
// --- Parsers for context traits -------------------------------------
157160

158161
TYPE_PARSER(construct<OmpTraitPropertyName>( //

flang/lib/Parser/unparse.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2070,6 +2070,10 @@ class UnparseVisitor {
20702070
void Unparse(const llvm::omp::Directive &x) {
20712071
Word(llvm::omp::getOpenMPDirectiveName(x).str());
20722072
}
2073+
void Unparse(const OmpDirectiveSpecification &x) {
2074+
Walk(std::get<llvm::omp::Directive>(x.t));
2075+
Walk(std::get<std::optional<common::Indirection<OmpClauseList>>>(x.t));
2076+
}
20732077
void Unparse(const OmpTraitScore &x) {
20742078
Word("SCORE(");
20752079
Walk(x.v);

0 commit comments

Comments
 (0)