[flang-commits] [flang] [OpenMP][Flang] Fix semantic check and scoping for declare mappers (PR #140560)
Krzysztof Parzyszek via flang-commits
flang-commits at lists.llvm.org
Tue May 27 07:44:43 PDT 2025
================
@@ -1389,8 +1389,28 @@ TYPE_PARSER(
TYPE_PARSER(sourced(construct<OpenMPDeclareTargetConstruct>(
verbatim("DECLARE TARGET"_tok), Parser<OmpDeclareTargetSpecifier>{})))
+static OmpMapperSpecifier ConstructOmpMapperSpecifier(
+ std::optional<Name> &&mapperName, TypeSpec &&typeSpec, Name &&varName) {
+ // If a name is present, parse: name ":" typeSpec "::" name
+ // This matches the syntax: <mapper-name> : <type-spec> :: <variable-name>
+ if (mapperName.has_value() && mapperName->ToString() != "default") {
+ return OmpMapperSpecifier{
+ mapperName->ToString(), std::move(typeSpec), std::move(varName)};
+ }
+ // If the name is missing, use the DerivedTypeSpec name to construct the
+ // default mapper name.
+ // This matches the syntax: <type-spec> :: <variable-name>
+ if (auto *derived = std::get_if<DerivedTypeSpec>(&typeSpec.u)) {
----------------
kparzysz wrote:
Please use bracketed initialization in the frontend.
https://github.com/llvm/llvm-project/pull/140560
More information about the flang-commits
mailing list