[PATCH] D22513: [clang-tidy] add check cppcoreguidelines-special-member-functions

Alexander Kornienko via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 1 00:47:09 PDT 2016

alexfh added a comment.

Thanks for the new check! Looks awesome! A couple of late comments inline.

Comment at: clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.cpp:91
@@ +90,3 @@
+  std::initializer_list<std::pair<std::string, SpecialMemberFunctionKind>>
+      Matchers = {{"dtor", SpecialMemberFunctionKind::Destructor},
Is the explicit use of the initializer_list needed to pacify MSVC? I wonder whether std::string can be replaced with a `StringRef`?

Comment at: clang-tools-extra/trunk/test/clang-tidy/cppcoreguidelines-special-member-functions-cxx-03.cpp:6
@@ +5,3 @@
+// CHECK-MESSAGES: [[@LINE-3]]:7: warning: class 'DefinesDestructor' defines a destructor but does not define a copy constructor or a copy assignment operator [cppcoreguidelines-special-member-functions]
Native speakers can correct me, but "does not define X or Y" reads as if defining either X or Y is enough to fix the issue, while in fact we're expecting all special members to be defined. I'm not sure what the best wording would be, maybe "class 'C' defines X and Y, but does not define all other special members: T, U, V"?



More information about the cfe-commits mailing list