[PATCH] D87455: [clang-tidy] performance-unnecessary-copy-initialization: Restrict UnnecessaryCopyInitialization check to variables initialized from free functions without arguments
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 14 09:05:03 PDT 2020
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.
LGTM with some minor nits.
================
Comment at: clang-tools-extra/clang-tidy/performance/UnnecessaryCopyInitialization.cpp:122
// the first.
- for (unsigned int i = 1; i < CtorCall->getNumArgs(); ++i)
- if (!CtorCall->getArg(i)->isDefaultArgument())
- return;
+ if (hasNonDefaultArgs(*CtorCall, 1))
+ return;
----------------
There's no real need for this change now, so I'd roll back to the previous form (then I don't have to wonder what the `1` means at the call site).
================
Comment at: clang-tools-extra/clang-tidy/performance/UnnecessaryCopyInitialization.cpp:145
return;
+
if (ObjectArg != nullptr &&
----------------
Some spurious whitespace changes that can also be rolled back.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D87455/new/
https://reviews.llvm.org/D87455
More information about the cfe-commits
mailing list