@@ -836,9 +836,9 @@ TYPE_PARSER(construct<OmpInitClause>(
836836TYPE_PARSER(construct<OmpAlignedClause>(Parser<OmpObjectList>{},
837837 maybe(":" >> nonemptyList(Parser<OmpAlignedClause::Modifier>{}))))
838838
839- TYPE_PARSER(construct<OmpUpdateClause>(
840- construct<OmpUpdateClause>(Parser<OmpDependenceType>{}) ||
841- construct<OmpUpdateClause>(Parser<OmpTaskDependenceType>{})))
839+ TYPE_PARSER( //
840+ construct<OmpUpdateClause>(parenthesized( Parser<OmpDependenceType>{}) ) ||
841+ construct<OmpUpdateClause>(parenthesized( Parser<OmpTaskDependenceType>{})))
842842
843843TYPE_PARSER(construct<OmpOrderClause>(
844844 maybe(nonemptyList(Parser<OmpOrderClause::Modifier>{}) / ":"),
@@ -1079,7 +1079,7 @@ TYPE_PARSER( //
10791079 parenthesized(nonemptyList(name)))) ||
10801080 "UNTIED" >> construct<OmpClause>(construct<OmpClause::Untied>()) ||
10811081 "UPDATE" >> construct<OmpClause>(construct<OmpClause::Update>(
1082- parenthesized (Parser<OmpUpdateClause>{}))) ||
1082+ maybe (Parser<OmpUpdateClause>{}))) ||
10831083 "WHEN" >> construct<OmpClause>(construct<OmpClause::When>(
10841084 parenthesized(Parser<OmpWhenClause>{}))) ||
10851085 // Cancellable constructs
@@ -1313,24 +1313,30 @@ TYPE_PARSER(
13131313 endOfLine)
13141314
13151315// Directives enclosing structured-block
1316- TYPE_PARSER(construct<OmpBlockDirective>(first(
1317- "MASKED" >> pure(llvm::omp::Directive::OMPD_masked),
1318- "MASTER" >> pure(llvm::omp::Directive::OMPD_master),
1319- "ORDERED" >> pure(llvm::omp::Directive::OMPD_ordered),
1320- "PARALLEL MASKED" >> pure(llvm::omp::Directive::OMPD_parallel_masked),
1321- "PARALLEL MASTER" >> pure(llvm::omp::Directive::OMPD_parallel_master),
1322- "PARALLEL WORKSHARE" >> pure(llvm::omp::Directive::OMPD_parallel_workshare),
1323- "PARALLEL" >> pure(llvm::omp::Directive::OMPD_parallel),
1324- "SCOPE" >> pure(llvm::omp::Directive::OMPD_scope),
1325- "SINGLE" >> pure(llvm::omp::Directive::OMPD_single),
1326- "TARGET DATA" >> pure(llvm::omp::Directive::OMPD_target_data),
1327- "TARGET PARALLEL" >> pure(llvm::omp::Directive::OMPD_target_parallel),
1328- "TARGET TEAMS" >> pure(llvm::omp::Directive::OMPD_target_teams),
1329- "TARGET" >> pure(llvm::omp::Directive::OMPD_target),
1330- "TASK"_id >> pure(llvm::omp::Directive::OMPD_task),
1331- "TASKGROUP" >> pure(llvm::omp::Directive::OMPD_taskgroup),
1332- "TEAMS" >> pure(llvm::omp::Directive::OMPD_teams),
1333- "WORKSHARE" >> pure(llvm::omp::Directive::OMPD_workshare))))
1316+ TYPE_PARSER(
1317+ // In this context "TARGET UPDATE" can be parsed as a TARGET directive
1318+ // followed by an UPDATE clause. This is the only combination at the
1319+ // moment, exclude it explicitly.
1320+ (!"TARGET UPDATE"_sptok) >=
1321+ construct<OmpBlockDirective>(first(
1322+ "MASKED" >> pure(llvm::omp::Directive::OMPD_masked),
1323+ "MASTER" >> pure(llvm::omp::Directive::OMPD_master),
1324+ "ORDERED" >> pure(llvm::omp::Directive::OMPD_ordered),
1325+ "PARALLEL MASKED" >> pure(llvm::omp::Directive::OMPD_parallel_masked),
1326+ "PARALLEL MASTER" >> pure(llvm::omp::Directive::OMPD_parallel_master),
1327+ "PARALLEL WORKSHARE" >>
1328+ pure(llvm::omp::Directive::OMPD_parallel_workshare),
1329+ "PARALLEL" >> pure(llvm::omp::Directive::OMPD_parallel),
1330+ "SCOPE" >> pure(llvm::omp::Directive::OMPD_scope),
1331+ "SINGLE" >> pure(llvm::omp::Directive::OMPD_single),
1332+ "TARGET DATA" >> pure(llvm::omp::Directive::OMPD_target_data),
1333+ "TARGET PARALLEL" >> pure(llvm::omp::Directive::OMPD_target_parallel),
1334+ "TARGET TEAMS" >> pure(llvm::omp::Directive::OMPD_target_teams),
1335+ "TARGET" >> pure(llvm::omp::Directive::OMPD_target),
1336+ "TASK"_id >> pure(llvm::omp::Directive::OMPD_task),
1337+ "TASKGROUP" >> pure(llvm::omp::Directive::OMPD_taskgroup),
1338+ "TEAMS" >> pure(llvm::omp::Directive::OMPD_teams),
1339+ "WORKSHARE" >> pure(llvm::omp::Directive::OMPD_workshare))))
13341340
13351341TYPE_PARSER(sourced(construct<OmpBeginBlockDirective>(
13361342 sourced(Parser<OmpBlockDirective>{}), Parser<OmpClauseList>{})))
0 commit comments