diff options
author | erichkeane <ekeane@nvidia.com> | 2025-04-02 13:33:01 -0700 |
---|---|---|
committer | erichkeane <ekeane@nvidia.com> | 2025-04-02 13:33:18 -0700 |
commit | bb8a7a7349f9842e587cb43b2a81b3d46c1e70ef (patch) | |
tree | 9e56d5d51ab3a5c3768f53f7e8b68c84a0431a2e /clang/lib | |
parent | 2bee24632f38699f1af8fdf4daa5b28053c7ae5f (diff) | |
download | llvm-bb8a7a7349f9842e587cb43b2a81b3d46c1e70ef.zip llvm-bb8a7a7349f9842e587cb43b2a81b3d46c1e70ef.tar.gz llvm-bb8a7a7349f9842e587cb43b2a81b3d46c1e70ef.tar.bz2 |
[OpenACC] Implement 'pqr-list' has at least one 1 item.
OpenACC Github PR#499 defines the pqr-list as having at least 1 item. We
already handle that for all but 'wait', so this patch just does the work
to add it for 'wait', plus adds tests.
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Parse/ParseOpenACC.cpp | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/clang/lib/Parse/ParseOpenACC.cpp b/clang/lib/Parse/ParseOpenACC.cpp index 6c854dd..4f4ae36 100644 --- a/clang/lib/Parse/ParseOpenACC.cpp +++ b/clang/lib/Parse/ParseOpenACC.cpp @@ -1274,19 +1274,32 @@ Parser::ParseOpenACCWaitArgument(SourceLocation Loc, bool IsDirective) { ConsumeToken(); } + + // OpenACC 3.3, section 2.16: // the term 'async-argument' means a nonnegative scalar integer expression, or // one of the special values 'acc_async_noval' or 'acc_async_sync', as defined // in the C header file and the Fortran opacc module. - bool FirstArg = true; + OpenACCIntExprParseResult Res = ParseOpenACCAsyncArgument( + IsDirective ? OpenACCDirectiveKind::Wait + : OpenACCDirectiveKind::Invalid, + IsDirective ? OpenACCClauseKind::Invalid : OpenACCClauseKind::Wait, + Loc); + + if (Res.first.isInvalid() && + Res.second == OpenACCParseCanContinue::Cannot) { + Result.Failed = true; + return Result; + } + + if (Res.first.isUsable()) + Result.QueueIdExprs.push_back(Res.first.get()); + while (!getCurToken().isOneOf(tok::r_paren, tok::annot_pragma_openacc_end)) { - if (!FirstArg) { - if (ExpectAndConsume(tok::comma)) { - Result.Failed = true; - return Result; - } + if (ExpectAndConsume(tok::comma)) { + Result.Failed = true; + return Result; } - FirstArg = false; OpenACCIntExprParseResult Res = ParseOpenACCAsyncArgument( IsDirective ? OpenACCDirectiveKind::Wait |