[flang-commits] [flang] [llvm] [flang][OpenMP]Add support for fail clause (PR #118683)
Mats Petersson via flang-commits
flang-commits at lists.llvm.org
Mon Dec 9 03:46:55 PST 2024
================
@@ -114,6 +114,11 @@ class SemanticsVisitor : public virtual BaseChecker, public virtual C... {
context_.set_location(std::nullopt);
}
+ // This is necessary to avoid "walking" into the Fail clause,
+ // which confuses the CheckAllowed into thinking there's another
+ // memoryorder, when it's actually the argument to the fail clause.
+ bool Pre(const parser::OmpFailClause &) { return false; }
----------------
Leporacanthicus wrote:
Ah, I see. As far as I can tell, there's nothing automatic (in OMP.td) that provides a help for the fail clause's memory order options. We'd have to write code for that somewhere. We already do a bunch of checking for memoryorder in the semantics of ATOMIC in general, and we also need to check that the fail clause doesn't appear outside of a COMPARE (at least I think that's how it's meant to work).
The alternative suggested would be a workable solution. In fact, I'm liking that more, mostly because it doesn't alter a generic class used everywhere. I'll implement that.
In both cases, we still need to know whether we're checking a memory order inside a fail clause or not - and I guess we would add an `else Say("Release memory order not allowed on FAIL clause")` in the not allowed cases (not exactly how it would be written, but conceptually).
https://github.com/llvm/llvm-project/pull/118683
More information about the flang-commits
mailing list