Also trigger the check in the following case:
void foo() {
ExpensiveToCopy Obj; const auto UnnecessaryCopy = Obj.constReference(); Obj.onlyUsedAsConst();
}
i.e. when the object the method is called on is not const but is never modified.
Paths
| Differential D20010
[clang-tidy] UnnecessaryCopyInitialization - Extend to trigger on non-const "this" object argument if it is not modified ClosedPublic Authored by flx on May 5 2016, 7:22 PM.
Details Summary Also trigger the check in the following case: void foo() { ExpensiveToCopy Obj; const auto UnnecessaryCopy = Obj.constReference(); Obj.onlyUsedAsConst(); } i.e. when the object the method is called on is not const but is never modified.
Diff Detail Event Timelinealexfh edited edge metadata. Comment ActionsHow many more (in relative numbers) results does this check generate now?
This revision now requires changes to proceed.May 11 2016, 10:43 AM flx edited edge metadata. flx marked an inline comment as done. Comment Actions
147% more :) This revision is now accepted and ready to land.May 27 2016, 7:04 AM Closed by commit rL271239: [clang-tidy] UnnecessaryCopyInitialization - Extend to trigger on non-const… (authored by flx). · Explain WhyMay 30 2016, 5:32 PM This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 58181 clang-tidy/performance/UnnecessaryCopyInitialization.h
clang-tidy/performance/UnnecessaryCopyInitialization.cpp
test/clang-tidy/performance-unnecessary-copy-initialization.cpp
|
Please enclose inline code snippets in backquotes (this, check(), etc.).