[PATCH] D114249: [clang-tidy] performance-unnecessary-copy-initialization: Fix false negative.

Clement Courbet via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 22 01:56:46 PST 2021


courbet added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/performance/UnnecessaryCopyInitialization.cpp:97
+      cxxOperatorCallExpr(callee(MethodDecl), hasArgument(0, ReceiverExpr),
+                          hasArgument(0, hasType(recordType(hasDeclaration(
+                                             ReceiverTypeDecl)))))));
----------------
flx wrote:
> Does this work if if the object argument is a pointer or a type alias? Could you add a test to confirm?
It does not work with a pointer. I plan to make it work in a separate cl, but first I need to fix `isOnlyUsedAsConst` to make more general (specifically, handle unary `*`).



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