[PATCH] D45163: [Sema] -Wunused-value: diagnose unused std::move() call results.

Roman Lebedev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 3 03:29:09 PDT 2018


lebedev.ri added a comment.

In https://reviews.llvm.org/D45163#1054994, @Quuxplusone wrote:

> `std::move` would definitely be special in this regard if there were a pressing benefit to be gained — i.e., if people were currently getting bitten by accidentally discarded calls of `std::move(x)`. But you haven't shown that people are getting bitten today; in fact I think you said the opposite, right? that there were *no* instances of this happening in the real codebases you tested? So in that case, this diagnostic doesn't have a pressing benefit IMHO, and Clang could safely wait for the library vendors to do the work.


@Quuxplusone Like i said in the differential's description,

> I have seen such a problem when reviewing https://reviews.llvm.org/D43341.

https://reviews.llvm.org/D43341?vs=137245&id=139869&whitespace=ignore-most#toc

Please see `clang-doc/Representation.cpp`, left hand side of that page, line `21`:

  static void mergeInfoBase(Info &L, Info &R) {
    assert(L.USR == R.USR);
    assert(L.Name == R.Name);
    if (L.Namespace.empty()) std::move(R.Namespace); // <- here
  ...


Repository:
  rC Clang

https://reviews.llvm.org/D45163





More information about the cfe-commits mailing list