[PATCH] D30610: [clang-tidy] Added options to cppcoreguidelines-special-member-functions check
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat Mar 4 12:32:45 PST 2017
aaron.ballman requested changes to this revision.
aaron.ballman added a comment.
This revision now requires changes to proceed.
Missing documentation changes for the new options.
================
Comment at: clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.cpp:110
+ ClassWithSpecialMembers[ID];
+ if (find(Members, Kind) == Members.end())
+ Members.push_back(Kind);
----------------
Please qualify the find with std::, here and elsewhere.
================
Comment at: clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.cpp:138
- for (const auto &C : ClassWithSpecialMembers) {
- const auto &DefinedSpecialMembers = C.second;
+void SpecialMemberFunctionsCheck::checkForMissingMembers(const ClassDefId& ID,
+ llvm::ArrayRef<SpecialMemberFunctionKind> DefinedSpecialMembers)
----------------
Formatting
================
Comment at: clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.cpp:140
+ llvm::ArrayRef<SpecialMemberFunctionKind> DefinedSpecialMembers)
+{
+ llvm::SmallVector<SpecialMemberFunctionKind, 5> MissingSpecialMembers;
----------------
{ should go up a line.
================
Comment at: clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.cpp:153
+
+ auto RequireDtor = [&]() {
+ if (!HasMember(SpecialMemberFunctionKind::DefaultDestructor) &&
----------------
Can elide the parens.
================
Comment at: clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.cpp:167
+ RequireMember(SpecialMemberFunctionKind::CopyAssignment);
+ if (!AllowMissingMoveFunctions && getLangOpts().CPlusPlus11) {
+ RequireMember(SpecialMemberFunctionKind::MoveConstructor);
----------------
This feels like a lot of code duplication.
================
Comment at: clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.h:51
private:
+ void checkForMissingMembers(const ClassDefId& ID,
+ llvm::ArrayRef<SpecialMemberFunctionKind> DefinedSpecialMembers);
----------------
You should run clang-format over the patch; the & should bind to ID.
https://reviews.llvm.org/D30610
More information about the cfe-commits
mailing list