[PATCH] D114249: [clang-tidy] performance-unnecessary-copy-initialization: Fix false negative.
Felix Berger via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 23 06:40:24 PST 2021
flx accepted this revision.
flx added inline comments.
This revision is now accepted and ready to land.
================
Comment at: clang-tools-extra/test/clang-tidy/checkers/performance-unnecessary-copy-initialization.cpp:228-232
+void PositiveOperatorCallConstValueParam(const Container<ExpensiveToCopyType>* C) {
+ const auto AutoAssigned = (*C)[42];
+ // TODO-MESSAGES: [[@LINE-1]]:14: warning: the const qualified variable 'AutoAssigned'
+ // TODO-FIXES: const auto& AutoAssigned = (*C)[42];
+ AutoAssigned.constMethod();
----------------
Would you mind adding this test also to the file testing the exclusion of containers:
https://github.com/llvm/llvm-project/blob/main/clang-tools-extra/test/clang-tidy/checkers/performance-unnecessary-copy-initialization-excluded-container-types.cpp
This would cover whether the type matching of pointer types works for excluded container types.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D114249/new/
https://reviews.llvm.org/D114249
More information about the cfe-commits
mailing list