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

2023-03-27 Thread Oliver Stöneberg via Phabricator via cfe-commits
firewave added a comment. In D137205#4225006 , @Febbe wrote: > Yes, I agree, while I can't understand, why someone still wants to use only > c++11 I can totally understand, that a single Software Engineer can't do > anything about this, when the corpora

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

2023-03-27 Thread Oliver Stöneberg via Phabricator via cfe-commits
firewave added a comment. Some additional thoughts I had a while ago about something I have raised before: I think the warnings which can only be fixed with c++14 should either only be issued if that standard was specified or be behind an option. We have lots of lambda captures which could be mo

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

2022-11-19 Thread Oliver Stöneberg via Phabricator via cfe-commits
firewave added a comment. In D137205#3936944 , @firewave wrote: > I still have another false positive with static variables but have not gotten > around reducing it yet. Those false positives no longer appear. So no more open FPs from my side. Great wo

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

2022-11-18 Thread Oliver Stöneberg via Phabricator via cfe-commits
firewave added a comment. In D137205#3937298 , @Febbe wrote: > Does only a warning appear? Or also a fix? Currently, only a warning should > appear, but this is not fixable in c++11. There's no fix-it. I didn't realize that before. Maybe this should al

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

2022-11-18 Thread Oliver Stöneberg via Phabricator via cfe-commits
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 void f(const std::string&); int main() { std::string s; f(s.empty() ? "<>" : s); } input.cpp:7:26: w

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

2022-11-10 Thread Oliver Stöneberg via Phabricator via cfe-commits
firewave added a comment. I am also experiencing a crash: #include #include class Token; class Value { public: using ErrorPathItem = std::pair; using ErrorPath = std::list; explicit Value(long long val = 0)

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

2022-11-10 Thread Oliver Stöneberg via Phabricator via cfe-commits
firewave added a comment. Another false positive: #include void evaluateLibraryFunction() { std::unordered_map m; auto f = [m]() {}; } input.cpp:7:12: warning: Parameter 'm' is copied on last use, consider moving it instead. [performance-unnecessary-copy-on-la

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

2022-11-10 Thread Oliver Stöneberg via Phabricator via cfe-commits
firewave added a comment. Getting this false positive: #include 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-unnece