[flang-commits] [flang] [flang][OpenMP]Add parsing support for MAP(MAPPER(name) ...) (PR #116274)

Tom Eccles via flang-commits flang-commits at lists.llvm.org
Fri Nov 15 03:07:25 PST 2024


================
@@ -250,21 +249,26 @@ TYPE_PARSER(
         "TOFROM" >> pure(OmpMapClause::Type::Tofrom)))
 
 template <bool CommasEverywhere>
-static inline OmpMapClause makeMapClause(
+static inline OmpMapClause makeMapClause(OmpMapperIdentifier &&mm,
----------------
tblah wrote:

The other arguments pass by value and then move out of that value - following https://clang.llvm.org/extra/clang-tidy/checks/modernize/pass-by-value.html

It doesn't matter here because you are passing a prvalue anyway. But if the caller only had an lvalue the caller would have to construct the copy explicitly. By passing by value, the caller can move-construct the copy if there's a prvalue available (as would happen automatically here) but also has the option of creating an implicit copy of the lvalue.

I guess there are arguments for and against making the copy explicit but the other arguments of this function are pass by value so this should be kept consistent at least.

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


More information about the flang-commits mailing list