[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
Thu Dec 10 07:40:49 PST 2020


flx marked an inline comment as done.
flx added inline comments.


================
Comment at: clang-tools-extra/test/clang-tidy/checkers/performance-unnecessary-copy-initialization.cpp:492
+  Orig.nonConstMethod();
+}
----------------
aaron.ballman wrote:
> Making sure I understand properly, if you were calling `Orig.constMethod()` then the diagnostic should be triggered, correct? Assuming so, having those test cases would be useful.
Your understanding is correct. I validated the positive cases with the existing tests from lines 104 and 112, but those didn't have any further references to the original variable. I agree it's easier to understand when the negative and positive cases are grouped together.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91893/new/

https://reviews.llvm.org/D91893



More information about the cfe-commits mailing list