[PATCH] D137205: [clang-tidy] Add performance-unnecessary-copy-on-last-use check

Oliver Stöneberg via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 18 06:48:31 PST 2022


firewave added a comment.

The crash is gone.

The false positive with the `[m]` capture is still present with `-std=c++11`.

Here's another false positive:

  #include <string>
  
  void f(const std::string&);
  
  int main() {
      std::string s;
      f(s.empty() ? "<>" : s);
  }



  input.cpp:7:26: warning: Parameter 's' is copied on last use, consider moving it instead. [performance-unnecessary-copy-on-last-use]
      f(s.empty() ? "<>" : s);
                           ^
                           std::move( )

I still have another false positive with static variables but have not gotten around reducing it yet.

I posted the false negatives in the GitHub ticket as those do not relate to getting this approved.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137205



More information about the cfe-commits mailing list