[flang-commits] [flang] [OpenMP][Flang] Fix semantic check and scoping for declare mappers (PR #140560)

Kiran Chandramohan via flang-commits flang-commits at lists.llvm.org
Wed May 28 07:44:24 PDT 2025


kiranchandramohan wrote:

> One place I can think of placing the string is `llvm/include/llvm/Frontend/OpenMP/OMPConstants.h`, do you have any other suggestions?

Sounds OK to me. Alternative locations (if you omit parser changes) are in include/flang/Semantics/openmp*.h.

> 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.

A possibility is to change it from `std::optional<Name>` to `Name`.

> 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.

We can add it to the Details in symbol.h like WithBindName,  WithOmpDeclarative, OpenACCRoutineInfo etc.


https://github.com/llvm/llvm-project/pull/140560


More information about the flang-commits mailing list