[PATCH] D20010: [clang-tidy] UnnecessaryCopyInitialization - Extend to trigger on non-const "this" object argument if it is not modified

Felix Berger via cfe-commits cfe-commits at lists.llvm.org
Thu May 5 19:22:15 PDT 2016


flx created this revision.
flx added a subscriber: cfe-commits.
flx set the repository for this revision to rL LLVM.

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.

Repository:
  rL LLVM

http://reviews.llvm.org/D20010

Files:
  clang-tidy/performance/UnnecessaryCopyInitialization.cpp
  clang-tidy/performance/UnnecessaryCopyInitialization.h
  test/clang-tidy/performance-unnecessary-copy-initialization.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D20010.56379.patch
Type: text/x-patch
Size: 6788 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160506/b5929b24/attachment.bin>


More information about the cfe-commits mailing list