9 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_SUSPICIOUSCALLARGUMENTCHECK_H
10 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_SUSPICIOUSCALLARGUMENTCHECK_H
12 #include "../ClangTidyCheck.h"
13 #include "llvm/ADT/StringSet.h"
17 namespace readability {
26 enum class Heuristic {
40 enum class BoundKind {
54 static_cast<std::size_t
>(Heuristic::Dice) + 1;
59 void check(
const ast_matchers::MatchFinder::MatchResult &Result)
override;
62 const std::size_t MinimumIdentifierNameLength;
65 SmallVector<Heuristic, HeuristicCount> AppliedHeuristics;
68 SmallVector<std::pair<int8_t, int8_t>,
HeuristicCount> ConfiguredBounds;
71 llvm::StringMap<std::string> AbbreviationDictionary;
73 bool isHeuristicEnabled(Heuristic H)
const;
74 Optional<int8_t> getBound(Heuristic H, BoundKind BK)
const;
77 SmallVector<QualType, SmallVectorSize> ArgTypes;
78 SmallVector<StringRef, SmallVectorSize> ArgNames;
79 SmallVector<QualType, SmallVectorSize> ParamTypes;
80 SmallVector<StringRef, SmallVectorSize> ParamNames;
82 void setParamNamesAndTypes(
const FunctionDecl *CalleeFuncDecl);
84 void setArgNamesAndTypes(
const CallExpr *MatchedCallExpr,
85 std::size_t InitialArgIndex);
87 bool areParamAndArgComparable(std::size_t Position1, std::size_t Position2,
88 const ASTContext &
Ctx)
const;
90 bool areArgsSwapped(std::size_t Position1, std::size_t Position2)
const;
92 bool areNamesSimilar(StringRef Arg, StringRef Param, Heuristic H,
100 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_SUSPICIOUSCALLARGUMENTCHECK_H