[PATCH] D67833: [OpenMP 5.0] Codegen support to pass user-defined mapper functions to runtime

Lingda Li via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 16 06:47:30 PDT 2020


lildmh added a comment.

In D67833#2155196 <https://reviews.llvm.org/D67833#2155196>, @fhahn wrote:

> I think this change introduced the following warnings, where `auto &` is used for types that are always copied. It would be great if you could take a look.
>
>   lvm-project/clang/lib/CodeGen/CGOpenMPRuntime.cpp:8011:24: warning: loop variable 'L' is always a copy because the range of type 'clang::OMPMappableExprListClause<clang::OMPToClause>::const_component_lists_range' (aka 'iterator_range<clang::OMPMappableExprListClause<clang::OMPToClause>::const_component_lists_iterator>') does not return a reference [-Wrange-loop-analysis]
>         for (const auto &L : C->component_lists()) {
>                          ^
>   llvm-project/clang/lib/CodeGen/CGOpenMPRuntime.cpp:8011:12: note: use non-reference type 'std::__1::tuple<const clang::ValueDecl *, llvm::ArrayRef<clang::OMPClauseMappableExprCommon::MappableComponent>, const clang::ValueDecl *>'
>         for (const auto &L : C->component_lists()) {
>              ^~~~~~~~~~~~~~~
>   llvm-project/clang/lib/CodeGen/CGOpenMPRuntime.cpp:8016:24: warning: loop variable 'L' is always a copy because the range of type 'clang::OMPMappableExprListClause<clang::OMPFromClause>::const_component_lists_range' (aka 'iterator_range<clang::OMPMappableExprListClause<clang::OMPFromClause>::const_component_lists_iterator>') does not return a reference [-Wrange-loop-analysis]
>         for (const auto &L : C->component_lists()) {
>                          ^
>   llvm-project/clang/lib/CodeGen/CGOpenMPRuntime.cpp:8016:12: note: use non-reference type 'std::__1::tuple<const clang::ValueDecl *, llvm::ArrayRef<clang::OMPClauseMappableExprCommon::MappableComponent>, const clang::ValueDecl *>'
>         for (const auto &L : C->component_lists()) {
>              ^~~~~~~~~~~~~~~
>   llvm-project/clang/lib/CodeGen/CGOpenMPRuntime.cpp:8032:24: warning: loop variable 'L' is always a copy because the range of type 'clang::OMPMappableExprListClause<clang::OMPUseDevicePtrClause>::const_component_lists_range' (aka 'iterator_range<clang::OMPMappableExprListClause<clang::OMPUseDevicePtrClause>::const_component_lists_iterator>') does not return a reference [-Wrange-loop-analysis]
>         for (const auto &L : C->component_lists()) {
>                          ^
>   llvm-project/clang/lib/CodeGen/CGOpenMPRuntime.cpp:8032:12: note: use non-reference type 'std::__1::tuple<const clang::ValueDecl *, llvm::ArrayRef<clang::OMPClauseMappableExprCommon::MappableComponent>, const clang::ValueDecl *>'
>         for (const auto &L : C->component_lists()) {
>              ^~~~~~~~~~~~~~~
>   3 warnings generated.
>


Thanks, I'll fix this soon. Basically `&L` needs to be `L` instead in those 3 places. Since I don't have upload permission, it will be great if you can do the change quickly


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67833/new/

https://reviews.llvm.org/D67833





More information about the cfe-commits mailing list