10 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CPPCOREGUIDELINES_SPECIAL_MEMBER_FUNCTIONS_H 11 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CPPCOREGUIDELINES_SPECIAL_MEMBER_FUNCTIONS_H 13 #include "../ClangTidy.h" 15 #include "llvm/ADT/DenseMapInfo.h" 19 namespace cppcoreguidelines {
31 void check(
const ast_matchers::MatchFinder::MatchResult &
Result)
override;
44 using ClassDefId = std::pair<SourceLocation, std::string>;
48 llvm::SmallVector<SpecialMemberFunctionKind, 5>>;
51 void checkForMissingMembers(
53 llvm::ArrayRef<SpecialMemberFunctionKind> DefinedSpecialMembers);
55 const bool AllowMissingMoveFunctions;
56 const bool AllowSoleDefaultDtor;
76 clang::SourceLocation::getFromRawEncoding(static_cast<unsigned>(-1)),
82 clang::SourceLocation::getFromRawEncoding(static_cast<unsigned>(-2)),
87 assert(Val != getEmptyKey() &&
"Cannot hash the empty key!");
88 assert(Val != getTombstoneKey() &&
"Cannot hash the tombstone key!");
90 std::hash<ClassDefId::second_type> SecondHash;
91 return Val.first.getRawEncoding() + SecondHash(Val.second);
94 static bool isEqual(
const ClassDefId &LHS,
const ClassDefId &RHS) {
95 if (RHS == getEmptyKey())
96 return LHS == getEmptyKey();
97 if (RHS == getTombstoneKey())
98 return LHS == getTombstoneKey();
105 #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)
llvm::Optional< llvm::Expected< tooling::AtomicChanges > > Result
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
static ClassDefId getTombstoneKey()
Every ClangTidyCheck reports errors through a DiagnosticsEngine provided by this context.
std::pair< SourceLocation, std::string > ClassDefId