#include "InconsistentDeclarationParameterNameCheck.h"
#include "clang/AST/ASTContext.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "llvm/ADT/STLExtras.h"
#include <functional>
usingnamespaceclang::ast_matchers;
namespace clang::tidy::readability {
namespace {
AST_MATCHER(FunctionDecl, hasOtherDeclarations) { … }
struct DifferingParamInfo { … };
DifferingParamsContainer;
struct InconsistentDeclarationInfo { … };
InconsistentDeclarationsContainer;
bool checkIfFixItHintIsApplicable(
const FunctionDecl *ParameterSourceDeclaration,
const ParmVarDecl *SourceParam, const FunctionDecl *OriginalDeclaration) { … }
bool nameMatch(StringRef L, StringRef R, bool Strict) { … }
DifferingParamsContainer
findDifferingParamsInDeclaration(const FunctionDecl *ParameterSourceDeclaration,
const FunctionDecl *OtherDeclaration,
const FunctionDecl *OriginalDeclaration,
bool Strict) { … }
InconsistentDeclarationsContainer
findInconsistentDeclarations(const FunctionDecl *OriginalDeclaration,
const FunctionDecl *ParameterSourceDeclaration,
SourceManager &SM, bool Strict) { … }
const FunctionDecl *
getParameterSourceDeclaration(const FunctionDecl *OriginalDeclaration) { … }
std::string joinParameterNames(
const DifferingParamsContainer &DifferingParams,
llvm::function_ref<StringRef(const DifferingParamInfo &)> ChooseParamName) { … }
void formatDifferingParamsDiagnostic(
InconsistentDeclarationParameterNameCheck *Check, SourceLocation Location,
StringRef OtherDeclarationDescription,
const DifferingParamsContainer &DifferingParams) { … }
void formatDiagnosticsForDeclarations(
InconsistentDeclarationParameterNameCheck *Check,
const FunctionDecl *ParameterSourceDeclaration,
const FunctionDecl *OriginalDeclaration,
const InconsistentDeclarationsContainer &InconsistentDeclarations) { … }
void formatDiagnostics(
InconsistentDeclarationParameterNameCheck *Check,
const FunctionDecl *ParameterSourceDeclaration,
const FunctionDecl *OriginalDeclaration,
const InconsistentDeclarationsContainer &InconsistentDeclarations,
StringRef FunctionDescription, StringRef ParameterSourceDescription) { … }
}
void InconsistentDeclarationParameterNameCheck::storeOptions(
ClangTidyOptions::OptionMap &Opts) { … }
void InconsistentDeclarationParameterNameCheck::registerMatchers(
MatchFinder *Finder) { … }
void InconsistentDeclarationParameterNameCheck::check(
const MatchFinder::MatchResult &Result) { … }
void InconsistentDeclarationParameterNameCheck::markRedeclarationsAsVisited(
const FunctionDecl *OriginalDeclaration) { … }
}