[flang-commits] [flang] [flang][OpenMP] move omp end directive validation to semantics (PR #154739)
Krzysztof Parzyszek via flang-commits
flang-commits at lists.llvm.org
Mon Aug 25 06:55:38 PDT 2025
================
@@ -1484,11 +1484,25 @@ struct OmpBlockConstructParser {
[](auto &&s) { return OmpEndDirective(std::move(s)); })};
} else if (auto &&body{
attempt(LooselyStructuredBlockParser{}).Parse(state)}) {
- // Try loosely-structured block with a mandatory end-directive
- if (auto end{OmpEndDirectiveParser{dir_}.Parse(state)}) {
- return OmpBlockConstruct{OmpBeginDirective(std::move(*begin)),
- std::move(*body), OmpEndDirective{std::move(*end)}};
+ // Try loosely-structured block with a mandatory end-directive.
+ auto end{maybe(OmpEndDirectiveParser{dir_}).Parse(state)};
+ // Dereference outer optional (maybe() always succeeds) and look at the
+ // inner optional.
+ bool endPresent = end->has_value();
----------------
kparzysz wrote:
Use brace initialization. Feel free to do it in a subsequent PR.
https://github.com/llvm/llvm-project/pull/154739
More information about the flang-commits
mailing list