[llvm-branch-commits] [flang] [Flang][OpenMP][MLIR] Initial derived type member map support (PR #82853)

Sergio Afonso via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Apr 23 05:50:19 PDT 2024


================
@@ -115,8 +115,7 @@ class ClauseProcessor {
   bool processMap(
       mlir::Location currentLocation, Fortran::lower::StatementContext &stmtCtx,
       mlir::omp::MapClauseOps &result,
-      llvm::SmallVectorImpl<const Fortran::semantics::Symbol *> *mapSyms =
-          nullptr,
+      llvm::SmallVectorImpl<const Fortran::semantics::Symbol *> *mapSyms,
----------------
skatrak wrote:

If `mapSyms` is no longer optional, then it should be passed as a reference rather than as a pointer here. However, I don't think it should be, since it's not always needed by the caller (at least currently).

I think the proper solution would be to do something like this in `processMap`:
```c++
llvm::SmallVector<const Fortran::semantics::Symbol *> localMapSyms;
llvm::SmallVectorImpl<const Fortran::semantics::Symbol *> *ptrMapSyms =
    mapSyms ? mapSyms : &localMapSyms;
// Use ptrMapSyms instead of mapSyms...
```
Let me know what you think.

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


More information about the llvm-branch-commits mailing list