[flang-commits] [flang] [OpenMP][Flang] Fix semantic check and scoping for declare mappers (PR #140560)
Akash Banerjee via flang-commits
flang-commits at lists.llvm.org
Wed May 28 07:08:37 PDT 2025
TIFitis wrote:
> The string `.omp.default.mapper` seems to be hardcoded in many places. Can we use a single function to get this string in all places?
>
> Is it possible to retain `std::optional<Name>` in the parse-tree representation?
One place I can think of placing the string is `llvm/include/llvm/Frontend/OpenMP/OMPConstants.h`, do you have any other suggestions?
As for retaining `std::optional<Name>`, the reason to drop `std::optional` is that the name is optional in source but always carries a _default_ value attached to it along with a symbol. With the name field being optional, we end up with a dangling default symbol which makes symbol lookups weird along with scoping rules.
Secondly, I've changed it to `string` instead of `Name`, is that the name field doesn't have a data member to store non-static names, since it only has a `char*`. If we keep it as `Name` we will need other solutions in place to store the run-time generated string. The earlier iteration of this PR tried to do so but there is no clean way of doing it, and requires adding a new static storage.
Do you have any suggestions to fix these issues while also keeping the field as `std::optional<Name>`?
https://github.com/llvm/llvm-project/pull/140560
More information about the flang-commits
mailing list