@@ -236,6 +236,9 @@ TYPE_PARSER(sourced( //
236236
237237TYPE_PARSER(construct<OmpLocatorList>(nonemptyList(Parser<OmpLocator>{})))
238238
239+ TYPE_PARSER(sourced( //
240+ construct<OmpArgumentList>(nonemptyList(Parser<OmpArgument>{}))))
241+
239242TYPE_PARSER( //
240243 construct<OmpTypeSpecifier>(Parser<DeclarationTypeSpec>{}) ||
241244 construct<OmpTypeSpecifier>(Parser<TypeSpec>{}))
@@ -1057,9 +1060,9 @@ TYPE_PARSER(sourced(construct<OmpErrorDirective>(
10571060
10581061TYPE_PARSER(sourced(construct<OmpDirectiveName>(OmpDirectiveNameParser{})))
10591062
1060- OmpDirectiveSpecification static makeFlushFromOldSyntax1 (Verbatim &&text,
1063+ OmpDirectiveSpecification static makeFlushFromOldSyntax (Verbatim &&text,
10611064 std::optional<OmpClauseList> &&clauses,
1062- std::optional<std::list<OmpArgument> > &&args,
1065+ std::optional<OmpArgumentList > &&args,
10631066 OmpDirectiveSpecification::Flags &&flags) {
10641067 return OmpDirectiveSpecification{OmpDirectiveName(text), std::move(args),
10651068 std::move(clauses), std::move(flags)};
@@ -1073,15 +1076,15 @@ TYPE_PARSER(sourced(
10731076 // lists absent in the parsed result.
10741077 // E.g. for FLUSH(x) SEQ_CST it would find no clauses following
10751078 // the directive name, parse the argument list "(x)" and stop.
1076- applyFunction<OmpDirectiveSpecification>(makeFlushFromOldSyntax1 ,
1079+ applyFunction<OmpDirectiveSpecification>(makeFlushFromOldSyntax ,
10771080 verbatim("FLUSH"_tok) / !lookAhead("("_tok),
10781081 maybe(Parser<OmpClauseList>{}),
1079- maybe(parenthesized(nonemptyList( Parser<OmpArgument >{}) )),
1082+ maybe(parenthesized(Parser<OmpArgumentList >{})),
10801083 pure(OmpDirectiveSpecification::Flags::DeprecatedSyntax))) ||
10811084 // Parse the standard syntax: directive [(arguments)] [clauses]
10821085 construct<OmpDirectiveSpecification>( //
10831086 sourced(OmpDirectiveNameParser{}),
1084- maybe(parenthesized(nonemptyList( Parser<OmpArgument >{}) )),
1087+ maybe(parenthesized(Parser<OmpArgumentList >{})),
10851088 maybe(Parser<OmpClauseList>{}),
10861089 pure(OmpDirectiveSpecification::Flags::None))))
10871090
@@ -1157,14 +1160,6 @@ TYPE_PARSER(sourced(construct<OmpLoopDirective>(first(
11571160TYPE_PARSER(sourced(construct<OmpBeginLoopDirective>(
11581161 sourced(Parser<OmpLoopDirective>{}), Parser<OmpClauseList>{})))
11591162
1160- // 2.14.2 Cancellation Point construct
1161- TYPE_PARSER(sourced(construct<OpenMPCancellationPointConstruct>(
1162- verbatim("CANCELLATION POINT"_tok), Parser<OmpClauseList>{})))
1163-
1164- // 2.14.1 Cancel construct
1165- TYPE_PARSER(sourced(construct<OpenMPCancelConstruct>(
1166- verbatim("CANCEL"_tok), Parser<OmpClauseList>{})))
1167-
11681163TYPE_PARSER(sourced(construct<OmpFailClause>(
11691164 parenthesized(indirect(Parser<OmpMemoryOrderClause>{})))))
11701165
@@ -1205,29 +1200,6 @@ TYPE_PARSER(sourced(construct<OmpAtomicClause>(
12051200TYPE_PARSER(sourced(construct<OmpAtomicClauseList>(
12061201 many(maybe(","_tok) >> sourced(Parser<OmpAtomicClause>{})))))
12071202
1208- TYPE_PARSER(sourced(construct<OpenMPDepobjConstruct>(verbatim("DEPOBJ"_tok),
1209- parenthesized(Parser<OmpObject>{}), sourced(Parser<OmpClause>{}))))
1210-
1211- static OpenMPFlushConstruct makeFlushFromOldSyntax(Verbatim &&text,
1212- std::optional<OmpClauseList> &&clauses,
1213- std::optional<OmpObjectList> &&objects) {
1214- bool oldSyntax{
1215- clauses && !clauses->v.empty() && objects && !objects->v.empty()};
1216- return OpenMPFlushConstruct{std::move(text), std::move(objects),
1217- std::move(clauses),
1218- /*TrailingClauses=*/!oldSyntax};
1219- }
1220-
1221- TYPE_PARSER(sourced( //
1222- construct<OpenMPFlushConstruct>( //
1223- applyFunction<OpenMPFlushConstruct>(makeFlushFromOldSyntax,
1224- verbatim("FLUSH"_tok), maybe(Parser<OmpClauseList>{}),
1225- maybe(parenthesized(Parser<OmpObjectList>{})))) ||
1226-
1227- construct<OpenMPFlushConstruct>( //
1228- verbatim("FLUSH"_tok), maybe(parenthesized(Parser<OmpObjectList>{})),
1229- Parser<OmpClauseList>{}, pure(/*TrailingClauses=*/true))))
1230-
12311203static bool IsSimpleStandalone(const OmpDirectiveName &name) {
12321204 switch (name.v) {
12331205 case llvm::omp::Directive::OMPD_barrier:
@@ -1249,6 +1221,36 @@ TYPE_PARSER(sourced( //
12491221 predicated(OmpDirectiveNameParser{}, IsSimpleStandalone) >=
12501222 Parser<OmpDirectiveSpecification>{})))
12511223
1224+ static inline constexpr auto IsDirective(llvm::omp::Directive dir) {
1225+ return [dir](const OmpDirectiveName &name) -> bool { return dir == name.v; };
1226+ }
1227+
1228+ TYPE_PARSER(sourced( //
1229+ construct<OpenMPFlushConstruct>(
1230+ predicated(OmpDirectiveNameParser{},
1231+ IsDirective(llvm::omp::Directive::OMPD_flush)) >=
1232+ Parser<OmpDirectiveSpecification>{})))
1233+
1234+ // 2.14.2 Cancellation Point construct
1235+ TYPE_PARSER(sourced( //
1236+ construct<OpenMPCancellationPointConstruct>(
1237+ predicated(OmpDirectiveNameParser{},
1238+ IsDirective(llvm::omp::Directive::OMPD_cancellation_point)) >=
1239+ Parser<OmpDirectiveSpecification>{})))
1240+
1241+ // 2.14.1 Cancel construct
1242+ TYPE_PARSER(sourced( //
1243+ construct<OpenMPCancelConstruct>(
1244+ predicated(OmpDirectiveNameParser{},
1245+ IsDirective(llvm::omp::Directive::OMPD_cancel)) >=
1246+ Parser<OmpDirectiveSpecification>{})))
1247+
1248+ TYPE_PARSER(sourced( //
1249+ construct<OpenMPDepobjConstruct>(
1250+ predicated(OmpDirectiveNameParser{},
1251+ IsDirective(llvm::omp::Directive::OMPD_depobj)) >=
1252+ Parser<OmpDirectiveSpecification>{})))
1253+
12521254// Standalone Constructs
12531255TYPE_PARSER(
12541256 sourced( //
0 commit comments