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