aboutsummaryrefslogtreecommitdiff
path: root/flang/lib/Parser/executable-parsers.cpp
diff options
context:
space:
mode:
authorKatherine Rasmussen <krasmussen@lbl.gov>2024-01-02 10:40:47 -0800
committerGitHub <noreply@github.com>2024-01-02 10:40:47 -0800
commita2d7af757bc33dc91f2e038742915a146cfb0c13 (patch)
tree402e0f40d2a3dafa9634e3a8ff19073160819589 /flang/lib/Parser/executable-parsers.cpp
parent0d19a8983c05de321d8ab592995e7a36bca448ee (diff)
downloadllvm-a2d7af757bc33dc91f2e038742915a146cfb0c13.zip
llvm-a2d7af757bc33dc91f2e038742915a146cfb0c13.tar.gz
llvm-a2d7af757bc33dc91f2e038742915a146cfb0c13.tar.bz2
[flang] Add notify-type and notify-wait-stmt (#76594)
Add `notify-type` to `iso_fortran_env` module. Add `notify-wait-stmt` to the parser and add checks for constraints on the statement, `C1177` and `C1178`, from the Fortran 2023 standard. Add three semantics tests for `notify-wait-stmt`.
Diffstat (limited to 'flang/lib/Parser/executable-parsers.cpp')
-rw-r--r--flang/lib/Parser/executable-parsers.cpp21
1 files changed, 14 insertions, 7 deletions
diff --git a/flang/lib/Parser/executable-parsers.cpp b/flang/lib/Parser/executable-parsers.cpp
index 892c612..de2be01 100644
--- a/flang/lib/Parser/executable-parsers.cpp
+++ b/flang/lib/Parser/executable-parsers.cpp
@@ -92,9 +92,9 @@ TYPE_CONTEXT_PARSER("execution part"_en_US,
// close-stmt | continue-stmt | cycle-stmt | deallocate-stmt |
// endfile-stmt | error-stop-stmt | event-post-stmt | event-wait-stmt |
// exit-stmt | fail-image-stmt | flush-stmt | form-team-stmt |
-// goto-stmt | if-stmt | inquire-stmt | lock-stmt | nullify-stmt |
-// open-stmt | pointer-assignment-stmt | print-stmt | read-stmt |
-// return-stmt | rewind-stmt | stop-stmt | sync-all-stmt |
+// goto-stmt | if-stmt | inquire-stmt | lock-stmt | notify-wait-stmt |
+// nullify-stmt | open-stmt | pointer-assignment-stmt | print-stmt |
+// read-stmt | return-stmt | rewind-stmt | stop-stmt | sync-all-stmt |
// sync-images-stmt | sync-memory-stmt | sync-team-stmt | unlock-stmt |
// wait-stmt | where-stmt | write-stmt | computed-goto-stmt | forall-stmt
// R1159 continue-stmt -> CONTINUE
@@ -119,6 +119,7 @@ TYPE_PARSER(first(construct<ActionStmt>(indirect(Parser<AllocateStmt>{})),
construct<ActionStmt>(indirect(Parser<IfStmt>{})),
construct<ActionStmt>(indirect(Parser<InquireStmt>{})),
construct<ActionStmt>(indirect(Parser<LockStmt>{})),
+ construct<ActionStmt>(indirect(Parser<NotifyWaitStmt>{})),
construct<ActionStmt>(indirect(Parser<NullifyStmt>{})),
construct<ActionStmt>(indirect(Parser<OpenStmt>{})),
construct<ActionStmt>(indirect(Parser<PrintStmt>{})),
@@ -453,6 +454,13 @@ TYPE_CONTEXT_PARSER("STOP statement"_en_US,
// parse time.
TYPE_PARSER(construct<StopCode>(scalar(expr)))
+// F2030: R1166 notify-wait-stmt ->
+// NOTIFY WAIT ( notify-variable [, event-wait-spec-list] )
+TYPE_CONTEXT_PARSER("NOTIFY WAIT statement"_en_US,
+ construct<NotifyWaitStmt>(
+ "NOTIFY WAIT"_sptok >> "("_tok >> scalar(variable),
+ defaulted("," >> nonemptyList(Parser<EventWaitSpec>{})) / ")"))
+
// R1164 sync-all-stmt -> SYNC ALL [( [sync-stat-list] )]
TYPE_CONTEXT_PARSER("SYNC ALL statement"_en_US,
construct<SyncAllStmt>("SYNC ALL"_sptok >>
@@ -486,15 +494,14 @@ TYPE_CONTEXT_PARSER("EVENT POST statement"_en_US,
// EVENT WAIT ( event-variable [, event-wait-spec-list] )
TYPE_CONTEXT_PARSER("EVENT WAIT statement"_en_US,
construct<EventWaitStmt>("EVENT WAIT"_sptok >> "("_tok >> scalar(variable),
- defaulted("," >> nonemptyList(Parser<EventWaitStmt::EventWaitSpec>{})) /
- ")"))
+ defaulted("," >> nonemptyList(Parser<EventWaitSpec>{})) / ")"))
// R1174 until-spec -> UNTIL_COUNT = scalar-int-expr
constexpr auto untilSpec{"UNTIL_COUNT =" >> scalarIntExpr};
// R1173 event-wait-spec -> until-spec | sync-stat
-TYPE_PARSER(construct<EventWaitStmt::EventWaitSpec>(untilSpec) ||
- construct<EventWaitStmt::EventWaitSpec>(statOrErrmsg))
+TYPE_PARSER(construct<EventWaitSpec>(untilSpec) ||
+ construct<EventWaitSpec>(statOrErrmsg))
// R1177 team-variable -> scalar-variable
constexpr auto teamVariable{scalar(variable)};