[PATCH] D119370: feat: add option performance-move-const-arg.CheckMoveToConstRef

Greg Miller via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 9 13:05:53 PST 2022

devjgm created this revision.
Herald added a subscriber: carlosgalvezp.
devjgm requested review of this revision.
Herald added a project: clang-tools-extra.
Herald added a subscriber: cfe-commits.

This option allows callers to disable the warning from
that would warn on the following

  void f(const string &s);
  string s;
  f(std::move(s));  // ALLOWED if

The reason people might want to disable this check, is because it allows
callers to use `std::move()` or not based on local reasoning about the
argument, and without having to care about how the function `f` accepts
the argument. Indeed, `f` might accept the argument by const-ref today,
but change to by-value tomorrow, and if the caller had moved the
argument that they were finished with, the code would work as
efficiently as possible regardless of how `f` accepted the parameter.

  rG LLVM Github Monorepo



-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119370.407261.patch
Type: text/x-patch
Size: 4279 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220209/6e29f917/attachment-0001.bin>

More information about the cfe-commits mailing list