[PATCH] D91893: [clang-tidy] performance-unnecessary-copy-initialization: Prevent false positives when dependent variable is modified.

Felix Berger via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 20 13:38:57 PST 2020


flx created this revision.
flx added reviewers: aaron.ballman, hokein.
Herald added subscribers: cfe-commits, xazax.hun.
Herald added a project: clang.
flx requested review of this revision.

Extend the check to not only look at the variable the unnecessarily copied
variable is initialized from, but also ensure that any variable the old variable
references is not modified.

Extend DeclRefExprUtils to also count references and pointers to const assigned
from the DeclRef we check for const usages.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D91893

Files:
  clang-tools-extra/clang-tidy/performance/UnnecessaryCopyInitialization.cpp
  clang-tools-extra/clang-tidy/utils/DeclRefExprUtils.cpp
  clang-tools-extra/clang-tidy/utils/Matchers.h
  clang-tools-extra/test/clang-tidy/checkers/performance-unnecessary-copy-initialization.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D91893.306772.patch
Type: text/x-patch
Size: 12531 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201120/3a04e3fd/attachment-0001.bin>


More information about the cfe-commits mailing list