[flang-commits] [flang] [flang][OpenMP] Support custom mappers in target update to/from clauses (PR #169673)

Sergio Afonso via flang-commits flang-commits at lists.llvm.org
Mon Jan 12 04:26:53 PST 2026


================
@@ -1437,6 +1446,41 @@ void ClauseProcessor::processMapObjects(
   }
 }
 
+/// Extract and mangle the mapper identifier name from a mapper clause.
+/// Returns "__implicit_mapper" if no mapper is specified, or "default" if
+/// the default mapper is specified, otherwise returns the mangled mapper name.
+/// This handles both the Map clause (which uses a vector of mappers) and
+/// To/From clauses (which use a DefinedOperator).
+template <typename MapperType>
+static std::string
+getMapperIdentifier(lower::AbstractConverter &converter,
+                    const std::optional<MapperType> &mapper) {
+  std::string mapperIdName = "__implicit_mapper";
+  if (mapper) {
----------------
skatrak wrote:

Nit: Prefer [early return](https://llvm.org/docs/CodingStandards.html#use-early-exits-and-continue-to-simplify-code) to reduce nesting.

```suggestion
  if (!mapper)
    return "__implicit_mapper";
```

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


More information about the flang-commits mailing list