[PATCH] D18265: [clang-tidy] New: checker misc-assign-operator-return

Alexander Kornienko via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 30 03:07:42 PDT 2016


alexfh added a comment.

Adding the original author in case he has something to say here.


================
Comment at: clang-tidy/misc/AssignOperatorCheck.h:24
@@ +23,3 @@
+///   * Works with move-assign and assign by value.
+///   * Private and deleted operators are ignored.
+class AssignOperatorCheck : public ClangTidyCheck {
----------------
Please add:

  /// For the user-facing documentation see:
  /// http://clang.llvm.org/extra/clang-tidy/checks/misc-assign-operator.html

================
Comment at: clang-tidy/misc/MiscTidyModule.cpp:54
@@ -55,1 +53,3 @@
+    CheckFactories.registerCheck<AssignOperatorCheck>(
+        "misc-assign-operator");
     CheckFactories.registerCheck<BoolPointerImplicitConversionCheck>(
----------------
Check names usually contain hints at the class of problems they detect (e.g. "misc-inaccurate-erase" or "misc-macro-repeated-side-effects"), while `misc-assign-operator` doesn't serve this purpose and is overall a bit too vague (there's nothing wrong with assign operators per se).

I wonder whether a more specific name would be more helpful to the users. I'm thinking of something like `misc-assign-operator-conventions`. WDYT?

================
Comment at: docs/clang-tidy/checks/misc-assign-operator.rst:13
@@ +12,2 @@
+  * Private and deleted operators are ignored.
+  * The operator must always return ``*this``
----------------
nit: Please add a trailing period.


http://reviews.llvm.org/D18265





More information about the cfe-commits mailing list