clang-tools
10.0.0git
|
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... | |
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... | |
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... | |
class | ForLoopIndexUseVisitor |
Discover usages of expressions consisting of index or iterator access. More... | |
class | LoopConvertCheck |
class | MakeSharedCheck |
Replace the pattern: More... | |
class | MakeSmartPtrCheck |
Base class for MakeSharedCheck and MakeUniqueCheck. More... | |
class | MakeUniqueCheck |
Replace the pattern: More... | |
class | ModernizeModule |
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 | 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 | 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 | UseDefaultMemberInitCheck |
Convert a default constructor's member initializers into default member initializers. 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 |
Mark unimplemented private special member functions with '= delete'. 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 | 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 | |
typedef llvm::DenseMap< const clang::Stmt *, const clang::Stmt * > | StmtParentMap |
A map used to walk the AST in reverse: maps child Stmt to parent Stmt. More... | |
typedef llvm::DenseMap< const clang::VarDecl *, const clang::DeclStmt * > | DeclParentMap |
A map used to walk the AST in reverse: maps VarDecl to the to parent DeclStmt. More... | |
typedef llvm::DenseMap< const clang::ForStmt *, const clang::VarDecl * > | ReplacedVarsMap |
A map used to track which variables have been removed by a refactoring pass. More... | |
typedef llvm::DenseMap< const clang::Stmt *, std::string > | StmtGeneratedVarNameMap |
A map used to remember the variable names generated in a Stmt. More... | |
typedef llvm::SmallVector< const clang::Expr *, 16 > | ComponentVector |
A vector used to store the AST subtrees of an Expr. More... | |
typedef llvm::SmallVector< Usage, 8 > | UsageResult |
using | CharsBitSet = std::bitset< 1<< CHAR_BIT > |
Enumerations | |
enum | LoopFixerKind { LFK_Array, LFK_Iterator, LFK_PseudoArray } |
Functions | |
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 bool | tryCaptureAsLocalVariable (const MatchFinder::MatchResult &Result, BindArgument &B, const Expr *E) |
static bool | tryCaptureAsMemberVariable (const MatchFinder::MatchResult &Result, BindArgument &B, const Expr *E) |
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 CXXMethodDecl * > | findCandidateCallOperators (const CXXRecordDecl *RecordDecl, size_t NumArgs) |
static bool | isFixitSupported (const CallableInfo &Callee, ArrayRef< BindArgument > Args) |
const FunctionDecl * | getCallOperator (const CXXRecordDecl *Callable, size_t NumArgs) |
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, 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 bool | anonymousOrInlineNamespace (const NamespaceDecl &ND) |
static bool | singleNamedNamespaceChild (const NamespaceDecl &ND) |
static bool | alreadyConcatenated (std::size_t NumCandidates, const SourceRange &ReplacementRange, const SourceManager &Sources, const LangOptions &LangOpts) |
static const TypeMatcher | AnyType () |
static const StatementMatcher | IntegerComparisonMatcher () |
static const DeclarationMatcher | InitToZeroMatcher () |
static const StatementMatcher | IncrementVarMatcher () |
StatementMatcher | makeArrayLoopMatcher () |
The matcher for loops over arrays. More... | |
StatementMatcher | makeIteratorLoopMatcher () |
The matcher used for iterator-based for loops. More... | |
StatementMatcher | makePseudoArrayLoopMatcher () |
The matcher used for array-like containers (pseudoarrays). More... | |
static const Expr * | getContainerFromBeginEndCall (const Expr *Init, bool IsBegin, bool *IsArrow) |
Determine whether Init appears to be an initializing an iterator. More... | |
static const Expr * | findContainer (ASTContext *Context, const Expr *BeginExpr, const Expr *EndExpr, bool *ContainerNeedsDereference) |
Determines the container whose begin() and end() functions are called for an iterator-based loop. More... | |
static StringRef | getStringFromRange (SourceManager &SourceMgr, const LangOptions &LangOpts, SourceRange Range) |
Obtain the original source code text from a SourceRange. More... | |
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. More... | |
static bool | isDirectMemberExpr (const Expr *E) |
Returns true when the given expression is a member expression whose base is this (implicitly or not). More... | |
static bool | canBeModified (ASTContext *Context, const Expr *E) |
Given an expression that represents an usage of an element from the containter that we are iterating over, returns false when it can be guaranteed this element cannot be modified as a result of this usage. More... | |
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. More... | |
static bool | usagesReturnRValues (const UsageResult &Usages) |
Returns true if the elements of the container are never accessed by reference. More... | |
static bool | containerIsConst (const Expr *ContainerExpr, bool Dereference) |
Returns true if the container is const-qualified. More... | |
const Expr * | digThroughConstructors (const Expr *E) |
Look through conversion/copy constructors to find the explicit initialization expression, returning it is found. More... | |
bool | areSameExpr (ASTContext *Context, const Expr *First, const Expr *Second) |
Returns true when two Exprs are equivalent. More... | |
const DeclRefExpr * | getDeclRef (const Expr *E) |
Returns the DeclRefExpr represented by E, or NULL if there isn't one. More... | |
bool | areSameVariable (const ValueDecl *First, const ValueDecl *Second) |
Returns true when two ValueDecls are the same variable. More... | |
static bool | exprReferencesVariable (const ValueDecl *Target, const Expr *E) |
Determines if an expression is a declaration reference to a particular variable. More... | |
static const Expr * | getDereferenceOperand (const Expr *E) |
If the expression is a dereference or call to operator*(), return the operand. More... | |
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. More... | |
static bool | isIndexInSubscriptExpr (const Expr *IndexExpr, const VarDecl *IndexVar) |
Returns true when the index expression is a declaration reference to IndexVar. More... | |
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. More... | |
static bool | isDereferenceOfOpCall (const CXXOperatorCallExpr *OpCall, const VarDecl *IndexVar) |
Returns true when Opcall is a call a one-parameter dereference of IndexVar. More... | |
static bool | isDereferenceOfUop (const UnaryOperator *Uop, const VarDecl *IndexVar) |
Returns true when Uop is a dereference of IndexVar. More... | |
static bool | isAliasDecl (ASTContext *Context, const Decl *TheDecl, const VarDecl *IndexVar) |
Determines whether the given Decl defines a variable initialized to the loop object. More... | |
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. More... | |
static ClangTidyModuleRegistry::Add< ModernizeModule > | X ("modernize-module", "Add modernize checks.") |
static TypeMatcher | constRefType () |
static TypeMatcher | nonConstValueType () |
static bool | paramReferredExactlyOnce (const CXXConstructorDecl *Ctor, const ParmVarDecl *ParamDecl) |
Whether or not ParamDecl is used exactly one time in Ctor . More... | |
static SmallVector< const ParmVarDecl *, 2 > | collectParamDecls (const CXXConstructorDecl *Ctor, const ParmVarDecl *ParamDecl) |
Find all references to ParamDecl across all of the redeclarations of Ctor . More... | |
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 . More... | |
static std::set< const Type * > | getAllDirectBases (const CXXRecordDecl *Record) |
Returns the names of the direct bases of Record , both virtual and non-virtual. More... | |
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 . More... | |
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. More... | |
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. More... | |
static bool | bodyEmpty (const ASTContext *Context, const CompoundStmt *Body) |
Returns false if the body has any non-whitespace character. More... | |
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 SourceLocation | expandIfMacroId (SourceLocation Loc, const SourceManager &SM) |
static bool | IsCVR (Token T) |
static bool | IsSpecifier (Token T) |
static llvm::Optional< ClassifiedToken > | classifyToken (const FunctionDecl &F, Preprocessor &PP, Token Tok) |
static bool | hasAnyNestedLocalQualifiers (QualType Type) |
template<typename T > | |
static T | getInnerTypeLocAs (TypeLoc Loc) |
Variables | |
static const llvm::SmallVector< StringRef, 5 > | DeprecatedTypes |
static const llvm::StringMap< StringRef > | ReplacementTypes |
static const char | LoopNameArray [] = "forLoopArray" |
static const char | LoopNameIterator [] = "forLoopIterator" |
static const char | LoopNamePseudoArray [] = "forLoopPseudoArray" |
static const char | ConditionBoundName [] = "conditionBound" |
static const char | ConditionVarName [] = "conditionVar" |
static const char | IncrementVarName [] = "incrementVar" |
static const char | InitVarName [] = "initVar" |
static const char | BeginCallName [] = "beginCall" |
static const char | EndCallName [] = "endCall" |
static const char | ConditionEndVarName [] = "conditionEndVar" |
static const char | EndVarName [] = "endVar" |
static const char | DerefByValueResultName [] = "derefByValueResult" |
static const char | DerefByRefResultName [] = "derefByRefResult" |
static const char | SpecialFunction [] = "SpecialFunction" |
static const char | SpecialFunction [] = "SpecialFunction" |
static const char | DeletedNotPublic [] = "DeletedNotPublic" |
constexpr llvm::StringLiteral | Message |
using clang::tidy::modernize::CharsBitSet = typedef std::bitset<1 << CHAR_BIT> |
Definition at line 19 of file RawStringLiteralCheck.h.
typedef llvm::SmallVector<const clang::Expr *, 16> clang::tidy::modernize::ComponentVector |
A vector used to store the AST subtrees of an Expr.
Definition at line 49 of file LoopConvertUtils.h.
typedef llvm::DenseMap<const clang::VarDecl *, const clang::DeclStmt *> clang::tidy::modernize::DeclParentMap |
A map used to walk the AST in reverse: maps VarDecl to the to parent DeclStmt.
Definition at line 37 of file LoopConvertUtils.h.
typedef llvm::DenseMap<const clang::ForStmt *, const clang::VarDecl *> clang::tidy::modernize::ReplacedVarsMap |
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 42 of file LoopConvertUtils.h.
typedef llvm::DenseMap<const clang::Stmt *, std::string> clang::tidy::modernize::StmtGeneratedVarNameMap |
A map used to remember the variable names generated in a Stmt.
Definition at line 46 of file LoopConvertUtils.h.
typedef llvm::DenseMap<const clang::Stmt *, const clang::Stmt *> clang::tidy::modernize::StmtParentMap |
A map used to walk the AST in reverse: maps child Stmt to parent Stmt.
Definition at line 32 of file LoopConvertUtils.h.
typedef llvm::SmallVector<Usage, 8> clang::tidy::modernize::UsageResult |
Definition at line 270 of file LoopConvertUtils.h.
Enumerator | |
---|---|
LFK_Array | |
LFK_Iterator | |
LFK_PseudoArray |
Definition at line 29 of file LoopConvertUtils.h.
internal::Matcher<Expr> clang::tidy::modernize::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
.
Definition at line 51 of file UseEqualsDefaultCheck.cpp.
|
static |
Definition at line 330 of file AvoidBindCheck.cpp.
|
static |
Definition at line 296 of file AvoidBindCheck.cpp.
|
static |
Definition at line 38 of file ConcatNestedNamespacesCheck.cpp.
|
static |
Definition at line 25 of file ConcatNestedNamespacesCheck.cpp.
Referenced by singleNamedNamespaceChild().
|
static |
Definition at line 161 of file AvoidBindCheck.cpp.
|
static |
Definition at line 47 of file LoopConvertCheck.cpp.
Referenced by makeIteratorLoopMatcher().
bool clang::tidy::modernize::areSameExpr | ( | ASTContext * | Context, |
const Expr * | First, | ||
const Expr * | Second | ||
) |
Returns true when two Exprs are equivalent.
Definition at line 187 of file LoopConvertUtils.cpp.
bool clang::tidy::modernize::areSameVariable | ( | const ValueDecl * | First, |
const ValueDecl * | Second | ||
) |
Returns true when two ValueDecls are the same variable.
Definition at line 203 of file LoopConvertUtils.cpp.
|
static |
Determines whether the bound of a for loop condition expression is the same as the statically computable size of ArrayType.
Given
This is intended to permit
Definition at line 432 of file LoopConvertUtils.cpp.
|
static |
Returns false if the body has any non-whitespace character.
Definition at line 192 of file UseEqualsDefaultCheck.cpp.
|
static |
Definition at line 226 of file AvoidBindCheck.cpp.
|
static |
Given an expression that represents an usage of an element from the containter 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 392 of file LoopConvertCheck.cpp.
|
static |
Definition at line 166 of file UseTrailingReturnTypeCheck.cpp.
|
static |
Find all references to ParamDecl
across all of the redeclarations of Ctor
.
Definition at line 110 of file PassByValueCheck.cpp.
References Results.
|
static |
Definition at line 49 of file PassByValueCheck.cpp.
|
static |
Returns true if the container is const-qualified.
Definition at line 436 of file LoopConvertCheck.cpp.
|
static |
Returns true when the Container contains an Expr equivalent to E.
Definition at line 234 of file LoopConvertUtils.cpp.
const Expr * clang::tidy::modernize::digThroughConstructors | ( | const Expr * | E | ) |
Look through conversion/copy constructors 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()); 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 168 of file LoopConvertUtils.cpp.
|
static |
Definition at line 21 of file UseNodiscardCheck.cpp.
|
static |
Definition at line 523 of file AvoidBindCheck.cpp.
|
static |
Definition at line 545 of file AvoidBindCheck.cpp.
|
static |
Definition at line 104 of file UseTrailingReturnTypeCheck.cpp.
|
static |
Determines if an expression is a declaration reference to a particular variable.
Definition at line 210 of file LoopConvertUtils.cpp.
Referenced by isDereferenceOfOpCall(), and isDereferenceOfUop().
|
static |
Definition at line 360 of file AvoidBindCheck.cpp.
Referenced by getCallOperator().
|
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 334 of file LoopConvertCheck.cpp.
|
static |
Definition at line 287 of file AvoidBindCheck.cpp.
|
static |
Returns the names of the direct bases of Record
, both virtual and non-virtual.
Definition at line 38 of file UseEqualsDefaultCheck.cpp.
|
static |
Finds all the named non-static fields of Record
.
Definition at line 25 of file UseEqualsDefaultCheck.cpp.
|
static |
Definition at line 463 of file AvoidBindCheck.cpp.
|
static |
Definition at line 440 of file AvoidBindCheck.cpp.
const FunctionDecl* clang::tidy::modernize::getCallMethodDecl | ( | const MatchFinder::MatchResult & | Result, |
CallableType | Type, | ||
CallableMaterializationKind | Materialization | ||
) |
Definition at line 418 of file AvoidBindCheck.cpp.
const FunctionDecl* clang::tidy::modernize::getCallOperator | ( | const CXXRecordDecl * | Callable, |
size_t | NumArgs | ||
) |
Definition at line 407 of file AvoidBindCheck.cpp.
References findCandidateCallOperators().
|
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 304 of file LoopConvertCheck.cpp.
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 198 of file LoopConvertUtils.cpp.
|
static |
If the expression is a dereference or call to operator*(), return the operand.
Otherwise, return NULL.
Definition at line 219 of file LoopConvertUtils.cpp.
|
static |
Definition at line 568 of file AvoidBindCheck.cpp.
|
static |
Definition at line 137 of file UseDefaultMemberInitCheck.cpp.
|
static |
Definition at line 72 of file UseTransparentFunctorsCheck.cpp.
|
static |
Definition at line 486 of file AvoidBindCheck.cpp.
|
static |
If the given expression is actually a DeclRefExpr or a MemberExpr, find and return the underlying ValueDecl; otherwise, return NULL.
Definition at line 373 of file LoopConvertCheck.cpp.
|
static |
Definition at line 127 of file AvoidBindCheck.cpp.
|
static |
Obtain the original source code text from a SourceRange.
Definition at line 359 of file LoopConvertCheck.cpp.
|
static |
Definition at line 82 of file UseOverrideCheck.cpp.
|
static |
Definition at line 20 of file UseDefaultMemberInitCheck.cpp.
|
static |
Definition at line 249 of file UseTrailingReturnTypeCheck.cpp.
|
static |
Definition at line 116 of file AvoidBindCheck.cpp.
|
static |
Definition at line 105 of file AvoidBindCheck.cpp.
|
static |
Definition at line 130 of file UseDefaultMemberInitCheck.cpp.
|
static |
Definition at line 60 of file LoopConvertCheck.cpp.
Referenced by makeArrayLoopMatcher(), and makePseudoArrayLoopMatcher().
|
static |
Definition at line 145 of file AvoidBindCheck.cpp.
|
static |
Definition at line 54 of file LoopConvertCheck.cpp.
Referenced by makeArrayLoopMatcher(), and makePseudoArrayLoopMatcher().
|
static |
Definition at line 49 of file LoopConvertCheck.cpp.
Referenced by makeArrayLoopMatcher(), and makePseudoArrayLoopMatcher().
|
static |
Determines whether the given Decl defines a variable initialized to the loop object.
This is intended to find cases such as
and
Definition at line 349 of file LoopConvertUtils.cpp.
|
static |
Definition at line 134 of file AvoidBindCheck.cpp.
|
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 118 of file UseEqualsDefaultCheck.cpp.
|
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.
|
static |
Definition at line 156 of file UseTrailingReturnTypeCheck.cpp.
|
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 313 of file LoopConvertUtils.cpp.
References exprReferencesVariable().
|
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 326 of file LoopConvertUtils.cpp.
References exprReferencesVariable().
|
static |
Returns true when the given expression is a member expression whose base is this
(implicitly or not).
Definition at line 383 of file LoopConvertCheck.cpp.
|
static |
Definition at line 378 of file AvoidBindCheck.cpp.
|
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 253 of file LoopConvertUtils.cpp.
|
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
but not for
If PermitDeref is true, then isIndexInSubscriptExpr additionally returns true on these expressions:
Definition at line 287 of file LoopConvertUtils.cpp.
|
static |
Definition at line 348 of file AvoidBindCheck.cpp.
|
static |
Definition at line 160 of file UseTrailingReturnTypeCheck.cpp.
|
static |
Definition at line 108 of file UseDefaultMemberInitCheck.cpp.
|
static |
Definition at line 19 of file ConcatNestedNamespacesCheck.cpp.
StatementMatcher clang::tidy::modernize::makeArrayLoopMatcher | ( | ) |
The matcher for loops over arrays.
In this general example, assuming 'j' and 'k' are of integral type:
The following string identifiers are bound to these parts of the AST: ConditionVarName: 'j' (as a VarDecl) ConditionBoundName: '3 + 2' (as an Expr) InitVarName: 'i' (as a VarDecl) IncrementVarName: 'k' (as a VarDecl) LoopName: The entire for loop (as a ForStmt)
Client code will need to make sure that:
Definition at line 82 of file LoopConvertCheck.cpp.
References IncrementVarMatcher(), InitToZeroMatcher(), and IntegerComparisonMatcher().
StatementMatcher clang::tidy::modernize::makeIteratorLoopMatcher | ( | ) |
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):
Assuming f, g, and h are of type containerType::iterator,
The following string identifiers are bound to the parts of the AST: InitVarName: 'it' (as a VarDecl) ConditionVarName: 'f' (as a VarDecl) LoopName: The entire for loop (as a ForStmt) In the first example only: EndVarName: 'e' (as a VarDecl) ConditionEndVarName: 'g' (as a VarDecl) In the second example only: EndCallName: 'container.end()' (as a CXXMemberCallExpr)
Client code will need to make sure that:
Definition at line 127 of file LoopConvertCheck.cpp.
References AnyType().
StatementMatcher clang::tidy::modernize::makePseudoArrayLoopMatcher | ( | ) |
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):
Assuming f, g, and h are of type containerType::iterator,
The following string identifiers are bound to the parts of the AST: InitVarName: 'i' (as a VarDecl) ConditionVarName: 'f' (as a VarDecl) LoopName: The entire for loop (as a ForStmt) In the first example only: EndVarName: 'j' (as a VarDecl) ConditionEndVarName: 'g' (as a VarDecl) In the second example only: EndCallName: 'container.size()' (as a CXXMemberCallExpr)
Client code will need to make sure that:
Definition at line 235 of file LoopConvertCheck.cpp.
References IncrementVarMatcher(), InitToZeroMatcher(), and IntegerComparisonMatcher().
|
static |
Definition at line 53 of file PassByValueCheck.cpp.
|
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.
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 60 of file PassByValueCheck.cpp.
|
static |
Definition at line 50 of file UseOverrideCheck.cpp.
|
static |
Definition at line 144 of file UseDefaultMemberInitCheck.cpp.
|
static |
Definition at line 29 of file ConcatNestedNamespacesCheck.cpp.
References anonymousOrInlineNamespace(), and Decls.
|
static |
Definition at line 174 of file AvoidBindCheck.cpp.
|
static |
Definition at line 196 of file AvoidBindCheck.cpp.
|
static |
Returns true when it can be guaranteed that the elements of the container are not being modified.
Definition at line 411 of file LoopConvertCheck.cpp.
|
static |
Returns true if the elements of the container are never accessed by reference.
Definition at line 427 of file LoopConvertCheck.cpp.
|
static |
|
static |
Definition at line 39 of file LoopConvertCheck.cpp.
|
static |
Definition at line 35 of file LoopConvertCheck.cpp.
|
static |
Definition at line 41 of file LoopConvertCheck.cpp.
|
static |
Definition at line 36 of file LoopConvertCheck.cpp.
|
static |
Definition at line 21 of file UseEqualsDeleteCheck.cpp.
|
static |
Definition at line 19 of file DeprecatedIosBaseAliasesCheck.cpp.
|
static |
Definition at line 44 of file LoopConvertCheck.cpp.
|
static |
Definition at line 43 of file LoopConvertCheck.cpp.
|
static |
Definition at line 40 of file LoopConvertCheck.cpp.
|
static |
Definition at line 42 of file LoopConvertCheck.cpp.
|
static |
Definition at line 37 of file LoopConvertCheck.cpp.
|
static |
Definition at line 38 of file LoopConvertCheck.cpp.
|
static |
Definition at line 32 of file LoopConvertCheck.cpp.
|
static |
Definition at line 33 of file LoopConvertCheck.cpp.
|
static |
Definition at line 34 of file LoopConvertCheck.cpp.
static const StringRef clang::tidy::modernize::Message |
Definition at line 101 of file UseTrailingReturnTypeCheck.cpp.
Referenced by clang::clangd::fillNonLocationData(), clang::tidy::ClangTidyDiagnosticConsumer::HandleDiagnostic(), clang::clangd::Logger::indicator(), clang::clangd::IgnoreDiagnostics::log(), clang::tidy::ClangTidyContext::setDiagnosticsEngine(), clang::clangd::StreamLogger::StreamLogger(), and clang::tidy::cppcoreguidelines::MacroUsageCheck::warnMacro().
|
static |
Definition at line 26 of file DeprecatedIosBaseAliasesCheck.cpp.
|
static |
Definition at line 20 of file UseEqualsDeleteCheck.cpp.
|
static |
Definition at line 21 of file UseEqualsDefaultCheck.cpp.