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 {
29 return LangOpts.CPlusPlus;
33 void check(
const ast_matchers::MatchFinder::MatchResult &Result)
override;
56 using ClassDefId = std::pair<SourceLocation, std::string>;
60 llvm::SmallVector<SpecialMemberFunctionData, 5>>;
63 void checkForMissingMembers(
65 llvm::ArrayRef<SpecialMemberFunctionData> DefinedSpecialMembers);
67 const bool AllowMissingMoveFunctions;
68 const bool AllowSoleDefaultDtor;
69 const bool AllowMissingMoveFunctionsWhenCopyIsDeleted;
83 clang::tidy::cppcoreguidelines::SpecialMemberFunctionsCheck::ClassDefId> {
88 return ClassDefId(DenseMapInfo<clang::SourceLocation>::getEmptyKey(),
93 return ClassDefId(DenseMapInfo<clang::SourceLocation>::getTombstoneKey(),
98 assert(Val != getEmptyKey() &&
"Cannot hash the empty key!");
99 assert(Val != getTombstoneKey() &&
"Cannot hash the tombstone key!");
101 std::hash<ClassDefId::second_type> SecondHash;
102 return Val.first.getHashValue() + SecondHash(Val.second);
106 if (RHS == getEmptyKey())
107 return LHS == getEmptyKey();
108 if (RHS == getTombstoneKey())
109 return LHS == getTombstoneKey();
116 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CPPCOREGUIDELINES_SPECIAL_MEMBER_FUNCTIONS_H void onEndOfTranslationUnit() override
Checks for classes where some, but not all, of the special member functions are defined.
void storeOptions(ClangTidyOptions::OptionMap &Opts) override
Should store all options supported by this check with their current values or default values for opti...
SpecialMemberFunctionKind
Some operations such as code completion produce a set of candidates.
static bool isEqual(const ClassDefId &LHS, const ClassDefId &RHS)
clang::tidy::cppcoreguidelines::SpecialMemberFunctionsCheck::ClassDefId ClassDefId
static unsigned getHashValue(ClassDefId Val)
void registerMatchers(ast_matchers::MatchFinder *Finder) override
Override this to register AST matchers with Finder.
void check(const ast_matchers::MatchFinder::MatchResult &Result) override
ClangTidyChecks that register ASTMatchers should do the actual work in here.
Base class for all clang-tidy checks.
llvm::DenseMap< ClassDefId, llvm::SmallVector< SpecialMemberFunctionData, 5 > > ClassDefiningSpecialMembersMap
static ClassDefId getEmptyKey()
static constexpr llvm::StringLiteral Name
SpecialMemberFunctionsCheck(StringRef Name, ClangTidyContext *Context)
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
static ClassDefId getTombstoneKey()
Every ClangTidyCheck reports errors through a DiagnosticsEngine provided by this context.
bool isLanguageVersionSupported(const LangOptions &LangOpts) const override
Override this to disable registering matchers and PP callbacks if an invalid language version is bein...
SpecialMemberFunctionKind FunctionKind
bool operator==(const SpecialMemberFunctionData &Other)
llvm::StringMap< ClangTidyValue > OptionMap
std::pair< SourceLocation, std::string > ClassDefId