[flang-commits] [flang] [flang][OpenMP] Convert more clauses in pre-lowering (PR #172334)
Krzysztof Parzyszek via flang-commits
flang-commits at lists.llvm.org
Wed Dec 17 09:42:31 PST 2025
kparzysz wrote:
Some background:
The parser and the semantic analysis + lowering use different representation of expressions. AST uses `parser::Expr`, the rest uses `evaluate::Expr`. The conversion from AST to the "evaluate" form is done by ExpressionAnalyzer. One problem with the analyzer is that it can diagnose (and issue diagnostic messages) on its own. One example of that is that it can complain about whole assumed-size arrays used in an expression. This is bad because _we_ want to decide when to issue a message, and some such cases are legitimate. Thankfully, there is a mechanism to suppress that (via the "AllowWholeAssumedSizeArray" function), and that's what I used here.
The background here is that I'm working on doing this clause conversion very early. It willl be used to decompose compound directives and it will help rewrite the AST (and happen before any semantic checks). Currently, the semantic checks reject all cases that would trigger the assumed-size array issue in the analyzer before we get to lowering, so the makeObject functions are never called with an assumed-size array. This is not completely correct though, there are two clauses where we should accept them in OpenMP 6.0. I have a fix for that here: https://github.com/llvm/llvm-project/pull/172510.
With the fix the makeObject function are called with an actual whole assumed-size array. From the point of view of the user there is no visible effect though (i.e. no messages), but that's only because at this point we no longer print any semantic messages. The message is still generated (by the analyzer), but we are past the point where we call the function that prints all the semantic messages. The change from this PR is to stop the message from being generated in the first place.
https://github.com/llvm/llvm-project/pull/172334
More information about the flang-commits
mailing list