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 "../ClangTidy.h" 14 #include "llvm/ADT/DenseMapInfo.h" 18 namespace cppcoreguidelines {
30 void check(
const ast_matchers::MatchFinder::MatchResult &
Result)
override;
43 using ClassDefId = std::pair<SourceLocation, std::string>;
47 llvm::SmallVector<SpecialMemberFunctionKind, 5>>;
50 void checkForMissingMembers(
52 llvm::ArrayRef<SpecialMemberFunctionKind> DefinedSpecialMembers);
54 const bool AllowMissingMoveFunctions;
55 const bool AllowSoleDefaultDtor;
75 clang::SourceLocation::getFromRawEncoding(static_cast<unsigned>(-1)),
81 clang::SourceLocation::getFromRawEncoding(static_cast<unsigned>(-2)),
86 assert(Val != getEmptyKey() &&
"Cannot hash the empty key!");
87 assert(Val != getTombstoneKey() &&
"Cannot hash the tombstone key!");
89 std::hash<ClassDefId::second_type> SecondHash;
90 return Val.first.getRawEncoding() + SecondHash(Val.second);
93 static bool isEqual(
const ClassDefId &LHS,
const ClassDefId &RHS) {
94 if (RHS == getEmptyKey())
95 return LHS == getEmptyKey();
96 if (RHS == getTombstoneKey())
97 return LHS == getTombstoneKey();
104 #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< SpecialMemberFunctionKind, 5 > > ClassDefiningSpecialMembersMap
static ClassDefId getEmptyKey()
static constexpr llvm::StringLiteral Name
std::map< std::string, std::string > OptionMap
SpecialMemberFunctionsCheck(StringRef Name, ClangTidyContext *Context)
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
static ClassDefId getTombstoneKey()
Every ClangTidyCheck reports errors through a DiagnosticsEngine provided by this context.
llvm::Optional< llvm::Expected< tooling::AtomicChanges > > Result
std::pair< SourceLocation, std::string > ClassDefId