9 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CPPCOREGUIDELINES_SPECIAL_MEMBER_FUNCTIONS_H
10 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CPPCOREGUIDELINES_SPECIAL_MEMBER_FUNCTIONS_H
12 #include "../ClangTidyCheck.h"
14 #include "llvm/ADT/DenseMapInfo.h"
18 namespace cppcoreguidelines {
33 void check(
const ast_matchers::MatchFinder::MatchResult &Result)
override;
36 return TK_IgnoreUnlessSpelledInSource;
58 using ClassDefId = std::pair<SourceLocation, std::string>;
62 llvm::SmallVector<SpecialMemberFunctionData, 5>>;
65 void checkForMissingMembers(
67 llvm::ArrayRef<SpecialMemberFunctionData> DefinedSpecialMembers);
69 const bool AllowMissingMoveFunctions;
70 const bool AllowSoleDefaultDtor;
71 const bool AllowMissingMoveFunctionsWhenCopyIsDeleted;
85 clang::tidy::cppcoreguidelines::SpecialMemberFunctionsCheck::ClassDefId> {
90 return ClassDefId(DenseMapInfo<clang::SourceLocation>::getEmptyKey(),
95 return ClassDefId(DenseMapInfo<clang::SourceLocation>::getTombstoneKey(),
100 assert(Val != getEmptyKey() &&
"Cannot hash the empty key!");
101 assert(Val != getTombstoneKey() &&
"Cannot hash the tombstone key!");
103 std::hash<ClassDefId::second_type> SecondHash;
104 return Val.first.getHashValue() + SecondHash(Val.second);
108 if (RHS == getEmptyKey())
109 return LHS == getEmptyKey();
110 if (RHS == getTombstoneKey())
111 return LHS == getTombstoneKey();
118 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CPPCOREGUIDELINES_SPECIAL_MEMBER_FUNCTIONS_H