#include "RenamerClangTidyCheck.h"
#include "ASTUtils.h"
#include "clang/AST/CXXInheritance.h"
#include "clang/AST/RecursiveASTVisitor.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/Basic/CharInfo.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Lex/PPCallbacks.h"
#include "clang/Lex/Preprocessor.h"
#include "llvm/ADT/DenseMapInfo.h"
#include "llvm/ADT/PointerIntPair.h"
#include <optional>
#define DEBUG_TYPE …
usingnamespaceclang::ast_matchers;
namespace llvm {
template <>
struct DenseMapInfo<clang::tidy::RenamerClangTidyCheck::NamingCheckId> { … };
}
namespace clang::tidy {
namespace {
class NameLookup { … };
}
static const NamedDecl *findDecl(const RecordDecl &RecDecl,
StringRef DeclName) { … }
static const CXXMethodDecl *getOverrideMethod(const CXXMethodDecl *Method) { … }
static bool hasNoName(const NamedDecl *Decl) { … }
static const NamedDecl *getFailureForNamedDecl(const NamedDecl *ND) { … }
static NameLookup findDeclInBases(const CXXRecordDecl &Parent,
StringRef DeclName,
bool AggressiveTemplateLookup) { … }
namespace {
class RenamerClangTidyCheckPPCallbacks : public PPCallbacks { … };
class RenamerClangTidyVisitor
: public RecursiveASTVisitor<RenamerClangTidyVisitor> { … };
}
RenamerClangTidyCheck::RenamerClangTidyCheck(StringRef CheckName,
ClangTidyContext *Context)
: … { … }
RenamerClangTidyCheck::~RenamerClangTidyCheck() = default;
void RenamerClangTidyCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) { … }
void RenamerClangTidyCheck::registerMatchers(MatchFinder *Finder) { … }
void RenamerClangTidyCheck::registerPPCallbacks(
const SourceManager &SM, Preprocessor *PP, Preprocessor *ModuleExpanderPP) { … }
std::pair<RenamerClangTidyCheck::NamingCheckFailureMap::iterator, bool>
RenamerClangTidyCheck::addUsage(
const RenamerClangTidyCheck::NamingCheckId &FailureId,
SourceRange UsageRange, const SourceManager &SourceMgr) { … }
void RenamerClangTidyCheck::addUsage(const NamedDecl *Decl,
SourceRange UsageRange,
const SourceManager &SourceMgr) { … }
void RenamerClangTidyCheck::check(const MatchFinder::MatchResult &Result) { … }
void RenamerClangTidyCheck::checkMacro(const Token &MacroNameTok,
const MacroInfo *MI,
const SourceManager &SourceMgr) { … }
void RenamerClangTidyCheck::expandMacro(const Token &MacroNameTok,
const MacroInfo *MI,
const SourceManager &SourceMgr) { … }
static std::string
getDiagnosticSuffix(const RenamerClangTidyCheck::ShouldFixStatus FixStatus,
const std::string &Fixup) { … }
void RenamerClangTidyCheck::onEndOfTranslationUnit() { … }
}