[PATCH] D29905: [OpenMP] Pass argument to device kernel by reference when map is used.

Alexey Bataev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 11 08:28:16 PDT 2017


ABataev added inline comments.


================
Comment at: lib/Sema/SemaOpenMP.cpp:358-360
+  /// Do the check specified in \a Check to all component lists at a given level
+  /// and return true if any issue is found.
+  bool checkMappableExprComponentListsForDeclAtLevel(
----------------
gtbercea wrote:
> ABataev wrote:
> > Could you join these 2 functions into one?
> Since SI and StarI use different types of iterations the functions cannot be merged.
I still believe you can reuse this new code:
```
  bool checkMappableExprComponentListsForDecl(
      ValueDecl *VD, bool CurrentRegionOnly,
      const llvm::function_ref<
          bool(OMPClauseMappableExprCommon::MappableExprComponentListRef,
               OpenMPClauseKind)> &Check) {
    if (Stack.empty())
      return false;

    if (CurrentRegionOnly)
      return checkMappableExprComponentListsForDeclAtLevel(VD, Stack.size() - 1, Check);
    
    for (unsigned I = Stack.size(); I > 0; --I)
      if (checkMappableExprComponentListsForDeclAtLevel(VD, I - 1, Check))
        return true; 
    return false;
  }
```
or something like this.


Repository:
  rL LLVM

https://reviews.llvm.org/D29905





More information about the cfe-commits mailing list