[PATCH] D70052: [clang-tidy] Add misc-mutating-copy check

Csaba Dabis via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Dec 8 23:38:15 PST 2019


Charusso accepted this revision.
Charusso added a comment.
This revision is now accepted and ready to land.

I think it is fine, but please let us wait with the final thoughts from @aaron.ballman.



================
Comment at: clang-tools-extra/clang-tidy/cert/MutatingCopyCheck.cpp:21
+static constexpr llvm::StringLiteral MutatingOperatorName = "MutatingOp";
+static constexpr llvm::StringLiteral MutatingCallName = "MutatingCall";
+
----------------
What about just "assignment" and "member-call"?


================
Comment at: clang-tools-extra/clang-tidy/cert/MutatingCopyCheck.cpp:63
+      anyOf(forEachDescendant(IsSourceMutatingAssignment),
+            forEachDescendant(IsSourceMutatingMemberCall)));
+
----------------
I think `hasDescendant()` is more appropriate compared to the slower `forEachDescendant()`.


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

https://reviews.llvm.org/D70052





More information about the cfe-commits mailing list