clang-tools 22.0.0git
clang::tidy::modernize Namespace Reference

Classes

class  AvoidBindCheck
 Replace simple uses of std::bind with a lambda. More...
class  AvoidCArraysCheck
 Find C-style array types and recommend to use std::array<> / std::vector<>. More...
class  AvoidSetjmpLongjmpCheck
 Guards against use of setjmp/longjmp in C++ code. More...
class  AvoidVariadicFunctionsCheck
 Find all function definitions of C-style variadic functions. More...
struct  ClassifiedToken
class  ComponentFinderASTVisitor
 Class used to find the variables and member expressions on which an arbitrary expression depends. More...
class  ConcatNestedNamespacesCheck
class  Confidence
 A class to encapsulate lowering of the tool's confidence level. More...
struct  ContainerCall
class  DeclFinderASTVisitor
 Class used to determine if any declarations used in a Stmt would conflict with a particular identifier. More...
class  DependencyFinderASTVisitor
 Class used to determine if an expression is dependent on a variable declared inside of the loop where it would be used. More...
class  DeprecatedHeadersCheck
 This check replaces deprecated C library headers with their C++ STL alternatives. More...
class  DeprecatedIosBaseAliasesCheck
 This check warns the uses of the deprecated member types of std::ios_base and replaces those that have a non-deprecated equivalent. More...
struct  EnableIfData
class  ForLoopIndexUseVisitor
 Discover usages of expressions consisting of index or iterator access. More...
class  IntegralLiteralExpressionMatcher
class  LoopConvertCheck
class  MacroToEnumCallbacks
class  MacroToEnumCheck
 Replaces groups of related macros with an unscoped anonymous enum. More...
class  MakeSharedCheck
 Replace the pattern: More...
class  MakeSmartPtrCheck
 Base class for MakeSharedCheck and MakeUniqueCheck. More...
class  MakeUniqueCheck
 Replace the pattern: More...
class  MinMaxUseInitializerListCheck
 Replaces nested std::min and std::max calls with an initializer list where applicable. More...
class  ModernizeModule
class  NS
class  PassByValueCheck
class  RawStringLiteralCheck
 This check replaces string literals with escaped characters to raw string literals. More...
class  RedundantVoidArgCheck
 Find and remove redundant void argument lists. More...
class  ReplaceAutoPtrCheck
 Transforms the deprecated std::auto_ptr into the C++11 std::unique_ptr. More...
class  ReplaceDisallowCopyAndAssignMacroCheck
 This check finds macro expansions of DISALLOW_COPY_AND_ASSIGN(Type) and replaces them with a deleted copy constructor and a deleted assignment operator. More...
class  ReplaceRandomShuffleCheck
 std::random_shuffle will be removed as of C++17. More...
class  ReturnBracedInitListCheck
 Use a braced init list for return statements rather than unnecessary repeating the return type name. More...
class  ShrinkToFitCheck
 Replace copy and swap tricks on shrinkable containers with the shrink_to_fit() method call. More...
class  StmtAncestorASTVisitor
 Class used build the reverse AST properties needed to detect name conflicts and free variables. More...
struct  TUTrackingInfo
class  TypeTraitsCheck
 Converts standard library type traits of the form traits<...>::type and traits<...>::value into traits_t<...> and traits_v<...> respectively. More...
class  UnaryStaticAssertCheck
 Replaces a static_assert declaration with an empty message with the unary version. More...
struct  Usage
 The information needed to describe a valid convertible usage of an array index or iterator. More...
class  UseAutoCheck
class  UseBoolLiteralsCheck
 Finds integer literals which are cast to bool. More...
class  UseConstraintsCheck
 Replace enable_if with C++20 requires clauses. More...
class  UseDefaultMemberInitCheck
 Convert a default constructor's member initializers into default member initializers. More...
class  UseDesignatedInitializersCheck
 Finds initializer lists for aggregate type that could be written as designated initializers instead. More...
class  UseEmplaceCheck
 This check looks for cases when inserting new element into std::vector but the element is constructed temporarily. More...
class  UseEqualsDefaultCheck
 Replace default bodies of special member functions with '= default;'. More...
class  UseEqualsDeleteCheck
 Identifies unimplemented private special member functions, and recommends using = delete for them. More...
class  UseIntegerSignComparisonCheck
 Replace comparisons between signed and unsigned integers with their safe C++20 std::cmp_* alternative, if available. More...
class  UseNodiscardCheck
 Add [[nodiscard]] to non-void const-member functions with no arguments or pass-by-value or pass by const-reference arguments. More...
class  UseNoexceptCheck
 Replace dynamic exception specifications, with noexcept (or user-defined macro) or noexcept(false). More...
class  UseNullptrCheck
class  UseOverrideCheck
 Use C++11's override and remove virtual where applicable. More...
class  UseRangesCheck
 Detects calls to standard library iterator algorithms that could be replaced with a ranges version instead. More...
class  UseScopedLockCheck
 Finds uses of std::lock_guard and suggests replacing them with C++17's / alternative std::scoped_lock. More...
class  UseStartsEndsWithCheck
 Checks for common roundabout ways to express starts_with and / ends_with and suggests replacing with the simpler method when it is / available. More...
class  UseStdFormatCheck
 Converts calls to absl::StrFormat, or other functions via configuration options, to C++20's std::format, or another function via a configuration option, modifying the format string appropriately and removing now-unnecessary calls to std::string::c_str() and std::string::data(). More...
class  UseStdNumbersCheck
 Finds constants and function calls to math functions that can be replaced with c++20's mathematical constants from the numbers header and offers fix-it hints. More...
class  UseStdPrintCheck
 Convert calls to printf-like functions to std::print and std::println. More...
class  UseTrailingReturnTypeCheck
 Rewrites function signatures to use a trailing return type. More...
class  UseTransparentFunctorsCheck
 Prefer using transparent functors to non-transparent ones. More...
class  UseUncaughtExceptionsCheck
 This check will warn on calls to std::uncaught_exception and replace them with calls to std::uncaught_exceptions, since std::uncaught_exception was deprecated in C++17. More...
class  UseUsingCheck
 Check finds typedefs and replaces it with usings. More...
class  VariableNamer
 Create names for generated variables within a particular statement. More...

Typedefs

using NamespaceName = llvm::SmallString<40>
using StmtParentMap = llvm::DenseMap<const clang::Stmt *, const clang::Stmt *>
 A map used to walk the AST in reverse: maps child Stmt to parent Stmt.
using DeclParentMap
 A map used to walk the AST in reverse: maps VarDecl to the to parent DeclStmt.
using ReplacedVarsMap
 A map used to track which variables have been removed by a refactoring pass.
using StmtGeneratedVarNameMap
 A map used to remember the variable names generated in a Stmt.
using ComponentVector = llvm::SmallVector<const clang::Expr *, 16>
 A vector used to store the AST subtrees of an Expr.
using UsageResult = llvm::SmallVector<Usage, 8>
using CharsBitSet = std::bitset<1 << CHAR_BIT>

Enumerations

enum class  LiteralSize {
  Unknown = 0 , Int , UnsignedInt , Long ,
  UnsignedLong , LongLong , UnsignedLongLong
}
enum class  IteratorCallKind { ICK_Member , ICK_ADL , ICK_Std }
enum  LoopFixerKind { LFK_Array , LFK_Iterator , LFK_ReverseIterator , LFK_PseudoArray }

Functions

static bool tryCaptureAsLocalVariable (const MatchFinder::MatchResult &Result, BindArgument &B, const Expr *E)
static bool tryCaptureAsMemberVariable (const MatchFinder::MatchResult &Result, BindArgument &B, const Expr *E)
static const Expr * ignoreTemporariesAndPointers (const Expr *E)
static const Expr * ignoreTemporariesAndConstructors (const Expr *E)
static StringRef getSourceTextForExpr (const MatchFinder::MatchResult &Result, const Expr *E)
static bool isCallExprNamed (const Expr *E, StringRef Name)
static void initializeBindArgumentForCallExpr (const MatchFinder::MatchResult &Result, BindArgument &B, const CallExpr *CE, unsigned &CaptureIndex)
static bool anyDescendantIsLocal (const Stmt *Statement)
static SmallVector< BindArgument, 4 > buildBindArguments (const MatchFinder::MatchResult &Result, const CallableInfo &Callable)
static int findPositionOfPlaceholderUse (ArrayRef< BindArgument > Args, size_t PlaceholderIndex)
static void addPlaceholderArgs (const LambdaProperties &LP, llvm::raw_ostream &Stream, bool PermissiveParameterList)
static void addFunctionCallArgs (ArrayRef< BindArgument > Args, llvm::raw_ostream &Stream)
static bool isPlaceHolderIndexRepeated (const ArrayRef< BindArgument > Args)
static std::vector< const FunctionDecl * > findCandidateCallOperators (const CXXRecordDecl *RecordDecl, size_t NumArgs)
static bool isFixitSupported (const CallableInfo &Callee, ArrayRef< BindArgument > Args)
static const FunctionDecl * getCallOperator (const CXXRecordDecl *Callable, size_t NumArgs)
static const FunctionDecl * getCallMethodDecl (const MatchFinder::MatchResult &Result, CallableType Type, CallableMaterializationKind Materialization)
static CallableType getCallableType (const MatchFinder::MatchResult &Result)
static CallableMaterializationKind getCallableMaterialization (const MatchFinder::MatchResult &Result)
static LambdaProperties getLambdaProperties (const MatchFinder::MatchResult &Result)
static bool emitCapture (llvm::StringSet<> &CaptureSet, StringRef Delimiter, CaptureMode CM, CaptureExpr CE, StringRef Identifier, StringRef InitExpression, raw_ostream &Stream)
static void emitCaptureList (const LambdaProperties &LP, const MatchFinder::MatchResult &Result, raw_ostream &Stream)
static ArrayRef< BindArgument > getForwardedArgumentList (const LambdaProperties &P)
static bool locationsInSameFile (const SourceManager &Sources, SourceLocation Loc1, SourceLocation Loc2)
static StringRef getRawStringRef (const SourceRange &Range, const SourceManager &Sources, const LangOptions &LangOpts)
static std::optional< const char * > getReplacementType (StringRef Type)
static bool isIntegralConstant (const Token &Token)
static LiteralSize literalTokenSize (const Token &Tok)
static bool operator< (LiteralSize LHS, LiteralSize RHS)
static StatementMatcher integerComparisonMatcher ()
static DeclarationMatcher initToZeroMatcher ()
static StatementMatcher incrementVarMatcher ()
static StatementMatcher arrayConditionMatcher (internal::Matcher< Expr > LimitExpr)
static StatementMatcher makeArrayLoopMatcher ()
 The matcher for loops over arrays.
static StatementMatcher makeIteratorLoopMatcher (bool IsReverse)
 The matcher used for iterator-based for loops.
static StatementMatcher makePseudoArrayLoopMatcher ()
 The matcher used for array-like containers (pseudoarrays).
static std::optional< ContainerCallgetContainerExpr (const Expr *Call)
static std::pair< const Expr *, IteratorCallKindgetContainerFromBeginEndCall (const Expr *Init, bool IsBegin, bool *IsArrow, bool IsReverse)
 Determine whether Init appears to be an initializing an iterator.
static const Expr * findContainer (ASTContext *Context, const Expr *BeginExpr, const Expr *EndExpr, bool *ContainerNeedsDereference, bool IsReverse)
 Determines the container whose begin() and end() functions are called for an iterator-based loop.
static StringRef getStringFromRange (SourceManager &SourceMgr, const LangOptions &LangOpts, SourceRange Range)
 Obtain the original source code text from a SourceRange.
static const ValueDecl * getReferencedVariable (const Expr *E)
 If the given expression is actually a DeclRefExpr or a MemberExpr, find and return the underlying ValueDecl; otherwise, return NULL.
static bool isDirectMemberExpr (const Expr *E)
 Returns true when the given expression is a member expression whose base is this (implicitly or not).
static bool canBeModified (ASTContext *Context, const Expr *E)
 Given an expression that represents an usage of an element from the container that we are iterating over, returns false when it can be guaranteed this element cannot be modified as a result of this usage.
static bool usagesAreConst (ASTContext *Context, const UsageResult &Usages)
 Returns true when it can be guaranteed that the elements of the container are not being modified.
static bool usagesReturnRValues (const UsageResult &Usages)
 Returns true if the elements of the container are never accessed by reference.
static bool containerIsConst (const Expr *ContainerExpr, bool Dereference)
 Returns true if the container is const-qualified.
const Expr * digThroughConstructorsConversions (const Expr *E)
 Look through conversion/copy constructors and member functions to find the explicit initialization expression, returning it is found.
bool areSameExpr (ASTContext *Context, const Expr *First, const Expr *Second)
 Returns true when two Exprs are equivalent.
const DeclRefExpr * getDeclRef (const Expr *E)
 Returns the DeclRefExpr represented by E, or NULL if there isn't one.
bool areSameVariable (const ValueDecl *First, const ValueDecl *Second)
 Returns true when two ValueDecls are the same variable.
static bool exprReferencesVariable (const ValueDecl *Target, const Expr *E)
 Determines if an expression is a declaration reference to a particular variable.
static const Expr * getDereferenceOperand (const Expr *E)
 If the expression is a dereference or call to operator*(), return the operand.
template<typename ContainerT>
static bool containsExpr (ASTContext *Context, const ContainerT *Container, const Expr *E)
 Returns true when the Container contains an Expr equivalent to E.
static bool isIndexInSubscriptExpr (const Expr *IndexExpr, const VarDecl *IndexVar)
 Returns true when the index expression is a declaration reference to IndexVar.
static bool isIndexInSubscriptExpr (ASTContext *Context, const Expr *IndexExpr, const VarDecl *IndexVar, const Expr *Obj, const Expr *SourceExpr, bool PermitDeref)
 Returns true when the index expression is a declaration reference to IndexVar, Obj is the same expression as SourceExpr after all parens and implicit casts are stripped off.
static bool isDereferenceOfOpCall (const CXXOperatorCallExpr *OpCall, const VarDecl *IndexVar)
 Returns true when Opcall is a call a one-parameter dereference of IndexVar.
static bool isDereferenceOfUop (const UnaryOperator *Uop, const VarDecl *IndexVar)
 Returns true when Uop is a dereference of IndexVar.
static bool isAliasDecl (ASTContext *Context, const Decl *TheDecl, const VarDecl *IndexVar)
 Determines whether the given Decl defines a variable initialized to the loop object.
static bool arrayMatchesBoundExpr (ASTContext *Context, const QualType &ArrayType, const Expr *ConditionExpr)
 Determines whether the bound of a for loop condition expression is the same as the statically computable size of ArrayType.
static bool hasOnlyComments (SourceLocation Loc, const LangOptions &Options, StringRef Text)
static StringRef getTokenName (const Token &Tok)
template<size_t N>
static bool textEquals (const char(&Needle)[N], const char *HayStack)
template<size_t N>
static size_t len (const char(&)[N])
static bool isValid (SourceRange Range)
static bool empty (SourceRange Range)
static std::string getNewExprName (const CXXNewExpr *NewExpr, const SourceManager &SM, const LangOptions &Lang)
static FindArgsResult findArgs (const CallExpr *Call)
static std::pair< bool, SmallVector< FixItHint > > generateReplacements (const MatchFinder::MatchResult &Match, const CallExpr *TopCall, const FindArgsResult &Result, const bool IgnoreNonTrivialTypes, const std::uint64_t IgnoreTrivialTypesOfSizeAbove)
static ClangTidyModuleRegistry::Add< ModernizeModuleX ("modernize-module", "Add modernize checks.")
static bool isFirstFriendOfSecond (const CXXRecordDecl *Friend, const CXXRecordDecl *Class)
static TypeMatcher notTemplateSpecConstRefType ()
static TypeMatcher nonConstValueType ()
static bool paramReferredExactlyOnce (const CXXConstructorDecl *Ctor, const ParmVarDecl *ParamDecl)
 Whether or not ParamDecl is used exactly one time in Ctor.
static bool hasRValueOverload (const CXXConstructorDecl *Ctor, const ParmVarDecl *Param)
 Returns true if the given constructor is part of a lvalue/rvalue reference pair, i.e.
static SmallVector< const ParmVarDecl *, 2 > collectParamDecls (const CXXConstructorDecl *Ctor, const ParmVarDecl *ParamDecl)
 Find all references to ParamDecl across all of the redeclarations of Ctor.
static bool containsEscapes (StringRef HayStack, StringRef Escapes)
static bool isRawStringLiteral (StringRef Text)
static bool containsEscapedCharacters (const MatchFinder::MatchResult &Result, const StringLiteral *Literal, const CharsBitSet &DisallowedChars)
static bool containsDelimiter (StringRef Bytes, const std::string &Delimiter)
static std::optional< StringRef > createUserDefinedSuffix (const StringLiteral *Literal, const SourceManager &SM, const LangOptions &LangOpts)
static std::string createRawStringLiteral (const StringLiteral *Literal, const std::string &DelimiterStem, const SourceManager &SM, const LangOptions &LangOpts)
static bool compareStringLength (StringRef Replacement, const StringLiteral *Literal, const SourceManager &SM, const LangOptions &LangOpts)
static bool isMacroIdentifier (const IdentifierTable &Idents, const Token &ProtoToken)
static DeclarationName getName (const DependentScopeDeclRefExpr &D)
static DeclarationName getName (const DeclRefExpr &D)
static bool isNamedDeclInStdTraitsSet (const NamedDecl *ND, const llvm::StringSet<> &Set)
static bool checkTemplatedDecl (NestedNameSpecifier NNS, const llvm::StringSet<> &Set)
static void ignoreTypeLocClasses (TypeLoc &Loc, const std::initializer_list< TypeLoc::TypeLocClass > &LocClasses)
static bool isMultiLevelPointerToTypeLocClasses (TypeLoc Loc, const std::initializer_list< TypeLoc::TypeLocClass > &LocClasses)
static std::optional< TemplateSpecializationTypeLoc > matchEnableIfSpecializationImplTypename (TypeLoc TheType)
static std::optional< TemplateSpecializationTypeLoc > matchEnableIfSpecializationImplTrait (TypeLoc TheType)
static std::optional< TemplateSpecializationTypeLoc > matchEnableIfSpecializationImpl (TypeLoc TheType)
static std::optional< EnableIfDatamatchEnableIfSpecialization (TypeLoc TheType)
static std::pair< std::optional< EnableIfData >, const Decl * > matchTrailingTemplateParam (const FunctionTemplateDecl *FunctionTemplate)
template<typename T>
static SourceLocation getRAngleFileLoc (const SourceManager &SM, const T &Element)
static SourceRange getConditionRange (ASTContext &Context, const TemplateSpecializationTypeLoc &EnableIf)
static SourceRange getTypeRange (ASTContext &Context, const TemplateSpecializationTypeLoc &EnableIf)
static std::optional< StringRef > getTypeText (ASTContext &Context, const TemplateSpecializationTypeLoc &EnableIf)
static std::optional< SourceLocation > findInsertionForConstraint (const FunctionDecl *Function, ASTContext &Context)
static bool isPrimaryExpression (const Expr *Expression)
static std::optional< std::string > getConditionText (const Expr *ConditionExpr, SourceRange ConditionRange, ASTContext &Context)
static std::vector< FixItHint > handleReturnType (const FunctionDecl *Function, const TypeLoc &ReturnType, const EnableIfData &EnableIf, ASTContext &Context)
static std::vector< FixItHint > handleTrailingTemplateType (const FunctionTemplateDecl *FunctionTemplate, const FunctionDecl *Function, const Decl *LastTemplateParam, const EnableIfData &EnableIf, ASTContext &Context)
static bool isExprAllowedInMemberInit (const Expr *E)
static StringRef getValueOfValueInit (const QualType InitType)
static bool isZero (const Expr *E)
static const Expr * ignoreUnaryPlus (const Expr *E)
static const Expr * getInitializer (const Expr *E)
static bool sameValue (const Expr *E1, const Expr *E2)
static std::set< const FieldDecl * > getAllNamedFields (const CXXRecordDecl *Record)
 Finds all the named non-static fields of Record.
static std::set< const Type * > getAllDirectBases (const CXXRecordDecl *Record)
 Returns the names of the direct bases of Record, both virtual and non-virtual.
static internal::Matcher< Expr > accessToFieldInVar (const FieldDecl *Field, const ValueDecl *Var)
 Returns a matcher that matches member expressions where the base is the variable declared as Var and the accessed member is the one declared as Field.
static bool isCopyConstructorAndCanBeDefaulted (ASTContext *Context, const CXXConstructorDecl *Ctor)
 Check that the given constructor has copy signature and that it copy-initializes all its bases and members.
static bool isCopyAssignmentAndCanBeDefaulted (ASTContext *Context, const CXXMethodDecl *Operator)
 Checks that the given method is an overloading of the assignment operator, has copy signature, returns a reference to "*this" and copies all its members and subobjects.
static bool bodyEmpty (const ASTContext *Context, const CompoundStmt *Body)
 Returns false if the body has any non-whitespace character.
static bool isActualCharType (const clang::QualType &Ty)
 Find if the passed type is the actual "char" type, not applicable to explicit "signed char" or "unsigned char" types.
static BindableMatcher< clang::Stmt > intCastExpression (bool IsSigned, const std::string &CastBindName=std::string())
static StringRef parseOpCode (BinaryOperator::Opcode Code)
static bool doesNoDiscardMacroExist (ASTContext &Context, const llvm::StringRef &MacroId)
static SmallVector< Token, 16 > parseTokens (CharSourceRange Range, const MatchFinder::MatchResult &Result)
static StringRef getText (const Token &Tok, const SourceManager &Sources)
static bool isLockGuardDecl (const NamedDecl *Decl)
static bool isLockGuard (const QualType &Type)
static llvm::SmallVector< const VarDecl * > getLockGuardsFromDecl (const DeclStmt *DS)
static llvm::SmallVector< llvm::SmallVector< const VarDecl * > > findLocksInCompoundStmt (const CompoundStmt *Block, const ast_matchers::MatchFinder::MatchResult &Result)
static SourceRange getLockGuardRange (const TypeSourceInfo *SourceInfo)
static SourceRange getLockGuardNameRange (const TypeSourceInfo *SourceInfo)
static bool isNegativeComparison (const Expr *ComparisonExpr)
static clang::ast_matchers::StatementMatcher unusedReturnValue (clang::ast_matchers::StatementMatcher MatchedCallExpr)
static SourceLocation expandIfMacroId (SourceLocation Loc, const SourceManager &SM)
static SourceLocation findTrailingReturnTypeSourceLocation (const FunctionDecl &F, const FunctionTypeLoc &FTL, const ASTContext &Ctx, const SourceManager &SM, const LangOptions &LangOpts)
static bool isCvr (Token T)
static bool isSpecifier (Token T)
static std::optional< ClassifiedTokenclassifyToken (const FunctionDecl &F, Preprocessor &PP, Token Tok)
static std::optional< SmallVector< ClassifiedToken, 8 > > classifyTokensBeforeFunctionName (const FunctionDecl &F, const ASTContext &Ctx, const SourceManager &SM, const LangOptions &LangOpts, Preprocessor *PP)
static bool hasAnyNestedLocalQualifiers (QualType Type)
static SourceRange findReturnTypeAndCVSourceRange (const FunctionDecl &F, const TypeLoc &ReturnLoc, const ASTContext &Ctx, const SourceManager &SM, const LangOptions &LangOpts, Preprocessor *PP)
static SourceLocation findLambdaTrailingReturnInsertLoc (const CXXMethodDecl *Method, const SourceManager &SM, const LangOptions &LangOpts, const ASTContext &Ctx)
static void keepSpecifiers (std::string &ReturnType, std::string &Auto, SourceRange ReturnTypeCVRange, const FunctionDecl &F, const FriendDecl *Fr, const ASTContext &Ctx, const SourceManager &SM, const LangOptions &LangOpts, Preprocessor *PP)
template<typename T>
static T getInnerTypeLocAs (TypeLoc Loc)

Variables

static constexpr std::array< StringRef, 5 > DeprecatedTypes
static const char LoopNameArray [] = "forLoopArray"
static const char LoopNameIterator [] = "forLoopIterator"
static const char LoopNameReverseIterator [] = "forLoopReverseIterator"
static const char LoopNamePseudoArray [] = "forLoopPseudoArray"
static const char ConditionBoundName [] = "conditionBound"
static const char InitVarName [] = "initVar"
static const char BeginCallName [] = "beginCall"
static const char EndCallName [] = "endCall"
static const char EndVarName [] = "endVar"
static const char DerefByValueResultName [] = "derefByValueResult"
static const char DerefByRefResultName [] = "derefByRefResult"
static const llvm::StringSet MemberNames
static const llvm::StringSet ADLNames
static const llvm::StringSet StdNames
static constexpr char ConstructorCall [] = "constructorCall"
static constexpr char DirectVar [] = "directVar"
static constexpr char ResetCall [] = "resetCall"
static constexpr char NewExpression [] = "newExpression"
static const llvm::StringSet ValueTraits
static const llvm::StringSet TypeTraits
static constexpr char Bind [] = ""
static constexpr char IgnoreSingleElementAggregatesName []
static constexpr bool IgnoreSingleElementAggregatesDefault = true
static constexpr char RestrictToPODTypesName [] = "RestrictToPODTypes"
static constexpr bool RestrictToPODTypesDefault = false
static constexpr char IgnoreMacrosName [] = "IgnoreMacros"
static constexpr bool IgnoreMacrosDefault = true
static constexpr char StrictCStandardComplianceName []
static constexpr bool StrictCStandardComplianceDefault = true
static constexpr char StrictCppStandardComplianceName []
static constexpr bool StrictCppStandardComplianceDefault = true
static const char SpecialFunction [] = "SpecialFunction"
static const char SpecialFunction [] = "SpecialFunction"
static const char DeletedNotPublic [] = "DeletedNotPublic"
static constexpr const char * SingleRangeNames []
static constexpr const char * TwoRangeNames []
static constexpr const char * SinglePivotRangeNames []
static const StringRef UseScopedLockMessage
constexpr llvm::StringLiteral ErrorMessageOnFunction
constexpr llvm::StringLiteral ErrorMessageOnLambda
static const StringRef Message = "prefer transparent functors '%0<>'"
static constexpr llvm::StringLiteral ExternCDeclName = "extern-c-decl"
static constexpr llvm::StringLiteral ParentDeclName = "parent-decl"
static constexpr llvm::StringLiteral TagDeclName = "tag-decl"
static constexpr llvm::StringLiteral TypedefName = "typedef"
static constexpr llvm::StringLiteral DeclStmtName = "decl-stmt"

Typedef Documentation

◆ CharsBitSet

using clang::tidy::modernize::CharsBitSet = std::bitset<1 << CHAR_BIT>

Definition at line 17 of file RawStringLiteralCheck.h.

◆ ComponentVector

using clang::tidy::modernize::ComponentVector = llvm::SmallVector<const clang::Expr *, 16>

A vector used to store the AST subtrees of an Expr.

Definition at line 52 of file LoopConvertUtils.h.

◆ DeclParentMap

Initial value:
llvm::DenseMap<const clang::VarDecl *, const clang::DeclStmt *>

A map used to walk the AST in reverse: maps VarDecl to the to parent DeclStmt.

Definition at line 39 of file LoopConvertUtils.h.

◆ NamespaceName

using clang::tidy::modernize::NamespaceName = llvm::SmallString<40>

Definition at line 18 of file ConcatNestedNamespacesCheck.h.

◆ ReplacedVarsMap

Initial value:
llvm::DenseMap<const clang::ForStmt *, const clang::VarDecl *>

A map used to track which variables have been removed by a refactoring pass.

It maps the parent ForStmt to the removed index variable's VarDecl.

Definition at line 44 of file LoopConvertUtils.h.

◆ StmtGeneratedVarNameMap

Initial value:
llvm::DenseMap<const clang::Stmt *, std::string>

A map used to remember the variable names generated in a Stmt.

Definition at line 48 of file LoopConvertUtils.h.

◆ StmtParentMap

using clang::tidy::modernize::StmtParentMap = llvm::DenseMap<const clang::Stmt *, const clang::Stmt *>

A map used to walk the AST in reverse: maps child Stmt to parent Stmt.

Definition at line 35 of file LoopConvertUtils.h.

◆ UsageResult

using clang::tidy::modernize::UsageResult = llvm::SmallVector<Usage, 8>

Definition at line 273 of file LoopConvertUtils.h.

Enumeration Type Documentation

◆ IteratorCallKind

Enumerator
ICK_Member 
ICK_ADL 
ICK_Std 

Definition at line 334 of file LoopConvertCheck.cpp.

◆ LiteralSize

Enumerator
Unknown 
Int 
UnsignedInt 
Long 
UnsignedLong 
LongLong 
UnsignedLongLong 

Definition at line 17 of file IntegralLiteralExpressionMatcher.h.

◆ LoopFixerKind

Enumerator
LFK_Array 
LFK_Iterator 
LFK_ReverseIterator 
LFK_PseudoArray 

Definition at line 27 of file LoopConvertUtils.h.

Function Documentation

◆ accessToFieldInVar()

internal::Matcher< Expr > clang::tidy::modernize::accessToFieldInVar ( const FieldDecl * Field,
const ValueDecl * Var )
static

Returns a matcher that matches member expressions where the base is the variable declared as Var and the accessed member is the one declared as Field.

Definition at line 51 of file UseEqualsDefaultCheck.cpp.

Referenced by isCopyAssignmentAndCanBeDefaulted(), and isCopyConstructorAndCanBeDefaulted().

◆ addFunctionCallArgs()

void clang::tidy::modernize::addFunctionCallArgs ( ArrayRef< BindArgument > Args,
llvm::raw_ostream & Stream )
static

Definition at line 360 of file AvoidBindCheck.cpp.

Referenced by clang::tidy::modernize::AvoidBindCheck::check().

◆ addPlaceholderArgs()

void clang::tidy::modernize::addPlaceholderArgs ( const LambdaProperties & LP,
llvm::raw_ostream & Stream,
bool PermissiveParameterList )
static

◆ anyDescendantIsLocal()

bool clang::tidy::modernize::anyDescendantIsLocal ( const Stmt * Statement)
static

Definition at line 181 of file AvoidBindCheck.cpp.

References anyDescendantIsLocal().

Referenced by anyDescendantIsLocal(), and buildBindArguments().

◆ areSameExpr()

bool clang::tidy::modernize::areSameExpr ( ASTContext * Context,
const Expr * First,
const Expr * Second )

Returns true when two Exprs are equivalent.

Definition at line 191 of file LoopConvertUtils.cpp.

References clang::tidy::utils::areStatementsIdentical().

Referenced by findContainer(), and isIndexInSubscriptExpr().

◆ areSameVariable()

bool clang::tidy::modernize::areSameVariable ( const ValueDecl * First,
const ValueDecl * Second )

Returns true when two ValueDecls are the same variable.

Definition at line 201 of file LoopConvertUtils.cpp.

Referenced by exprReferencesVariable(), and isIndexInSubscriptExpr().

◆ arrayConditionMatcher()

StatementMatcher clang::tidy::modernize::arrayConditionMatcher ( internal::Matcher< Expr > LimitExpr)
static

Definition at line 95 of file LoopConvertCheck.cpp.

References integerComparisonMatcher().

Referenced by makeArrayLoopMatcher(), and makePseudoArrayLoopMatcher().

◆ arrayMatchesBoundExpr()

bool clang::tidy::modernize::arrayMatchesBoundExpr ( ASTContext * Context,
const QualType & ArrayType,
const Expr * ConditionExpr )
static

Determines whether the bound of a for loop condition expression is the same as the statically computable size of ArrayType.

Given

const int N = 5;
int arr[N];

This is intended to permit

for (int i = 0; i < N; ++i) { /* use arr[i] */ }
for (int i = 0; i < arraysize(arr); ++i) { /* use arr[i] */ }

Definition at line 430 of file LoopConvertUtils.cpp.

◆ bodyEmpty()

bool clang::tidy::modernize::bodyEmpty ( const ASTContext * Context,
const CompoundStmt * Body )
static

Returns false if the body has any non-whitespace character.

Definition at line 201 of file UseEqualsDefaultCheck.cpp.

Referenced by clang::tidy::modernize::UseEqualsDefaultCheck::check().

◆ buildBindArguments()

SmallVector< BindArgument, 4 > clang::tidy::modernize::buildBindArguments ( const MatchFinder::MatchResult & Result,
const CallableInfo & Callable )
static

◆ canBeModified()

bool clang::tidy::modernize::canBeModified ( ASTContext * Context,
const Expr * E )
static

Given an expression that represents an usage of an element from the container that we are iterating over, returns false when it can be guaranteed this element cannot be modified as a result of this usage.

Definition at line 494 of file LoopConvertCheck.cpp.

Referenced by usagesAreConst().

◆ checkTemplatedDecl()

bool clang::tidy::modernize::checkTemplatedDecl ( NestedNameSpecifier NNS,
const llvm::StringSet<> & Set )
static

◆ classifyToken()

std::optional< ClassifiedToken > clang::tidy::modernize::classifyToken ( const FunctionDecl & F,
Preprocessor & PP,
Token Tok )
static

◆ classifyTokensBeforeFunctionName()

std::optional< SmallVector< ClassifiedToken, 8 > > clang::tidy::modernize::classifyTokensBeforeFunctionName ( const FunctionDecl & F,
const ASTContext & Ctx,
const SourceManager & SM,
const LangOptions & LangOpts,
Preprocessor * PP )
static

◆ collectParamDecls()

SmallVector< const ParmVarDecl *, 2 > clang::tidy::modernize::collectParamDecls ( const CXXConstructorDecl * Ctor,
const ParmVarDecl * ParamDecl )
static

Find all references to ParamDecl across all of the redeclarations of Ctor.

Definition at line 208 of file PassByValueCheck.cpp.

References collectParamDecls().

Referenced by clang::tidy::modernize::PassByValueCheck::check(), and collectParamDecls().

◆ compareStringLength()

bool clang::tidy::modernize::compareStringLength ( StringRef Replacement,
const StringLiteral * Literal,
const SourceManager & SM,
const LangOptions & LangOpts )
static

◆ containerIsConst()

bool clang::tidy::modernize::containerIsConst ( const Expr * ContainerExpr,
bool Dereference )
static

Returns true if the container is const-qualified.

Definition at line 538 of file LoopConvertCheck.cpp.

References getReferencedVariable().

◆ containsDelimiter()

bool clang::tidy::modernize::containsDelimiter ( StringRef Bytes,
const std::string & Delimiter )
static

Definition at line 65 of file RawStringLiteralCheck.cpp.

Referenced by createRawStringLiteral().

◆ containsEscapedCharacters()

bool clang::tidy::modernize::containsEscapedCharacters ( const MatchFinder::MatchResult & Result,
const StringLiteral * Literal,
const CharsBitSet & DisallowedChars )
static

◆ containsEscapes()

bool clang::tidy::modernize::containsEscapes ( StringRef HayStack,
StringRef Escapes )
static

Definition at line 22 of file RawStringLiteralCheck.cpp.

Referenced by containsEscapedCharacters().

◆ containsExpr()

template<typename ContainerT>
bool clang::tidy::modernize::containsExpr ( ASTContext * Context,
const ContainerT * Container,
const Expr * E )
static

Returns true when the Container contains an Expr equivalent to E.

Definition at line 232 of file LoopConvertUtils.cpp.

◆ createRawStringLiteral()

std::string clang::tidy::modernize::createRawStringLiteral ( const StringLiteral * Literal,
const std::string & DelimiterStem,
const SourceManager & SM,
const LangOptions & LangOpts )
static

◆ createUserDefinedSuffix()

std::optional< StringRef > clang::tidy::modernize::createUserDefinedSuffix ( const StringLiteral * Literal,
const SourceManager & SM,
const LangOptions & LangOpts )
static

Definition at line 109 of file RawStringLiteralCheck.cpp.

Referenced by createRawStringLiteral().

◆ digThroughConstructorsConversions()

const Expr * clang::tidy::modernize::digThroughConstructorsConversions ( const Expr * E)

Look through conversion/copy constructors and member functions to find the explicit initialization expression, returning it is found.

The main idea is that given vector<int> v; we consider either of these initializations vector<int>::iterator it = v.begin(); vector<int>::iterator it(v.begin()); vector<int>::const_iterator it(v.begin()); and retrieve v.begin() as the expression used to initialize it but do not include vector<int>::iterator it; vector<int>::iterator it(v.begin(), 0); // if this constructor existed as being initialized from v.begin()

Definition at line 167 of file LoopConvertUtils.cpp.

References digThroughConstructorsConversions().

Referenced by digThroughConstructorsConversions(), getContainerExpr(), and isAliasDecl().

◆ doesNoDiscardMacroExist()

bool clang::tidy::modernize::doesNoDiscardMacroExist ( ASTContext & Context,
const llvm::StringRef & MacroId )
static

◆ emitCapture()

bool clang::tidy::modernize::emitCapture ( llvm::StringSet<> & CaptureSet,
StringRef Delimiter,
CaptureMode CM,
CaptureExpr CE,
StringRef Identifier,
StringRef InitExpression,
raw_ostream & Stream )
static

Definition at line 581 of file AvoidBindCheck.cpp.

Referenced by emitCaptureList().

◆ emitCaptureList()

void clang::tidy::modernize::emitCaptureList ( const LambdaProperties & LP,
const MatchFinder::MatchResult & Result,
raw_ostream & Stream )
static

Definition at line 603 of file AvoidBindCheck.cpp.

References emitCapture().

Referenced by clang::tidy::modernize::AvoidBindCheck::check().

◆ empty()

◆ expandIfMacroId()

SourceLocation clang::tidy::modernize::expandIfMacroId ( SourceLocation Loc,
const SourceManager & SM )
static

◆ exprReferencesVariable()

bool clang::tidy::modernize::exprReferencesVariable ( const ValueDecl * Target,
const Expr * E )
static

Determines if an expression is a declaration reference to a particular variable.

Definition at line 208 of file LoopConvertUtils.cpp.

References areSameVariable(), and getDeclRef().

Referenced by isDereferenceOfOpCall(), and isDereferenceOfUop().

◆ findArgs()

FindArgsResult clang::tidy::modernize::findArgs ( const CallExpr * Call)
static

◆ findCandidateCallOperators()

std::vector< const FunctionDecl * > clang::tidy::modernize::findCandidateCallOperators ( const CXXRecordDecl * RecordDecl,
size_t NumArgs )
static

Definition at line 391 of file AvoidBindCheck.cpp.

Referenced by getCallOperator().

◆ findContainer()

const Expr * clang::tidy::modernize::findContainer ( ASTContext * Context,
const Expr * BeginExpr,
const Expr * EndExpr,
bool * ContainerNeedsDereference,
bool IsReverse )
static

Determines the container whose begin() and end() functions are called for an iterator-based loop.

BeginExpr must be a member call to a function named "begin()", and EndExpr must be a member.

Definition at line 432 of file LoopConvertCheck.cpp.

References areSameExpr(), and getContainerFromBeginEndCall().

Referenced by clang::tidy::modernize::LoopConvertCheck::check().

◆ findInsertionForConstraint()

std::optional< SourceLocation > clang::tidy::modernize::findInsertionForConstraint ( const FunctionDecl * Function,
ASTContext & Context )
static

◆ findLambdaTrailingReturnInsertLoc()

SourceLocation clang::tidy::modernize::findLambdaTrailingReturnInsertLoc ( const CXXMethodDecl * Method,
const SourceManager & SM,
const LangOptions & LangOpts,
const ASTContext & Ctx )
static

Definition at line 361 of file UseTrailingReturnTypeCheck.cpp.

◆ findLocksInCompoundStmt()

llvm::SmallVector< llvm::SmallVector< const VarDecl * > > clang::tidy::modernize::findLocksInCompoundStmt ( const CompoundStmt * Block,
const ast_matchers::MatchFinder::MatchResult & Result )
static

◆ findPositionOfPlaceholderUse()

int clang::tidy::modernize::findPositionOfPlaceholderUse ( ArrayRef< BindArgument > Args,
size_t PlaceholderIndex )
static

Definition at line 318 of file AvoidBindCheck.cpp.

Referenced by addPlaceholderArgs().

◆ findReturnTypeAndCVSourceRange()

SourceRange clang::tidy::modernize::findReturnTypeAndCVSourceRange ( const FunctionDecl & F,
const TypeLoc & ReturnLoc,
const ASTContext & Ctx,
const SourceManager & SM,
const LangOptions & LangOpts,
Preprocessor * PP )
static

◆ findTrailingReturnTypeSourceLocation()

SourceLocation clang::tidy::modernize::findTrailingReturnTypeSourceLocation ( const FunctionDecl & F,
const FunctionTypeLoc & FTL,
const ASTContext & Ctx,
const SourceManager & SM,
const LangOptions & LangOpts )
static

◆ generateReplacements()

std::pair< bool, SmallVector< FixItHint > > clang::tidy::modernize::generateReplacements ( const MatchFinder::MatchResult & Match,
const CallExpr * TopCall,
const FindArgsResult & Result,
const bool IgnoreNonTrivialTypes,
const std::uint64_t IgnoreTrivialTypesOfSizeAbove )
static

◆ getAllDirectBases()

std::set< const Type * > clang::tidy::modernize::getAllDirectBases ( const CXXRecordDecl * Record)
static

Returns the names of the direct bases of Record, both virtual and non-virtual.

Definition at line 38 of file UseEqualsDefaultCheck.cpp.

Referenced by isCopyAssignmentAndCanBeDefaulted(), and isCopyConstructorAndCanBeDefaulted().

◆ getAllNamedFields()

std::set< const FieldDecl * > clang::tidy::modernize::getAllNamedFields ( const CXXRecordDecl * Record)
static

Finds all the named non-static fields of Record.

Definition at line 25 of file UseEqualsDefaultCheck.cpp.

Referenced by isCopyAssignmentAndCanBeDefaulted(), and isCopyConstructorAndCanBeDefaulted().

◆ getCallableMaterialization()

CallableMaterializationKind clang::tidy::modernize::getCallableMaterialization ( const MatchFinder::MatchResult & Result)
static

Definition at line 511 of file AvoidBindCheck.cpp.

References ignoreTemporariesAndPointers().

Referenced by getLambdaProperties().

◆ getCallableType()

CallableType clang::tidy::modernize::getCallableType ( const MatchFinder::MatchResult & Result)
static

Definition at line 488 of file AvoidBindCheck.cpp.

Referenced by getLambdaProperties().

◆ getCallMethodDecl()

const FunctionDecl * clang::tidy::modernize::getCallMethodDecl ( const MatchFinder::MatchResult & Result,
CallableType Type,
CallableMaterializationKind Materialization )
static

Definition at line 466 of file AvoidBindCheck.cpp.

References getCallOperator(), and ignoreTemporariesAndPointers().

Referenced by getLambdaProperties().

◆ getCallOperator()

const FunctionDecl * clang::tidy::modernize::getCallOperator ( const CXXRecordDecl * Callable,
size_t NumArgs )
static

Definition at line 455 of file AvoidBindCheck.cpp.

References findCandidateCallOperators().

Referenced by getCallMethodDecl().

◆ getConditionRange()

SourceRange clang::tidy::modernize::getConditionRange ( ASTContext & Context,
const TemplateSpecializationTypeLoc & EnableIf )
static

◆ getConditionText()

std::optional< std::string > clang::tidy::modernize::getConditionText ( const Expr * ConditionExpr,
SourceRange ConditionRange,
ASTContext & Context )
static

◆ getContainerExpr()

std::optional< ContainerCall > clang::tidy::modernize::getContainerExpr ( const Expr * Call)
static

◆ getContainerFromBeginEndCall()

std::pair< const Expr *, IteratorCallKind > clang::tidy::modernize::getContainerFromBeginEndCall ( const Expr * Init,
bool IsBegin,
bool * IsArrow,
bool IsReverse )
static

Determine whether Init appears to be an initializing an iterator.

If it is, returns the object whose begin() or end() method is called, and the output parameter isArrow is set to indicate whether the initialization is called via . or ->.

Definition at line 409 of file LoopConvertCheck.cpp.

References getContainerExpr().

Referenced by findContainer().

◆ getDeclRef()

const DeclRefExpr * clang::tidy::modernize::getDeclRef ( const Expr * E)

Returns the DeclRefExpr represented by E, or NULL if there isn't one.

Definition at line 196 of file LoopConvertUtils.cpp.

Referenced by exprReferencesVariable(), getReferencedVariable(), and isIndexInSubscriptExpr().

◆ getDereferenceOperand()

const Expr * clang::tidy::modernize::getDereferenceOperand ( const Expr * E)
static

If the expression is a dereference or call to operator*(), return the operand.

Otherwise, return NULL.

Definition at line 217 of file LoopConvertUtils.cpp.

Referenced by isIndexInSubscriptExpr().

◆ getForwardedArgumentList()

ArrayRef< BindArgument > clang::tidy::modernize::getForwardedArgumentList ( const LambdaProperties & P)
static

Definition at line 626 of file AvoidBindCheck.cpp.

Referenced by clang::tidy::modernize::AvoidBindCheck::check().

◆ getInitializer()

const Expr * clang::tidy::modernize::getInitializer ( const Expr * E)
static

Definition at line 181 of file UseDefaultMemberInitCheck.cpp.

Referenced by sameValue().

◆ getInnerTypeLocAs()

template<typename T>
T clang::tidy::modernize::getInnerTypeLocAs ( TypeLoc Loc)
static

◆ getLambdaProperties()

LambdaProperties clang::tidy::modernize::getLambdaProperties ( const MatchFinder::MatchResult & Result)
static

◆ getLockGuardNameRange()

SourceRange clang::tidy::modernize::getLockGuardNameRange ( const TypeSourceInfo * SourceInfo)
static

Definition at line 100 of file UseScopedLockCheck.cpp.

◆ getLockGuardRange()

SourceRange clang::tidy::modernize::getLockGuardRange ( const TypeSourceInfo * SourceInfo)
static

Definition at line 93 of file UseScopedLockCheck.cpp.

◆ getLockGuardsFromDecl()

llvm::SmallVector< const VarDecl * > clang::tidy::modernize::getLockGuardsFromDecl ( const DeclStmt * DS)
static

◆ getName() [1/2]

DeclarationName clang::tidy::modernize::getName ( const DeclRefExpr & D)
static

Definition at line 167 of file TypeTraitsCheck.cpp.

◆ getName() [2/2]

DeclarationName clang::tidy::modernize::getName ( const DependentScopeDeclRefExpr & D)
static

Definition at line 163 of file TypeTraitsCheck.cpp.

Referenced by clang::tidy::modernize::NS::appendCloseComment().

◆ getNewExprName()

std::string clang::tidy::modernize::getNewExprName ( const CXXNewExpr * NewExpr,
const SourceManager & SM,
const LangOptions & Lang )
static

Definition at line 24 of file MakeSmartPtrCheck.cpp.

◆ getRAngleFileLoc()

template<typename T>
SourceLocation clang::tidy::modernize::getRAngleFileLoc ( const SourceManager & SM,
const T & Element )
static

◆ getRawStringRef()

StringRef clang::tidy::modernize::getRawStringRef ( const SourceRange & Range,
const SourceManager & Sources,
const LangOptions & LangOpts )
static

◆ getReferencedVariable()

const ValueDecl * clang::tidy::modernize::getReferencedVariable ( const Expr * E)
static

If the given expression is actually a DeclRefExpr or a MemberExpr, find and return the underlying ValueDecl; otherwise, return NULL.

Definition at line 475 of file LoopConvertCheck.cpp.

References getDeclRef().

Referenced by clang::tidy::modernize::LoopConvertCheck::check(), and containerIsConst().

◆ getReplacementType()

std::optional< const char * > clang::tidy::modernize::getReplacementType ( StringRef Type)
static

◆ getSourceTextForExpr()

StringRef clang::tidy::modernize::getSourceTextForExpr ( const MatchFinder::MatchResult & Result,
const Expr * E )
static

◆ getStringFromRange()

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

Obtain the original source code text from a SourceRange.

Definition at line 461 of file LoopConvertCheck.cpp.

◆ getText()

StringRef clang::tidy::modernize::getText ( const Token & Tok,
const SourceManager & Sources )
static

◆ getTokenName()

StringRef clang::tidy::modernize::getTokenName ( const Token & Tok)
static

◆ getTypeRange()

SourceRange clang::tidy::modernize::getTypeRange ( ASTContext & Context,
const TemplateSpecializationTypeLoc & EnableIf )
static

◆ getTypeText()

std::optional< StringRef > clang::tidy::modernize::getTypeText ( ASTContext & Context,
const TemplateSpecializationTypeLoc & EnableIf )
static

Definition at line 251 of file UseConstraintsCheck.cpp.

References getTypeRange().

Referenced by handleReturnType().

◆ getValueOfValueInit()

StringRef clang::tidy::modernize::getValueOfValueInit ( const QualType InitType)
static

Definition at line 64 of file UseDefaultMemberInitCheck.cpp.

References getValueOfValueInit().

Referenced by getValueOfValueInit().

◆ handleReturnType()

std::vector< FixItHint > clang::tidy::modernize::handleReturnType ( const FunctionDecl * Function,
const TypeLoc & ReturnType,
const EnableIfData & EnableIf,
ASTContext & Context )
static

◆ handleTrailingTemplateType()

std::vector< FixItHint > clang::tidy::modernize::handleTrailingTemplateType ( const FunctionTemplateDecl * FunctionTemplate,
const FunctionDecl * Function,
const Decl * LastTemplateParam,
const EnableIfData & EnableIf,
ASTContext & Context )
static

◆ hasAnyNestedLocalQualifiers()

bool clang::tidy::modernize::hasAnyNestedLocalQualifiers ( QualType Type)
static

◆ hasOnlyComments()

bool clang::tidy::modernize::hasOnlyComments ( SourceLocation Loc,
const LangOptions & Options,
StringRef Text )
static

Definition at line 22 of file MacroToEnumCheck.cpp.

◆ hasRValueOverload()

bool clang::tidy::modernize::hasRValueOverload ( const CXXConstructorDecl * Ctor,
const ParmVarDecl * Param )
static

Returns true if the given constructor is part of a lvalue/rvalue reference pair, i.e.

Param is of lvalue reference type, and there exists another constructor such that:

  • it has the same number of parameters as Ctor.
  • the parameter at the same index as Param is an rvalue reference of the same pointee type
  • all other parameters have the same type as the corresponding parameter in Ctor or are rvalue references with the same pointee type. Examples: A::A(const B& Param) A::A(B&&)

A::A(const B& Param, const C&) A::A(B&& Param, C&&)

A::A(const B&, const C& Param) A::A(B&&, C&& Param)

A::A(const B&, const C& Param) A::A(const B&, C&& Param)

A::A(const B& Param, int) A::A(B&& Param, int)

Definition at line 160 of file PassByValueCheck.cpp.

References hasRValueOverload().

Referenced by clang::tidy::modernize::PassByValueCheck::check(), and hasRValueOverload().

◆ ignoreTemporariesAndConstructors()

const Expr * clang::tidy::modernize::ignoreTemporariesAndConstructors ( const Expr * E)
static

◆ ignoreTemporariesAndPointers()

const Expr * clang::tidy::modernize::ignoreTemporariesAndPointers ( const Expr * E)
static

◆ ignoreTypeLocClasses()

void clang::tidy::modernize::ignoreTypeLocClasses ( TypeLoc & Loc,
const std::initializer_list< TypeLoc::TypeLocClass > & LocClasses )
static

Definition at line 335 of file UseAutoCheck.cpp.

Referenced by isMultiLevelPointerToTypeLocClasses().

◆ ignoreUnaryPlus()

const Expr * clang::tidy::modernize::ignoreUnaryPlus ( const Expr * E)
static

Definition at line 174 of file UseDefaultMemberInitCheck.cpp.

Referenced by sameValue().

◆ incrementVarMatcher()

StatementMatcher clang::tidy::modernize::incrementVarMatcher ( )
static

Definition at line 90 of file LoopConvertCheck.cpp.

References InitVarName.

Referenced by makeArrayLoopMatcher(), and makePseudoArrayLoopMatcher().

◆ initializeBindArgumentForCallExpr()

void clang::tidy::modernize::initializeBindArgumentForCallExpr ( const MatchFinder::MatchResult & Result,
BindArgument & B,
const CallExpr * CE,
unsigned & CaptureIndex )
static

◆ initToZeroMatcher()

DeclarationMatcher clang::tidy::modernize::initToZeroMatcher ( )
static

Definition at line 84 of file LoopConvertCheck.cpp.

References InitVarName.

Referenced by makeArrayLoopMatcher(), and makePseudoArrayLoopMatcher().

◆ intCastExpression()

BindableMatcher< clang::Stmt > clang::tidy::modernize::intCastExpression ( bool IsSigned,
const std::string & CastBindName = std::string() )
static

◆ integerComparisonMatcher()

StatementMatcher clang::tidy::modernize::integerComparisonMatcher ( )
static

Definition at line 79 of file LoopConvertCheck.cpp.

References InitVarName.

Referenced by arrayConditionMatcher().

◆ isActualCharType()

bool clang::tidy::modernize::isActualCharType ( const clang::QualType & Ty)
static

Find if the passed type is the actual "char" type, not applicable to explicit "signed char" or "unsigned char" types.

Definition at line 21 of file UseIntegerSignComparisonCheck.cpp.

◆ isAliasDecl()

bool clang::tidy::modernize::isAliasDecl ( ASTContext * Context,
const Decl * TheDecl,
const VarDecl * IndexVar )
static

Determines whether the given Decl defines a variable initialized to the loop object.

This is intended to find cases such as

for (int i = 0; i < arraySize(arr); ++i) {
T t = arr[i];
// use t, do not use i
}

and

for (iterator i = container.begin(), e = container.end(); i != e; ++i) {
T t = *i;
// use t, do not use i
}

Definition at line 347 of file LoopConvertUtils.cpp.

References digThroughConstructorsConversions(), isDereferenceOfOpCall(), isDereferenceOfUop(), and isIndexInSubscriptExpr().

◆ isCallExprNamed()

bool clang::tidy::modernize::isCallExprNamed ( const Expr * E,
StringRef Name )
static

Definition at line 143 of file AvoidBindCheck.cpp.

Referenced by initializeBindArgumentForCallExpr(), and isFixitSupported().

◆ isCopyAssignmentAndCanBeDefaulted()

bool clang::tidy::modernize::isCopyAssignmentAndCanBeDefaulted ( ASTContext * Context,
const CXXMethodDecl * Operator )
static

Checks that the given method is an overloading of the assignment operator, has copy signature, returns a reference to "*this" and copies all its members and subobjects.

Definition at line 124 of file UseEqualsDefaultCheck.cpp.

References accessToFieldInVar(), empty(), getAllDirectBases(), and getAllNamedFields().

Referenced by clang::tidy::modernize::UseEqualsDefaultCheck::check().

◆ isCopyConstructorAndCanBeDefaulted()

bool clang::tidy::modernize::isCopyConstructorAndCanBeDefaulted ( ASTContext * Context,
const CXXConstructorDecl * Ctor )
static

Check that the given constructor has copy signature and that it copy-initializes all its bases and members.

Definition at line 60 of file UseEqualsDefaultCheck.cpp.

References accessToFieldInVar(), empty(), getAllDirectBases(), and getAllNamedFields().

Referenced by clang::tidy::modernize::UseEqualsDefaultCheck::check().

◆ isCvr()

bool clang::tidy::modernize::isCvr ( Token T)
static

Definition at line 201 of file UseTrailingReturnTypeCheck.cpp.

Referenced by classifyToken().

◆ isDereferenceOfOpCall()

bool clang::tidy::modernize::isDereferenceOfOpCall ( const CXXOperatorCallExpr * OpCall,
const VarDecl * IndexVar )
static

Returns true when Opcall is a call a one-parameter dereference of IndexVar.

For example, if the index variable is index, returns true for *index but not index *notIndex

Definition at line 311 of file LoopConvertUtils.cpp.

References exprReferencesVariable().

Referenced by isAliasDecl().

◆ isDereferenceOfUop()

bool clang::tidy::modernize::isDereferenceOfUop ( const UnaryOperator * Uop,
const VarDecl * IndexVar )
static

Returns true when Uop is a dereference of IndexVar.

For example, if the index variable is index, returns true for *index but not index *notIndex

Definition at line 324 of file LoopConvertUtils.cpp.

References exprReferencesVariable().

Referenced by isAliasDecl().

◆ isDirectMemberExpr()

bool clang::tidy::modernize::isDirectMemberExpr ( const Expr * E)
static

Returns true when the given expression is a member expression whose base is this (implicitly or not).

Definition at line 485 of file LoopConvertCheck.cpp.

Referenced by clang::tidy::modernize::LoopConvertCheck::check().

◆ isExprAllowedInMemberInit()

bool clang::tidy::modernize::isExprAllowedInMemberInit ( const Expr * E)
static

Definition at line 21 of file UseDefaultMemberInitCheck.cpp.

References isExprAllowedInMemberInit().

Referenced by isExprAllowedInMemberInit().

◆ isFirstFriendOfSecond()

bool clang::tidy::modernize::isFirstFriendOfSecond ( const CXXRecordDecl * Friend,
const CXXRecordDecl * Class )
static

Definition at line 23 of file PassByValueCheck.cpp.

◆ isFixitSupported()

bool clang::tidy::modernize::isFixitSupported ( const CallableInfo & Callee,
ArrayRef< BindArgument > Args )
static

Definition at line 426 of file AvoidBindCheck.cpp.

References isCallExprNamed(), and isPlaceHolderIndexRepeated().

Referenced by getLambdaProperties().

◆ isIndexInSubscriptExpr() [1/2]

bool clang::tidy::modernize::isIndexInSubscriptExpr ( ASTContext * Context,
const Expr * IndexExpr,
const VarDecl * IndexVar,
const Expr * Obj,
const Expr * SourceExpr,
bool PermitDeref )
static

Returns true when the index expression is a declaration reference to IndexVar, Obj is the same expression as SourceExpr after all parens and implicit casts are stripped off.

If PermitDeref is true, IndexExpression may be a dereference (overloaded or builtin operator*).

This function is intended for array-like containers, as it makes sure that both the container and the index match. If the loop has index variable index and iterates over container, then isIndexInSubscriptExpr returns true for

container[index]
container.at(index)
container->at(index)

but not for

container[notIndex]
notContainer[index]

If PermitDeref is true, then isIndexInSubscriptExpr additionally returns true on these expressions:

(*container)[index]
(*container).at(index)

Definition at line 285 of file LoopConvertUtils.cpp.

References areSameExpr(), getDereferenceOperand(), and isIndexInSubscriptExpr().

◆ isIndexInSubscriptExpr() [2/2]

bool clang::tidy::modernize::isIndexInSubscriptExpr ( const Expr * IndexExpr,
const VarDecl * IndexVar )
static

Returns true when the index expression is a declaration reference to IndexVar.

If the index variable is index, this function returns true on arrayExpression[index]; containerExpression[index]; but not containerExpression[notIndex];

Definition at line 251 of file LoopConvertUtils.cpp.

References areSameVariable(), and getDeclRef().

Referenced by isAliasDecl(), and isIndexInSubscriptExpr().

◆ isIntegralConstant()

bool clang::tidy::modernize::isIntegralConstant ( const Token & Token)
static

Definition at line 20 of file IntegralLiteralExpressionMatcher.cpp.

◆ isLockGuard()

bool clang::tidy::modernize::isLockGuard ( const QualType & Type)
static

Definition at line 30 of file UseScopedLockCheck.cpp.

References isLockGuardDecl().

Referenced by getLockGuardsFromDecl().

◆ isLockGuardDecl()

bool clang::tidy::modernize::isLockGuardDecl ( const NamedDecl * Decl)
static

Definition at line 25 of file UseScopedLockCheck.cpp.

Referenced by isLockGuard().

◆ isMacroIdentifier()

bool clang::tidy::modernize::isMacroIdentifier ( const IdentifierTable & Idents,
const Token & ProtoToken )
static

Definition at line 115 of file RedundantVoidArgCheck.cpp.

◆ isMultiLevelPointerToTypeLocClasses()

bool clang::tidy::modernize::isMultiLevelPointerToTypeLocClasses ( TypeLoc Loc,
const std::initializer_list< TypeLoc::TypeLocClass > & LocClasses )
static

Definition at line 342 of file UseAutoCheck.cpp.

References ignoreTypeLocClasses().

◆ isNamedDeclInStdTraitsSet()

bool clang::tidy::modernize::isNamedDeclInStdTraitsSet ( const NamedDecl * ND,
const llvm::StringSet<> & Set )
static

◆ isNegativeComparison()

bool clang::tidy::modernize::isNegativeComparison ( const Expr * ComparisonExpr)
static

◆ isPlaceHolderIndexRepeated()

bool clang::tidy::modernize::isPlaceHolderIndexRepeated ( const ArrayRef< BindArgument > Args)
static

Definition at line 379 of file AvoidBindCheck.cpp.

Referenced by isFixitSupported().

◆ isPrimaryExpression()

bool clang::tidy::modernize::isPrimaryExpression ( const Expr * Expression)
static

Definition at line 296 of file UseConstraintsCheck.cpp.

Referenced by getConditionText().

◆ isRawStringLiteral()

bool clang::tidy::modernize::isRawStringLiteral ( StringRef Text)
static

Definition at line 36 of file RawStringLiteralCheck.cpp.

Referenced by containsEscapedCharacters().

◆ isSpecifier()

bool clang::tidy::modernize::isSpecifier ( Token T)
static

Definition at line 205 of file UseTrailingReturnTypeCheck.cpp.

Referenced by classifyToken().

◆ isValid()

bool clang::tidy::modernize::isValid ( SourceRange Range)
static

◆ isZero()

bool clang::tidy::modernize::isZero ( const Expr * E)
static

Definition at line 152 of file UseDefaultMemberInitCheck.cpp.

Referenced by sameValue().

◆ keepSpecifiers()

void clang::tidy::modernize::keepSpecifiers ( std::string & ReturnType,
std::string & Auto,
SourceRange ReturnTypeCVRange,
const FunctionDecl & F,
const FriendDecl * Fr,
const ASTContext & Ctx,
const SourceManager & SM,
const LangOptions & LangOpts,
Preprocessor * PP )
static

◆ len()

template<size_t N>
size_t clang::tidy::modernize::len ( const char(&)[N])
static

◆ literalTokenSize()

LiteralSize clang::tidy::modernize::literalTokenSize ( const Token & Tok)
static

◆ locationsInSameFile()

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

◆ makeArrayLoopMatcher()

StatementMatcher clang::tidy::modernize::makeArrayLoopMatcher ( )
static

The matcher for loops over arrays.

for (int i = 0; i < 3 + 2; ++i) { ... }

The following string identifiers are bound to these parts of the AST: ConditionBoundName: '3 + 2' (as an Expr) InitVarName: 'i' (as a VarDecl) LoopName: The entire for loop (as a ForStmt)

Client code will need to make sure that:

  • The index variable is only used as an array index.
  • All arrays indexed by the loop are the same.

Definition at line 117 of file LoopConvertCheck.cpp.

References arrayConditionMatcher(), ConditionBoundName, incrementVarMatcher(), initToZeroMatcher(), and LoopNameArray.

Referenced by clang::tidy::modernize::LoopConvertCheck::registerMatchers().

◆ makeIteratorLoopMatcher()

StatementMatcher clang::tidy::modernize::makeIteratorLoopMatcher ( bool IsReverse)
static

The matcher used for iterator-based for loops.

This matcher is more flexible than array-based loops. It will match catch loops of the following textual forms (regardless of whether the iterator type is actually a pointer type or a class type):

for (containerType::iterator it = container.begin(),
e = createIterator(); it != e; ++it) { ... }
for (containerType::iterator it = container.begin();
it != anotherContainer.end(); ++it) { ... }
for (containerType::iterator it = begin(container),
e = end(container); it != e; ++it) { ... }
for (containerType::iterator it = std::begin(container),
e = std::end(container); it != e; ++it) { ... }

The following string identifiers are bound to the parts of the AST: InitVarName: 'it' (as a VarDecl) LoopName: The entire for loop (as a ForStmt) In the first example only: EndVarName: 'e' (as a VarDecl) In the second example only: EndCallName: 'container.end()' (as a CXXMemberCallExpr) In the third/fourth examples: 'end(container)' or 'std::end(container)' (as a CallExpr)

Client code will need to make sure that:

  • The two containers on which 'begin' and 'end' are called are the same.

Definition at line 158 of file LoopConvertCheck.cpp.

References BeginCallName, DerefByRefResultName, DerefByValueResultName, EndCallName, EndVarName, InitVarName, LoopNameIterator, and LoopNameReverseIterator.

Referenced by clang::tidy::modernize::LoopConvertCheck::registerMatchers().

◆ makePseudoArrayLoopMatcher()

StatementMatcher clang::tidy::modernize::makePseudoArrayLoopMatcher ( )
static

The matcher used for array-like containers (pseudoarrays).

This matcher is more flexible than array-based loops. It will match loops of the following textual forms (regardless of whether the iterator type is actually a pointer type or a class type):

for (int i = 0, j = container.size(); i < j; ++i) { ... }
for (int i = 0; i < container.size(); ++i) { ... }
for (int i = 0; i < size(container); ++i) { ... }

The following string identifiers are bound to the parts of the AST: InitVarName: 'i' (as a VarDecl) LoopName: The entire for loop (as a ForStmt) In the first example only: EndVarName: 'j' (as a VarDecl) In the second example only: EndCallName: 'container.size()' (as a CXXMemberCallExpr) or 'size(container)' (as a CallExpr)

Client code will need to make sure that:

  • The containers on which 'size()' is called is the container indexed.
  • The index variable is only used in overloaded operator[] or container.at().
  • The container's iterators would not be invalidated during the loop.

Definition at line 270 of file LoopConvertCheck.cpp.

References arrayConditionMatcher(), EndCallName, EndVarName, incrementVarMatcher(), initToZeroMatcher(), and LoopNamePseudoArray.

Referenced by clang::tidy::modernize::LoopConvertCheck::registerMatchers().

◆ matchEnableIfSpecialization()

std::optional< EnableIfData > clang::tidy::modernize::matchEnableIfSpecialization ( TypeLoc TheType)
static

◆ matchEnableIfSpecializationImpl()

std::optional< TemplateSpecializationTypeLoc > clang::tidy::modernize::matchEnableIfSpecializationImpl ( TypeLoc TheType)
static

◆ matchEnableIfSpecializationImplTrait()

std::optional< TemplateSpecializationTypeLoc > clang::tidy::modernize::matchEnableIfSpecializationImplTrait ( TypeLoc TheType)
static

Definition at line 101 of file UseConstraintsCheck.cpp.

Referenced by matchEnableIfSpecializationImpl().

◆ matchEnableIfSpecializationImplTypename()

std::optional< TemplateSpecializationTypeLoc > clang::tidy::modernize::matchEnableIfSpecializationImplTypename ( TypeLoc TheType)
static

Definition at line 55 of file UseConstraintsCheck.cpp.

Referenced by matchEnableIfSpecializationImpl().

◆ matchTrailingTemplateParam()

std::pair< std::optional< EnableIfData >, const Decl * > clang::tidy::modernize::matchTrailingTemplateParam ( const FunctionTemplateDecl * FunctionTemplate)
static

◆ nonConstValueType()

TypeMatcher clang::tidy::modernize::nonConstValueType ( )
static

◆ notTemplateSpecConstRefType()

TypeMatcher clang::tidy::modernize::notTemplateSpecConstRefType ( )
static

◆ operator<()

bool clang::tidy::modernize::operator< ( LiteralSize LHS,
LiteralSize RHS )
static

Definition at line 137 of file IntegralLiteralExpressionMatcher.cpp.

◆ paramReferredExactlyOnce()

bool clang::tidy::modernize::paramReferredExactlyOnce ( const CXXConstructorDecl * Ctor,
const ParmVarDecl * ParamDecl )
static

Whether or not ParamDecl is used exactly one time in Ctor.

Checks both in the init-list and the body of the constructor.

clang::RecursiveASTVisitor that checks that the given ParmVarDecl is used exactly one time.

See also
ExactlyOneUsageVisitor::hasExactlyOneUsageIn()

Whether or not the parameter variable is referred only once in the given constructor.

Counts the number of references to a variable.

Stops the AST traversal if more than one usage is found.

Definition at line 90 of file PassByValueCheck.cpp.

References paramReferredExactlyOnce().

Referenced by clang::tidy::modernize::PassByValueCheck::check(), and paramReferredExactlyOnce().

◆ parseOpCode()

StringRef clang::tidy::modernize::parseOpCode ( BinaryOperator::Opcode Code)
static

◆ parseTokens()

SmallVector< Token, 16 > clang::tidy::modernize::parseTokens ( CharSourceRange Range,
const MatchFinder::MatchResult & Result )
static

◆ sameValue()

bool clang::tidy::modernize::sameValue ( const Expr * E1,
const Expr * E2 )
static

Definition at line 188 of file UseDefaultMemberInitCheck.cpp.

References getInitializer(), ignoreUnaryPlus(), isZero(), and sameValue().

Referenced by sameValue().

◆ textEquals()

template<size_t N>
bool clang::tidy::modernize::textEquals ( const char(&) Needle[N],
const char * HayStack )
static

◆ tryCaptureAsLocalVariable()

bool clang::tidy::modernize::tryCaptureAsLocalVariable ( const MatchFinder::MatchResult & Result,
BindArgument & B,
const Expr * E )
static

◆ tryCaptureAsMemberVariable()

bool clang::tidy::modernize::tryCaptureAsMemberVariable ( const MatchFinder::MatchResult & Result,
BindArgument & B,
const Expr * E )
static

◆ unusedReturnValue()

clang::ast_matchers::StatementMatcher clang::tidy::modernize::unusedReturnValue ( clang::ast_matchers::StatementMatcher MatchedCallExpr)
static

◆ usagesAreConst()

bool clang::tidy::modernize::usagesAreConst ( ASTContext * Context,
const UsageResult & Usages )
static

Returns true when it can be guaranteed that the elements of the container are not being modified.

Definition at line 513 of file LoopConvertCheck.cpp.

References canBeModified(), clang::tidy::modernize::Usage::UK_CaptureByCopy, and clang::tidy::modernize::Usage::UK_CaptureByRef.

◆ usagesReturnRValues()

bool clang::tidy::modernize::usagesReturnRValues ( const UsageResult & Usages)
static

Returns true if the elements of the container are never accessed by reference.

Definition at line 529 of file LoopConvertCheck.cpp.

◆ X()

ClangTidyModuleRegistry::Add< ModernizeModule > clang::tidy::modernize::X ( "modernize-module" ,
"Add modernize checks."  )
static

Variable Documentation

◆ ADLNames

const llvm::StringSet clang::tidy::modernize::ADLNames
static
Initial value:
{"begin", "cbegin", "rbegin",
"crbegin", "end", "cend",
"rend", "crend", "size"}

Definition at line 72 of file LoopConvertCheck.cpp.

Referenced by getContainerExpr().

◆ BeginCallName

const char clang::tidy::modernize::BeginCallName[] = "beginCall"
static

Definition at line 64 of file LoopConvertCheck.cpp.

Referenced by makeIteratorLoopMatcher().

◆ Bind

char clang::tidy::modernize::Bind[] = ""
staticconstexpr

◆ ConditionBoundName

const char clang::tidy::modernize::ConditionBoundName[] = "conditionBound"
static

◆ ConstructorCall

char clang::tidy::modernize::ConstructorCall[] = "constructorCall"
staticconstexpr

◆ DeclStmtName

llvm::StringLiteral clang::tidy::modernize::DeclStmtName = "decl-stmt"
staticconstexpr

◆ DeletedNotPublic

const char clang::tidy::modernize::DeletedNotPublic[] = "DeletedNotPublic"
static

◆ DeprecatedTypes

std::array<StringRef, 5> clang::tidy::modernize::DeprecatedTypes
staticconstexpr
Initial value:
= {
"::std::ios_base::io_state", "::std::ios_base::open_mode",
"::std::ios_base::seek_dir", "::std::ios_base::streamoff",
"::std::ios_base::streampos"}

Definition at line 17 of file DeprecatedIosBaseAliasesCheck.cpp.

Referenced by clang::tidy::modernize::DeprecatedIosBaseAliasesCheck::registerMatchers().

◆ DerefByRefResultName

const char clang::tidy::modernize::DerefByRefResultName[] = "derefByRefResult"
static

Definition at line 68 of file LoopConvertCheck.cpp.

Referenced by makeIteratorLoopMatcher().

◆ DerefByValueResultName

const char clang::tidy::modernize::DerefByValueResultName[] = "derefByValueResult"
static

Definition at line 67 of file LoopConvertCheck.cpp.

Referenced by makeIteratorLoopMatcher().

◆ DirectVar

char clang::tidy::modernize::DirectVar[] = "directVar"
staticconstexpr

◆ EndCallName

const char clang::tidy::modernize::EndCallName[] = "endCall"
static

◆ EndVarName

const char clang::tidy::modernize::EndVarName[] = "endVar"
static

◆ ErrorMessageOnFunction

llvm::StringLiteral clang::tidy::modernize::ErrorMessageOnFunction
constexpr
Initial value:
=
"use a trailing return type for this function"

Definition at line 144 of file UseTrailingReturnTypeCheck.cpp.

Referenced by clang::tidy::modernize::UseTrailingReturnTypeCheck::check().

◆ ErrorMessageOnLambda

llvm::StringLiteral clang::tidy::modernize::ErrorMessageOnLambda
constexpr
Initial value:
=
"use a trailing return type for this lambda"

Definition at line 146 of file UseTrailingReturnTypeCheck.cpp.

◆ ExternCDeclName

llvm::StringLiteral clang::tidy::modernize::ExternCDeclName = "extern-c-decl"
staticconstexpr

◆ IgnoreMacrosDefault

bool clang::tidy::modernize::IgnoreMacrosDefault = true
staticconstexpr

◆ IgnoreMacrosName

char clang::tidy::modernize::IgnoreMacrosName[] = "IgnoreMacros"
staticconstexpr

◆ IgnoreSingleElementAggregatesDefault

bool clang::tidy::modernize::IgnoreSingleElementAggregatesDefault = true
staticconstexpr

◆ IgnoreSingleElementAggregatesName

char clang::tidy::modernize::IgnoreSingleElementAggregatesName[]
staticconstexpr

◆ InitVarName

const char clang::tidy::modernize::InitVarName[] = "initVar"
static

◆ LoopNameArray

const char clang::tidy::modernize::LoopNameArray[] = "forLoopArray"
static

◆ LoopNameIterator

const char clang::tidy::modernize::LoopNameIterator[] = "forLoopIterator"
static

◆ LoopNamePseudoArray

const char clang::tidy::modernize::LoopNamePseudoArray[] = "forLoopPseudoArray"
static

◆ LoopNameReverseIterator

const char clang::tidy::modernize::LoopNameReverseIterator[] = "forLoopReverseIterator"
static

◆ MemberNames

const llvm::StringSet clang::tidy::modernize::MemberNames
static
Initial value:
{"begin", "cbegin", "rbegin",
"crbegin", "end", "cend",
"rend", "crend", "size"}

Definition at line 69 of file LoopConvertCheck.cpp.

Referenced by getContainerExpr().

◆ Message

const StringRef clang::tidy::modernize::Message = "prefer transparent functors '%0<>'"
static

◆ NewExpression

char clang::tidy::modernize::NewExpression[] = "newExpression"
staticconstexpr

◆ ParentDeclName

llvm::StringLiteral clang::tidy::modernize::ParentDeclName = "parent-decl"
staticconstexpr

◆ ResetCall

char clang::tidy::modernize::ResetCall[] = "resetCall"
staticconstexpr

◆ RestrictToPODTypesDefault

bool clang::tidy::modernize::RestrictToPODTypesDefault = false
staticconstexpr

◆ RestrictToPODTypesName

char clang::tidy::modernize::RestrictToPODTypesName[] = "RestrictToPODTypes"
staticconstexpr

◆ SinglePivotRangeNames

const char* clang::tidy::modernize::SinglePivotRangeNames[]
staticconstexpr
Initial value:
= {"rotate", "rotate_copy",
"inplace_merge"}

Definition at line 99 of file modernize/UseRangesCheck.cpp.

Referenced by clang::tidy::modernize::UseRangesCheck::getReplacerMap().

◆ SingleRangeNames

const char* clang::tidy::modernize::SingleRangeNames[]
staticconstexpr

◆ SpecialFunction [1/2]

◆ SpecialFunction [2/2]

const char clang::tidy::modernize::SpecialFunction[] = "SpecialFunction"
static

Definition at line 44 of file UseEqualsDeleteCheck.cpp.

◆ StdNames

const llvm::StringSet clang::tidy::modernize::StdNames
static
Initial value:
{
"std::begin", "std::cbegin", "std::rbegin", "std::crbegin", "std::end",
"std::cend", "std::rend", "std::crend", "std::size"}

Definition at line 75 of file LoopConvertCheck.cpp.

Referenced by getContainerExpr().

◆ StrictCppStandardComplianceDefault

bool clang::tidy::modernize::StrictCppStandardComplianceDefault = true
staticconstexpr

◆ StrictCppStandardComplianceName

char clang::tidy::modernize::StrictCppStandardComplianceName[]
staticconstexpr

◆ StrictCStandardComplianceDefault

bool clang::tidy::modernize::StrictCStandardComplianceDefault = true
staticconstexpr

◆ StrictCStandardComplianceName

char clang::tidy::modernize::StrictCStandardComplianceName[]
staticconstexpr

◆ TagDeclName

llvm::StringLiteral clang::tidy::modernize::TagDeclName = "tag-decl"
staticconstexpr

◆ TwoRangeNames

const char* clang::tidy::modernize::TwoRangeNames[]
staticconstexpr
Initial value:
= {
"equal",
"mismatch",
"partial_sort_copy",
"includes",
"set_union",
"set_intersection",
"set_difference",
"set_symmetric_difference",
"merge",
"lexicographical_compare",
"find_end",
"search",
"is_permutation",
}

Definition at line 83 of file modernize/UseRangesCheck.cpp.

Referenced by clang::tidy::modernize::UseRangesCheck::getReplacerMap().

◆ TypedefName

llvm::StringLiteral clang::tidy::modernize::TypedefName = "typedef"
staticconstexpr

◆ TypeTraits

const llvm::StringSet clang::tidy::modernize::TypeTraits
static

Definition at line 127 of file TypeTraitsCheck.cpp.

Referenced by clang::tidy::modernize::TypeTraitsCheck::check().

◆ UseScopedLockMessage

const StringRef clang::tidy::modernize::UseScopedLockMessage
static
Initial value:
=
"use 'std::scoped_lock' instead of 'std::lock_guard'"

Definition at line 110 of file UseScopedLockCheck.cpp.

◆ ValueTraits

const llvm::StringSet clang::tidy::modernize::ValueTraits
static

Definition at line 21 of file TypeTraitsCheck.cpp.

Referenced by clang::tidy::modernize::TypeTraitsCheck::check().