[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
Thu Nov 10 12:03:10 PST 2022


firewave added a comment.

Getting this false positive:

  #include <string>
  
  extern std::string str()
  {
  	std::string ret;
  	return ret.empty() ? ret : ret.substr(1);
  }



  input.cpp:6:23: warning: Parameter 'ret' is copied on last use, consider moving it instead. [performance-unnecessary-copy-on-last-use]
          return ret.empty() ? ret : ret.substr(1);
                               ^
                               std::move( )


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