[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) {
+ const semantics::Symbol *mapperSym = nullptr;
+
+ // Handle different mapper types
+ if constexpr (std::is_same_v<MapperType, omp::clause::DefinedOperator>) {
+ // For To/From clauses: mapper is a DefinedOperator
+ assert(mapper->size() == 1 && "more than one mapper");
+ mapperSym = mapper->front().v.id().symbol;
+ } else {
+ // For Map clause: mappers is a vector
+ assert(mapper->size() == 1 && "more than one mapper");
+ mapperSym = mapper->front().v.id().symbol;
+ }
----------------
skatrak wrote:
Both branches seem to do the same thing, am I missing something?
https://github.com/llvm/llvm-project/pull/169673
More information about the flang-commits
mailing list