[PATCH] D22513: [clang-tidy] add check cppcoreguidelines-rule-of-five-and-zero

Piotr Padlewski via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 19 14:30:43 PDT 2016


Prazek added a subscriber: Prazek.

================
Comment at: clang-tidy/cppcoreguidelines/RuleOfFiveAndZeroCheck.cpp:73-77
@@ +72,7 @@
+
+  checkRuleOfFiveViolation(Result, "dtor", "destructor");
+  checkRuleOfFiveViolation(Result, "copy-ctor", "copy constructor");
+  checkRuleOfFiveViolation(Result, "copy-assign", "copy assignment operator");
+  checkRuleOfFiveViolation(Result, "move-ctor", "move constructor");
+  checkRuleOfFiveViolation(Result, "move-assign", "move assignment operator");
+}
----------------
I think it would be much better to aggregate the diagnosics.
E.g. if I declare 4 special functions then I will get 4 lines of warnings, and I won't even know what function did I forgot to declare.

So it should be better to fire diag on the first, or just one of the special function and say "class %0 defines {{list_here}} but doesn't define {{other_list}}"

================
Comment at: clang-tidy/cppcoreguidelines/RuleOfFiveAndZeroCheck.h:19
@@ +18,3 @@
+
+/// Checks for classes where some, but not all, of the special member functions
+/// are defined.
----------------
no comma after all. But I might be wrong because I am not certified grammar nazi

================
Comment at: docs/clang-tidy/checks/cppcoreguidelines-rule-of-five-and-zero.rst:11
@@ +10,3 @@
+move constructor, move assignment operator and destructor. The default can be
+supressed by explciti user-definitions. The relationship between which
+functions will be supressed by definitions of other functions is complicated
----------------
typo s/expliciti/explicit


Repository:
  rL LLVM

https://reviews.llvm.org/D22513





More information about the cfe-commits mailing list