#include "SuspiciousCallArgumentCheck.h"
#include "../utils/OptionsUtils.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/Type.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include <optional>
#include <sstream>
usingnamespaceclang::ast_matchers;
optutils;
namespace clang::tidy::readability {
namespace {
struct DefaultHeuristicConfiguration { … };
}
static constexpr std::size_t DefaultMinimumIdentifierNameLength = …;
static constexpr StringRef HeuristicToString[] = …;
static constexpr DefaultHeuristicConfiguration Defaults[] = …;
static_assert …;
static_assert …;
namespace {
template <std::size_t I> struct HasWellConfiguredBounds { … };
template <std::size_t I> struct HasWellConfiguredBoundsFold { … };
template <> struct HasWellConfiguredBoundsFold<0> { … };
struct AllHeuristicsBoundsWellConfigured { … };
static_assert …;
}
static constexpr llvm::StringLiteral DefaultAbbreviations = …;
static constexpr std::size_t SmallVectorSize = …;
static inline double percentage(double X, double Y) { … }
static bool applyEqualityHeuristic(StringRef Arg, StringRef Param) { … }
static bool applyAbbreviationHeuristic(
const llvm::StringMap<std::string> &AbbreviationDictionary, StringRef Arg,
StringRef Param) { … }
static bool applyPrefixHeuristic(StringRef Arg, StringRef Param,
int8_t Threshold) { … }
static bool applySuffixHeuristic(StringRef Arg, StringRef Param,
int8_t Threshold) { … }
static bool applySubstringHeuristic(StringRef Arg, StringRef Param,
int8_t Threshold) { … }
static bool applyLevenshteinHeuristic(StringRef Arg, StringRef Param,
int8_t Threshold) { … }
static bool applyJaroWinklerHeuristic(StringRef Arg, StringRef Param,
int8_t Threshold) { … }
static bool applyDiceHeuristic(StringRef Arg, StringRef Param,
int8_t Threshold) { … }
static bool areRefAndQualCompatible(QualType ArgType, QualType ParamType) { … }
static bool isPointerOrArray(QualType TypeToCheck) { … }
static bool isCompatibleWithArrayReference(QualType ArgType,
QualType ParamType) { … }
static QualType convertToPointeeOrArrayElementQualType(QualType TypeToConvert) { … }
static bool arePointersStillQualCompatible(QualType ArgType, QualType ParamType,
bool &IsParamContinuouslyConst) { … }
static bool arePointerTypesCompatible(QualType ArgType, QualType ParamType,
bool IsParamContinuouslyConst) { … }
static bool areTypesCompatible(QualType ArgType, QualType ParamType,
const ASTContext &Ctx) { … }
static bool isOverloadedUnaryOrBinarySymbolOperator(const FunctionDecl *FD) { … }
SuspiciousCallArgumentCheck::SuspiciousCallArgumentCheck(
StringRef Name, ClangTidyContext *Context)
: … { … }
void SuspiciousCallArgumentCheck::storeOptions(
ClangTidyOptions::OptionMap &Opts) { … }
bool SuspiciousCallArgumentCheck::isHeuristicEnabled(Heuristic H) const { … }
std::optional<int8_t>
SuspiciousCallArgumentCheck::getBound(Heuristic H, BoundKind BK) const { … }
void SuspiciousCallArgumentCheck::registerMatchers(MatchFinder *Finder) { … }
void SuspiciousCallArgumentCheck::check(
const MatchFinder::MatchResult &Result) { … }
void SuspiciousCallArgumentCheck::setParamNamesAndTypes(
const FunctionDecl *CalleeFuncDecl) { … }
void SuspiciousCallArgumentCheck::setArgNamesAndTypes(
const CallExpr *MatchedCallExpr, std::size_t InitialArgIndex) { … }
bool SuspiciousCallArgumentCheck::areParamAndArgComparable(
std::size_t Position1, std::size_t Position2, const ASTContext &Ctx) const { … }
bool SuspiciousCallArgumentCheck::areArgsSwapped(std::size_t Position1,
std::size_t Position2) const { … }
bool SuspiciousCallArgumentCheck::areNamesSimilar(StringRef Arg,
StringRef Param, Heuristic H,
BoundKind BK) const { … }
}