clang-tools  14.0.0git
Classes | Enumerations | Functions | Variables
clang::tidy::readability Namespace Reference

Classes

class  AvoidConstParamsInDecls
 
class  BracesAroundStatementsCheck
 Checks that bodies of if statements and loops (for, range-for, do-while, and while) are inside braces. More...
 
class  ConstReturnTypeCheck
 For any function whose return type is const-qualified, suggests removal of the const qualifier from that return type. More...
 
class  ContainerDataPointerCheck
 Checks whether a call to operator[] and & can be replaced with a call to data(). More...
 
class  ContainerSizeEmptyCheck
 Checks whether a call to the size() method can be replaced with a call to empty(). More...
 
class  ConvertMemberFunctionsToStatic
 This check finds C++ class methods than can be made static because they don't use the 'this' pointer. More...
 
class  DeleteNullPointerCheck
 Check whether the 'if' statement is unnecessary before calling 'delete' on a pointer. More...
 
class  ElseAfterReturnCheck
 Flags the usages of else after return. More...
 
class  FindUsageOfThis
 
class  FunctionCognitiveComplexityCheck
 Checks function Cognitive Complexity metric. More...
 
class  FunctionSizeCheck
 Checks for large functions based on various metrics. More...
 
class  IdentifierLengthCheck
 Warns about identifiers names whose length is too short. More...
 
class  IdentifierNamingCheck
 Checks for identifiers naming style mismatch. More...
 
class  ImplicitBoolConversionCheck
 Checks for use of implicit bool conversions in expressions. More...
 
class  InconsistentDeclarationParameterNameCheck
 Checks for declarations of functions which differ in parameter names. More...
 
class  IsolateDeclarationCheck
 This check diagnoses all DeclStmt's declaring more than one variable and tries to refactor the code to one statement per declaration. More...
 
class  MagicNumbersCheck
 Detects magic numbers, integer and floating point literals embedded in code. More...
 
class  MakeMemberFunctionConstCheck
 Finds non-static member functions that can be made 'const'. More...
 
class  MisleadingIndentationCheck
 Checks the code for dangling else, and possible misleading indentations due to missing braces. More...
 
class  MisplacedArrayIndexCheck
 Warn about unusual array index syntax (index[array] instead of array[index]). More...
 
class  NamedParameterCheck
 Find functions with unnamed arguments. More...
 
class  NamespaceCommentCheck
 Checks that long namespaces have a closing comment. More...
 
class  NonConstParameterCheck
 Warn when a pointer function parameter can be const. More...
 
class  QualifiedAutoCheck
 Finds variables declared as auto that could be declared as: 'auto*' or 'const auto *' and reference variables declared as: 'const auto &'. More...
 
class  ReadabilityModule
 
class  RedundantAccessSpecifiersCheck
 Detects redundant access specifiers inside classes, structs, and unions. More...
 
class  RedundantControlFlowCheck
 Eliminates redundant return statements at the end of a function that returns void. More...
 
class  RedundantDeclarationCheck
 Find redundant variable declarations. More...
 
class  RedundantFunctionPtrDereferenceCheck
 Eliminate redundant dereferences of a function pointer. More...
 
class  RedundantMemberInitCheck
 Finds member initializations that are unnecessary because the same default constructor would be called if they were not present. More...
 
class  RedundantPreprocessorCheck
 This check flags redundant preprocessor directives: nested directives with the same condition. More...
 
class  RedundantSmartptrGetCheck
 Find and remove redundant calls to smart pointer's .get() method. More...
 
class  RedundantStringCStrCheck
 Finds unnecessary calls to std::string::c_str(). More...
 
class  RedundantStringInitCheck
 Finds unnecessary string initializations. More...
 
class  SimplifyBooleanExprCheck
 Looks for boolean expressions involving boolean constants and simplifies them to use the appropriate boolean expression directly. More...
 
class  SimplifySubscriptExprCheck
 Simplifies subscript expressions. More...
 
class  StaticAccessedThroughInstanceCheck
 Checks for member expressions that access static members through instances and replaces them with uses of the appropriate qualified-id. More...
 
class  StaticDefinitionInAnonymousNamespaceCheck
 Finds static function and variable definitions in anonymous namespace. More...
 
class  StringCompareCheck
 This check flags all calls compare when used to check for string equality or inequality. More...
 
class  SuspiciousCallArgumentCheck
 Finds function calls where the arguments passed are provided out of order, based on the difference between the argument name and the parameter names of the function. More...
 
class  UniqueptrDeleteReleaseCheck
 Flags statements of the form delete <unique_ptr expr>.release(); and replaces them with: <unique_ptr expr> = nullptr; More...
 
class  UppercaseLiteralSuffixCheck
 Detects when the integral literal or floating point literal has non-uppercase suffix, and suggests to make the suffix uppercase. More...
 
class  UseAnyOfAllOfCheck
 Finds ranged-based for loops that can be replaced by a call to std::any_of or std::all_of. More...
 

Enumerations

enum  StyleKind : int { SK_Count, SK_Invalid }
 
enum  UsageKind { Unused, Const, NonConst }
 

Functions

static tok::TokenKind getTokenKind (SourceLocation Loc, const SourceManager &SM, const ASTContext *Context)
 
static SourceLocation forwardSkipWhitespaceAndComments (SourceLocation Loc, const SourceManager &SM, const ASTContext *Context)
 
static SourceLocation findEndLocation (const Stmt &S, const SourceManager &SM, const ASTContext *Context)
 
static llvm::Optional< Token > findConstToRemove (const FunctionDecl *Def, const MatchFinder::MatchResult &Result)
 
static CheckResult checkDef (const clang::FunctionDecl *Def, const MatchFinder::MatchResult &MatchResult)
 
 AST_MATCHER (CXXMethodDecl, isStatic)
 
 AST_MATCHER (CXXMethodDecl, hasTrivialBody)
 
 AST_MATCHER (CXXMethodDecl, isOverloadedOperator)
 
 AST_MATCHER (CXXRecordDecl, hasAnyDependentBases)
 
 AST_MATCHER (CXXMethodDecl, isTemplate)
 
 AST_MATCHER (CXXMethodDecl, isDependentContext)
 
 AST_MATCHER (CXXMethodDecl, isInsideMacroDefinition)
 
 AST_MATCHER_P (CXXMethodDecl, hasCanonicalDecl, ast_matchers::internal::Matcher< CXXMethodDecl >, InnerMatcher)
 
 AST_MATCHER (CXXMethodDecl, usesThis)
 
static StringRef getStringFromRange (SourceManager &SourceMgr, const LangOptions &LangOpts, SourceRange Range)
 Obtain the original source code text from a SourceRange. More...
 
static SourceRange getLocationOfConst (const TypeSourceInfo *TSI, SourceManager &SourceMgr, const LangOptions &LangOpts)
 
static const DeclRefExpr * findUsage (const Stmt *Node, int64_t DeclIdentifier)
 
static const DeclRefExpr * findUsageRange (const Stmt *Node, const llvm::ArrayRef< int64_t > &DeclIdentifiers)
 
static const DeclRefExpr * checkInitDeclUsageInElse (const IfStmt *If)
 
static const DeclRefExpr * checkConditionVarUsageInElse (const IfStmt *If)
 
static bool containsDeclInScope (const Stmt *Node)
 
static void removeElseAndBrackets (DiagnosticBuilder &Diag, ASTContext &Context, const Stmt *Else, SourceLocation ElseLoc)
 
static bool hasPreprocessorBranchEndBetweenLocations (const ElseAfterReturnCheck::ConditionalBranchMap &ConditionalBranchMap, const SourceManager &SM, SourceLocation StartLoc, SourceLocation EndLoc)
 
static StringRef getControlFlowString (const Stmt &Stmt)
 
static SourceLocation findStartOfIndirection (SourceLocation Start, int Indirections, const SourceManager &SM, const LangOptions &LangOpts)
 
static bool isMacroID (SourceRange R)
 
static int countIndirections (const Type *T, int Indirections=0)
 This function counts the number of written indirections for the given Type T. More...
 
static bool typeIsMemberPointer (const Type *T)
 
static Optional< std::vector< SourceRange > > declRanges (const DeclStmt *DS, const SourceManager &SM, const LangOptions &LangOpts)
 This function tries to extract the SourceRanges that make up all declarations in this DeclStmt. More...
 
static Optional< std::vector< StringRef > > collectSourceRanges (llvm::ArrayRef< SourceRange > Ranges, const SourceManager &SM, const LangOptions &LangOpts)
 
static std::vector< std::string > createIsolatedDecls (llvm::ArrayRef< StringRef > Snippets)
 Expects a vector {TypeSnippet, Firstdecl, SecondDecl, ...}. More...
 
 AST_MATCHER (CXXMethodDecl, usesThisAsConst)
 
static SourceLocation getConstInsertionPoint (const CXXMethodDecl *M)
 
static const IfStmt * getPrecedingIf (const SourceManager &SM, ASTContext *Context, const IfStmt *If)
 
static bool locationsInSameFile (const SourceManager &Sources, SourceLocation Loc1, SourceLocation Loc2)
 
static llvm::Optional< std::string > getNamespaceNameAsWritten (SourceLocation &Loc, const SourceManager &Sources, const LangOptions &LangOpts)
 
static ClangTidyModuleRegistry::Add< ReadabilityModuleX ("readability-module", "Adds readability-related checks.")
 
 AST_MATCHER (FunctionDecl, doesDeclarationForceExternallyVisibleDefinition)
 
static ast_matchers::internal::Matcher< NamedDecl > hasAnyNameStdString (std::vector< std::string > Names)
 
static std::vector< std::string > removeNamespaces (const std::vector< std::string > &Names)
 
static const CXXConstructExpr * getConstructExpr (const CXXCtorInitializer &CtorInit)
 
static llvm::Optional< SourceRange > getConstructExprArgRange (const CXXConstructExpr &Construct)
 
bool containsBoolLiteral (const Expr *E)
 
static unsigned getNameSpecifierNestingLevel (const QualType &QType)
 
static double percentage (double X, double Y)
 Returns how many % X is of Y. More...
 
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)
 Check whether the shorter String is a prefix of the longer String. More...
 
static bool applySuffixHeuristic (StringRef Arg, StringRef Param, int8_t Threshold)
 Check whether the shorter String is a suffix of the longer String. More...
 
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)
 Checks if ArgType binds to ParamType regarding reference-ness and cv-qualifiers. More...
 
static bool isPointerOrArray (QualType TypeToCheck)
 
static bool isCompatibleWithArrayReference (QualType ArgType, QualType ParamType)
 Checks whether ArgType is an array type identical to ParamType's array type. More...
 
static QualType convertToPointeeOrArrayElementQualType (QualType TypeToConvert)
 
static bool arePointersStillQualCompatible (QualType ArgType, QualType ParamType, bool &IsParamContinuouslyConst)
 Checks if multilevel pointers' qualifiers compatibility continues on the current pointer level. More...
 
static bool arePointerTypesCompatible (QualType ArgType, QualType ParamType, bool IsParamContinuouslyConst)
 Checks whether multilevel pointers are compatible in terms of levels, qualifiers and pointee type. More...
 
static bool areTypesCompatible (QualType ArgType, QualType ParamType, const ASTContext &Ctx)
 Checks whether ArgType converts implicitly to ParamType. More...
 
static bool isOverloadedUnaryOrBinarySymbolOperator (const FunctionDecl *FD)
 
static bool isViableLoop (const CXXForRangeStmt &S, ASTContext &Context)
 

Variables

static const char InterruptingStr [] = "interrupting"
 
static const char WarningMessage [] = "do not use 'else' after '%0'"
 
static const char WarnOnUnfixableStr [] = "WarnOnUnfixable"
 
static const char WarnOnConditionVariablesStr [] = "WarnOnConditionVariables"
 
const unsigned DefaultMinimumVariableNameLength = 3
 
const unsigned DefaultMinimumLoopCounterNameLength = 2
 
const unsigned DefaultMinimumExceptionNameLength = 2
 
const unsigned DefaultMinimumParameterNameLength = 3
 
const char DefaultIgnoredLoopCounterNames [] = "^[ijk_]$"
 
const char DefaultIgnoredVariableNames [] = ""
 
const char DefaultIgnoredExceptionVariableNames [] = "^[e]$"
 
const char DefaultIgnoredParameterNames [] = "^[n]$"
 
const char ErrorMessage []
 
static const StringRef StyleNames []
 
static const StringRef HungarainNotationPrimitiveTypes []
 
static const StringRef HungarainNotationUserDefinedTypes []
 
const char DefaultIgnoredIntegerValues [] = "1;2;3;4;"
 
const char DefaultIgnoredFloatingPointValues [] = "1.0;100.0;"
 
const char DefaultStringNames []
 
static const char KDefaultTypes []
 
static const StringRef CompareMessage
 
static constexpr std::size_t DefaultMinimumIdentifierNameLength = 3
 
static constexpr StringRef HeuristicToString []
 
static constexpr DefaultHeuristicConfiguration Defaults []
 
static const std::string DefaultAbbreviations
 
static constexpr std::size_t SmallVectorSize
 

Enumeration Type Documentation

◆ StyleKind

Enumerator
SK_Count 
SK_Invalid 

Definition at line 125 of file IdentifierNamingCheck.cpp.

◆ UsageKind

Enumerator
Unused 
Const 
NonConst 

Definition at line 52 of file MakeMemberFunctionConstCheck.cpp.

Function Documentation

◆ applyAbbreviationHeuristic()

static bool clang::tidy::readability::applyAbbreviationHeuristic ( const llvm::StringMap< std::string > &  AbbreviationDictionary,
StringRef  Arg,
StringRef  Param 
)
static

Definition at line 139 of file SuspiciousCallArgumentCheck.cpp.

◆ applyDiceHeuristic()

static bool clang::tidy::readability::applyDiceHeuristic ( StringRef  Arg,
StringRef  Param,
int8_t  Threshold 
)
static

Definition at line 276 of file SuspiciousCallArgumentCheck.cpp.

References percentage().

◆ applyEqualityHeuristic()

static bool clang::tidy::readability::applyEqualityHeuristic ( StringRef  Arg,
StringRef  Param 
)
static

Definition at line 135 of file SuspiciousCallArgumentCheck.cpp.

◆ applyJaroWinklerHeuristic()

static bool clang::tidy::readability::applyJaroWinklerHeuristic ( StringRef  Arg,
StringRef  Param,
int8_t  Threshold 
)
static

Definition at line 215 of file SuspiciousCallArgumentCheck.cpp.

References Range.

◆ applyLevenshteinHeuristic()

static bool clang::tidy::readability::applyLevenshteinHeuristic ( StringRef  Arg,
StringRef  Param,
int8_t  Threshold 
)
static

Definition at line 206 of file SuspiciousCallArgumentCheck.cpp.

References Dist.

◆ applyPrefixHeuristic()

static bool clang::tidy::readability::applyPrefixHeuristic ( StringRef  Arg,
StringRef  Param,
int8_t  Threshold 
)
static

Check whether the shorter String is a prefix of the longer String.

Definition at line 154 of file SuspiciousCallArgumentCheck.cpp.

References percentage().

◆ applySubstringHeuristic()

static bool clang::tidy::readability::applySubstringHeuristic ( StringRef  Arg,
StringRef  Param,
int8_t  Threshold 
)
static

Definition at line 177 of file SuspiciousCallArgumentCheck.cpp.

References percentage().

◆ applySuffixHeuristic()

static bool clang::tidy::readability::applySuffixHeuristic ( StringRef  Arg,
StringRef  Param,
int8_t  Threshold 
)
static

Check whether the shorter String is a suffix of the longer String.

Definition at line 166 of file SuspiciousCallArgumentCheck.cpp.

References percentage().

◆ arePointersStillQualCompatible()

static bool clang::tidy::readability::arePointersStillQualCompatible ( QualType  ArgType,
QualType  ParamType,
bool &  IsParamContinuouslyConst 
)
static

Checks if multilevel pointers' qualifiers compatibility continues on the current pointer level.

For multilevel pointers, C++ permits conversion, if every cv-qualifier in ArgType also appears in the corresponding position in ParamType, and if PramType has a cv-qualifier that's not in ArgType, then every * in ParamType to the right of that cv-qualifier, except the last one, must also be const-qualified.

Definition at line 346 of file SuspiciousCallArgumentCheck.cpp.

Referenced by arePointerTypesCompatible().

◆ arePointerTypesCompatible()

static bool clang::tidy::readability::arePointerTypesCompatible ( QualType  ArgType,
QualType  ParamType,
bool  IsParamContinuouslyConst 
)
static

Checks whether multilevel pointers are compatible in terms of levels, qualifiers and pointee type.

Definition at line 363 of file SuspiciousCallArgumentCheck.cpp.

References arePointersStillQualCompatible(), and convertToPointeeOrArrayElementQualType().

Referenced by areTypesCompatible().

◆ areRefAndQualCompatible()

static bool clang::tidy::readability::areRefAndQualCompatible ( QualType  ArgType,
QualType  ParamType 
)
static

Checks if ArgType binds to ParamType regarding reference-ness and cv-qualifiers.

Definition at line 304 of file SuspiciousCallArgumentCheck.cpp.

Referenced by areTypesCompatible().

◆ areTypesCompatible()

static bool clang::tidy::readability::areTypesCompatible ( QualType  ArgType,
QualType  ParamType,
const ASTContext &  Ctx 
)
static

◆ AST_MATCHER() [1/10]

clang::tidy::readability::AST_MATCHER ( CXXMethodDecl  ,
hasTrivialBody   
)

Definition at line 25 of file ConvertMemberFunctionsToStatic.cpp.

◆ AST_MATCHER() [2/10]

clang::tidy::readability::AST_MATCHER ( CXXMethodDecl  ,
isDependentContext   
)

Definition at line 39 of file ConvertMemberFunctionsToStatic.cpp.

◆ AST_MATCHER() [3/10]

clang::tidy::readability::AST_MATCHER ( CXXMethodDecl  ,
isInsideMacroDefinition   
)

Definition at line 43 of file ConvertMemberFunctionsToStatic.cpp.

◆ AST_MATCHER() [4/10]

clang::tidy::readability::AST_MATCHER ( CXXMethodDecl  ,
isOverloadedOperator   
)

Definition at line 27 of file ConvertMemberFunctionsToStatic.cpp.

◆ AST_MATCHER() [5/10]

clang::tidy::readability::AST_MATCHER ( CXXMethodDecl  ,
isStatic   
)

Definition at line 23 of file ConvertMemberFunctionsToStatic.cpp.

◆ AST_MATCHER() [6/10]

clang::tidy::readability::AST_MATCHER ( CXXMethodDecl  ,
isTemplate   
)

Definition at line 35 of file ConvertMemberFunctionsToStatic.cpp.

◆ AST_MATCHER() [7/10]

clang::tidy::readability::AST_MATCHER ( CXXMethodDecl  ,
usesThis   
)

Definition at line 57 of file ConvertMemberFunctionsToStatic.cpp.

References E.

◆ AST_MATCHER() [8/10]

clang::tidy::readability::AST_MATCHER ( CXXMethodDecl  ,
usesThisAsConst   
)

Definition at line 203 of file MakeMemberFunctionConstCheck.cpp.

◆ AST_MATCHER() [9/10]

clang::tidy::readability::AST_MATCHER ( CXXRecordDecl  ,
hasAnyDependentBases   
)

Definition at line 31 of file ConvertMemberFunctionsToStatic.cpp.

◆ AST_MATCHER() [10/10]

clang::tidy::readability::AST_MATCHER ( FunctionDecl  ,
doesDeclarationForceExternallyVisibleDefinition   
)

Definition at line 20 of file RedundantDeclarationCheck.cpp.

◆ AST_MATCHER_P()

clang::tidy::readability::AST_MATCHER_P ( CXXMethodDecl  ,
hasCanonicalDecl  ,
ast_matchers::internal::Matcher< CXXMethodDecl >  ,
InnerMatcher   
)

Definition at line 52 of file ConvertMemberFunctionsToStatic.cpp.

◆ checkConditionVarUsageInElse()

static const DeclRefExpr* clang::tidy::readability::checkConditionVarUsageInElse ( const IfStmt *  If)
static

Definition at line 101 of file ElseAfterReturnCheck.cpp.

◆ checkDef()

static CheckResult clang::tidy::readability::checkDef ( const clang::FunctionDecl *  Def,
const MatchFinder::MatchResult &  MatchResult 
)
static

Definition at line 70 of file ConstReturnTypeCheck.cpp.

◆ checkInitDeclUsageInElse()

static const DeclRefExpr* clang::tidy::readability::checkInitDeclUsageInElse ( const IfStmt *  If)
static

Definition at line 84 of file ElseAfterReturnCheck.cpp.

◆ collectSourceRanges()

static Optional<std::vector<StringRef> > clang::tidy::readability::collectSourceRanges ( llvm::ArrayRef< SourceRange >  Ranges,
const SourceManager &  SM,
const LangOptions &  LangOpts 
)
static

Definition at line 204 of file IsolateDeclarationCheck.cpp.

◆ containsBoolLiteral()

bool clang::tidy::readability::containsBoolLiteral ( const Expr *  E)

Definition at line 364 of file SimplifyBooleanExprCheck.cpp.

◆ containsDeclInScope()

static bool clang::tidy::readability::containsDeclInScope ( const Stmt *  Node)
static

Definition at line 107 of file ElseAfterReturnCheck.cpp.

◆ convertToPointeeOrArrayElementQualType()

static QualType clang::tidy::readability::convertToPointeeOrArrayElementQualType ( QualType  TypeToConvert)
static

◆ countIndirections()

static int clang::tidy::readability::countIndirections ( const Type *  T,
int  Indirections = 0 
)
static

This function counts the number of written indirections for the given Type T.

It does NOT resolve typedefs as it's a helper for lexing the source code.

See also
declRanges

Definition at line 60 of file IsolateDeclarationCheck.cpp.

◆ createIsolatedDecls()

static std::vector<std::string> clang::tidy::readability::createIsolatedDecls ( llvm::ArrayRef< StringRef >  Snippets)
static

Expects a vector {TypeSnippet, Firstdecl, SecondDecl, ...}.

Definition at line 232 of file IsolateDeclarationCheck.cpp.

◆ declRanges()

static Optional<std::vector<SourceRange> > clang::tidy::readability::declRanges ( const DeclStmt *  DS,
const SourceManager &  SM,
const LangOptions &  LangOpts 
)
static

This function tries to extract the SourceRanges that make up all declarations in this DeclStmt.

The resulting vector has the structure {UnderlyingType, Decl1, Decl2, ...}. Each SourceRange is of the form [Begin, End). If any of the create ranges is invalid or in a macro the result will be None. If the DeclStmt contains only one declaration, the result is None. If the DeclStmt contains declarations other than VarDecl the result is None.

int * ptr1 = nullptr, value = 42;
// [ ][ ] [ ] - The ranges here are inclusive
Todo:
Generalize this function to take other declarations than VarDecl.

Definition at line 109 of file IsolateDeclarationCheck.cpp.

◆ findConstToRemove()

static llvm::Optional<Token> clang::tidy::readability::findConstToRemove ( const FunctionDecl *  Def,
const MatchFinder::MatchResult &  Result 
)
static

Definition at line 28 of file ConstReturnTypeCheck.cpp.

◆ findEndLocation()

static SourceLocation clang::tidy::readability::findEndLocation ( const Stmt &  S,
const SourceManager &  SM,
const ASTContext *  Context 
)
static

Definition at line 53 of file BracesAroundStatementsCheck.cpp.

◆ findStartOfIndirection()

static SourceLocation clang::tidy::readability::findStartOfIndirection ( SourceLocation  Start,
int  Indirections,
const SourceManager &  SM,
const LangOptions &  LangOpts 
)
static

Definition at line 34 of file IsolateDeclarationCheck.cpp.

◆ findUsage()

static const DeclRefExpr* clang::tidy::readability::findUsage ( const Stmt *  Node,
int64_t  DeclIdentifier 
)
static

Definition at line 51 of file ElseAfterReturnCheck.cpp.

◆ findUsageRange()

static const DeclRefExpr* clang::tidy::readability::findUsageRange ( const Stmt *  Node,
const llvm::ArrayRef< int64_t > &  DeclIdentifiers 
)
static

Definition at line 67 of file ElseAfterReturnCheck.cpp.

◆ forwardSkipWhitespaceAndComments()

static SourceLocation clang::tidy::readability::forwardSkipWhitespaceAndComments ( SourceLocation  Loc,
const SourceManager &  SM,
const ASTContext *  Context 
)
static

Definition at line 37 of file BracesAroundStatementsCheck.cpp.

◆ getConstInsertionPoint()

static SourceLocation clang::tidy::readability::getConstInsertionPoint ( const CXXMethodDecl *  M)
static

Definition at line 234 of file MakeMemberFunctionConstCheck.cpp.

References M.

◆ getConstructExpr()

static const CXXConstructExpr* clang::tidy::readability::getConstructExpr ( const CXXCtorInitializer &  CtorInit)
static

Definition at line 43 of file RedundantStringInitCheck.cpp.

◆ getConstructExprArgRange()

static llvm::Optional<SourceRange> clang::tidy::readability::getConstructExprArgRange ( const CXXConstructExpr &  Construct)
static

Definition at line 51 of file RedundantStringInitCheck.cpp.

References ns1::ns2::B, and E.

◆ getControlFlowString()

static StringRef clang::tidy::readability::getControlFlowString ( const Stmt &  Stmt)
static

Definition at line 227 of file ElseAfterReturnCheck.cpp.

◆ getLocationOfConst()

static SourceRange clang::tidy::readability::getLocationOfConst ( const TypeSourceInfo *  TSI,
SourceManager &  SourceMgr,
const LangOptions &  LangOpts 
)
static

Definition at line 106 of file ConvertMemberFunctionsToStatic.cpp.

◆ getNamespaceNameAsWritten()

static llvm::Optional<std::string> clang::tidy::readability::getNamespaceNameAsWritten ( SourceLocation &  Loc,
const SourceManager &  Sources,
const LangOptions &  LangOpts 
)
static

Definition at line 49 of file NamespaceCommentCheck.cpp.

◆ getNameSpecifierNestingLevel()

static unsigned clang::tidy::readability::getNameSpecifierNestingLevel ( const QualType &  QType)
static

Definition at line 20 of file StaticAccessedThroughInstanceCheck.cpp.

◆ getPrecedingIf()

static const IfStmt* clang::tidy::readability::getPrecedingIf ( const SourceManager &  SM,
ASTContext *  Context,
const IfStmt *  If 
)
static

Definition at line 19 of file MisleadingIndentationCheck.cpp.

◆ getStringFromRange()

static StringRef clang::tidy::readability::getStringFromRange ( SourceManager &  SourceMgr,
const LangOptions &  LangOpts,
SourceRange  Range 
)
static

Obtain the original source code text from a SourceRange.

Definition at line 95 of file ConvertMemberFunctionsToStatic.cpp.

◆ getTokenKind()

static tok::TokenKind clang::tidy::readability::getTokenKind ( SourceLocation  Loc,
const SourceManager &  SM,
const ASTContext *  Context 
)
static

Definition at line 21 of file BracesAroundStatementsCheck.cpp.

◆ hasAnyNameStdString()

static ast_matchers::internal::Matcher<NamedDecl> clang::tidy::readability::hasAnyNameStdString ( std::vector< std::string >  Names)
static

Definition at line 25 of file RedundantStringInitCheck.cpp.

◆ hasPreprocessorBranchEndBetweenLocations()

static bool clang::tidy::readability::hasPreprocessorBranchEndBetweenLocations ( const ElseAfterReturnCheck::ConditionalBranchMap ConditionalBranchMap,
const SourceManager &  SM,
SourceLocation  StartLoc,
SourceLocation  EndLoc 
)
static

Definition at line 187 of file ElseAfterReturnCheck.cpp.

References SM.

◆ isCompatibleWithArrayReference()

static bool clang::tidy::readability::isCompatibleWithArrayReference ( QualType  ArgType,
QualType  ParamType 
)
static

Checks whether ArgType is an array type identical to ParamType's array type.

Enforces array elements' qualifier compatibility as well.

Definition at line 316 of file SuspiciousCallArgumentCheck.cpp.

Referenced by areTypesCompatible().

◆ isMacroID()

static bool clang::tidy::readability::isMacroID ( SourceRange  R)
static

Definition at line 52 of file IsolateDeclarationCheck.cpp.

◆ isOverloadedUnaryOrBinarySymbolOperator()

static bool clang::tidy::readability::isOverloadedUnaryOrBinarySymbolOperator ( const FunctionDecl *  FD)
static

Definition at line 481 of file SuspiciousCallArgumentCheck.cpp.

◆ isPointerOrArray()

static bool clang::tidy::readability::isPointerOrArray ( QualType  TypeToCheck)
static

Definition at line 310 of file SuspiciousCallArgumentCheck.cpp.

Referenced by areTypesCompatible().

◆ isViableLoop()

static bool clang::tidy::readability::isViableLoop ( const CXXForRangeStmt &  S,
ASTContext &  Context 
)
static

Definition at line 74 of file UseAnyOfAllOfCheck.cpp.

◆ locationsInSameFile()

static bool clang::tidy::readability::locationsInSameFile ( const SourceManager &  Sources,
SourceLocation  Loc1,
SourceLocation  Loc2 
)
static

Definition at line 42 of file NamespaceCommentCheck.cpp.

◆ percentage()

static double clang::tidy::readability::percentage ( double  X,
double  Y 
)
inlinestatic

Returns how many % X is of Y.

Definition at line 133 of file SuspiciousCallArgumentCheck.cpp.

References X.

Referenced by applyDiceHeuristic(), applyPrefixHeuristic(), applySubstringHeuristic(), and applySuffixHeuristic().

◆ removeElseAndBrackets()

static void clang::tidy::readability::removeElseAndBrackets ( DiagnosticBuilder &  Diag,
ASTContext &  Context,
const Stmt *  Else,
SourceLocation  ElseLoc 
)
static

Definition at line 117 of file ElseAfterReturnCheck.cpp.

◆ removeNamespaces()

static std::vector<std::string> clang::tidy::readability::removeNamespaces ( const std::vector< std::string > &  Names)
static

Definition at line 31 of file RedundantStringInitCheck.cpp.

◆ typeIsMemberPointer()

static bool clang::tidy::readability::typeIsMemberPointer ( const Type *  T)
static

Definition at line 81 of file IsolateDeclarationCheck.cpp.

◆ X()

static ClangTidyModuleRegistry::Add<ReadabilityModule> clang::tidy::readability::X ( "readability-module"  ,
"Adds readability-related checks."   
)
static

Variable Documentation

◆ CompareMessage

const StringRef clang::tidy::readability::CompareMessage
static
Initial value:
= "do not use 'compare' to test equality "
"of strings; use the string equality "
"operator instead"

Definition at line 21 of file StringCompareCheck.cpp.

◆ DefaultAbbreviations

const std::string clang::tidy::readability::DefaultAbbreviations
static

Definition at line 96 of file SuspiciousCallArgumentCheck.cpp.

◆ DefaultIgnoredExceptionVariableNames

const char clang::tidy::readability::DefaultIgnoredExceptionVariableNames[] = "^[e]$"

Definition at line 27 of file IdentifierLengthCheck.cpp.

◆ DefaultIgnoredFloatingPointValues

const char clang::tidy::readability::DefaultIgnoredFloatingPointValues[] = "1.0;100.0;"

Definition at line 61 of file MagicNumbersCheck.cpp.

◆ DefaultIgnoredIntegerValues

const char clang::tidy::readability::DefaultIgnoredIntegerValues[] = "1;2;3;4;"

Definition at line 60 of file MagicNumbersCheck.cpp.

◆ DefaultIgnoredLoopCounterNames

const char clang::tidy::readability::DefaultIgnoredLoopCounterNames[] = "^[ijk_]$"

Definition at line 25 of file IdentifierLengthCheck.cpp.

◆ DefaultIgnoredParameterNames

const char clang::tidy::readability::DefaultIgnoredParameterNames[] = "^[n]$"

Definition at line 28 of file IdentifierLengthCheck.cpp.

◆ DefaultIgnoredVariableNames

const char clang::tidy::readability::DefaultIgnoredVariableNames[] = ""

Definition at line 26 of file IdentifierLengthCheck.cpp.

◆ DefaultMinimumExceptionNameLength

const unsigned clang::tidy::readability::DefaultMinimumExceptionNameLength = 2

Definition at line 23 of file IdentifierLengthCheck.cpp.

◆ DefaultMinimumIdentifierNameLength

constexpr std::size_t clang::tidy::readability::DefaultMinimumIdentifierNameLength = 3
staticconstexpr

Definition at line 45 of file SuspiciousCallArgumentCheck.cpp.

◆ DefaultMinimumLoopCounterNameLength

const unsigned clang::tidy::readability::DefaultMinimumLoopCounterNameLength = 2

Definition at line 22 of file IdentifierLengthCheck.cpp.

◆ DefaultMinimumParameterNameLength

const unsigned clang::tidy::readability::DefaultMinimumParameterNameLength = 3

Definition at line 24 of file IdentifierLengthCheck.cpp.

◆ DefaultMinimumVariableNameLength

const unsigned clang::tidy::readability::DefaultMinimumVariableNameLength = 3

Definition at line 21 of file IdentifierLengthCheck.cpp.

◆ Defaults

constexpr DefaultHeuristicConfiguration clang::tidy::readability::Defaults[]
staticconstexpr
Initial value:
= {
{true, -1, -1},
{true, -1, -1},
{true, 25, 30},
{true, 25, 30},
{true, 40, 50},
{true, 50, 66},
{true, 75, 85},
{true, 60, 70},
}

Definition at line 51 of file SuspiciousCallArgumentCheck.cpp.

◆ DefaultStringNames

const char clang::tidy::readability::DefaultStringNames[]
Initial value:
=
"::std::basic_string_view;::std::basic_string"

Definition at line 21 of file RedundantStringInitCheck.cpp.

◆ ErrorMessage

const char clang::tidy::readability::ErrorMessage[]
Initial value:
=
"%select{variable|exception variable|loop variable|"
"parameter}0 name %1 is too short, expected at least %2 characters"

Definition at line 30 of file IdentifierLengthCheck.cpp.

◆ HeuristicToString

constexpr StringRef clang::tidy::readability::HeuristicToString[]
staticconstexpr
Initial value:
= {
"Equality", "Abbreviation", "Prefix", "Suffix",
"Substring", "Levenshtein", "JaroWinkler", "Dice"}

Definition at line 47 of file SuspiciousCallArgumentCheck.cpp.

◆ HungarainNotationPrimitiveTypes

const StringRef clang::tidy::readability::HungarainNotationPrimitiveTypes[]
static
Initial value:
= {
#define STRINGIZE(v)
}

Definition at line 184 of file IdentifierNamingCheck.cpp.

Referenced by clang::tidy::readability::IdentifierNamingCheck::HungarianNotation::loadFileConfig().

◆ HungarainNotationUserDefinedTypes

const StringRef clang::tidy::readability::HungarainNotationUserDefinedTypes[]
static
Initial value:
= {
#define STRINGIZE(v)
}

Definition at line 220 of file IdentifierNamingCheck.cpp.

Referenced by clang::tidy::readability::IdentifierNamingCheck::HungarianNotation::loadFileConfig().

◆ InterruptingStr

const char clang::tidy::readability::InterruptingStr[] = "interrupting"
static

Definition at line 46 of file ElseAfterReturnCheck.cpp.

◆ KDefaultTypes

const char clang::tidy::readability::KDefaultTypes[]
static
Initial value:
=
"::std::basic_string;::std::basic_string_view;::std::vector;::std::array"

Definition at line 20 of file SimplifySubscriptExprCheck.cpp.

◆ SmallVectorSize

constexpr std::size_t clang::tidy::readability::SmallVectorSize
staticconstexpr

◆ StyleNames

const StringRef clang::tidy::readability::StyleNames[]
static
Initial value:
= {
#define STRINGIZE(v)
}

Definition at line 133 of file IdentifierNamingCheck.cpp.

Referenced by clang::tidy::readability::IdentifierNamingCheck::getFileStyleFromOptions().

◆ WarningMessage

const char clang::tidy::readability::WarningMessage[] = "do not use 'else' after '%0'"
static

Definition at line 47 of file ElseAfterReturnCheck.cpp.

◆ WarnOnConditionVariablesStr

const char clang::tidy::readability::WarnOnConditionVariablesStr[] = "WarnOnConditionVariables"
static

Definition at line 49 of file ElseAfterReturnCheck.cpp.

◆ WarnOnUnfixableStr

const char clang::tidy::readability::WarnOnUnfixableStr[] = "WarnOnUnfixable"
static

Definition at line 48 of file ElseAfterReturnCheck.cpp.

clang::tidy::readability::SmallVectorSize
static constexpr std::size_t SmallVectorSize
Definition: SuspiciousCallArgumentCheck.cpp:129