[PATCH] D20277: [clang-tidy] UnnecessaryValueParamCheck - suggest std::move() if non-const value parameter can be moved.
Felix Berger via cfe-commits
cfe-commits at lists.llvm.org
Sun May 15 15:45:50 PDT 2016
flx created this revision.
flx added reviewers: alexfh, sbenza.
flx added a subscriber: cfe-commits.
flx set the repository for this revision to rL LLVM.
Make check more useful in the following two cases:
1. The parameter is passed by non-const value, has a non-deleted move constructor and is only referenced once in the function as argument to the type's copy constructor.
2. The parameter is passed by non-const value, has a non-deleted move assignment operator and is only referenced once in the function as argument of the the type's copy assignment operator.
In this case suggest a fix to move the parameter which avoids the unnecessary copy and is closest to what the user might have intended.
Repository:
rL LLVM
http://reviews.llvm.org/D20277
Files:
clang-tidy/performance/UnnecessaryValueParamCheck.cpp
clang-tidy/performance/UnnecessaryValueParamCheck.h
clang-tidy/utils/CMakeLists.txt
clang-tidy/utils/DeclRefExprUtils.cpp
clang-tidy/utils/DeclRefExprUtils.h
clang-tidy/utils/Matchers.h
clang-tidy/utils/TypeTraits.cpp
clang-tidy/utils/TypeTraits.h
test/clang-tidy/performance-unnecessary-value-param.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D20277.57309.patch
Type: text/x-patch
Size: 14558 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160515/ed61a558/attachment-0001.bin>
More information about the cfe-commits
mailing list