]> granicus.if.org Git - clang/commit
Add -Wpessimizing-move and -Wredundant-move warnings.
authorRichard Trieu <rtrieu@google.com>
Wed, 29 Apr 2015 01:52:17 +0000 (01:52 +0000)
committerRichard Trieu <rtrieu@google.com>
Wed, 29 Apr 2015 01:52:17 +0000 (01:52 +0000)
commitdfde981d5495068172d266177f7c73d42d96f067
tree083f9c58865752b63aa50a1d8d8d85572da26288
parentbf99a507c66e756ab713b1eaffbfcd7224e375da
Add -Wpessimizing-move and -Wredundant-move warnings.

-Wpessimizing-move warns when a call to std::move would prevent copy elision
if the argument was not wrapped in a call.  This happens when moving a local
variable in a return statement when the variable is the same type as the
return type or using a move to create a new object from a temporary object.

-Wredundant-move warns when an implicit move would already be made, so the
std::move call is not needed, such as when moving a local variable in a return
that is different from the return type.

Differential Revision: http://reviews.llvm.org/D7633

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236075 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Basic/DiagnosticGroups.td
include/clang/Basic/DiagnosticSemaKinds.td
lib/Sema/SemaInit.cpp
test/SemaCXX/warn-pessmizing-move.cpp [new file with mode: 0644]
test/SemaCXX/warn-redundant-move.cpp [new file with mode: 0644]