clang-tools  14.0.0git
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
clang::tidy::bugprone Namespace Reference

Namespaces

 filter
 
 model
 

Classes

class  ArgumentCommentCheck
 Checks that argument comments match parameter names. More...
 
class  AssertSideEffectCheck
 Finds assert() with side effect. More...
 
class  BadSignalToKillThreadCheck
 Finds pthread_kill function calls when thread is terminated by SIGTERM signal. More...
 
class  BoolPointerImplicitConversionCheck
 Checks for conditions based on implicit conversion from a bool pointer to bool. More...
 
class  BranchCloneCheck
 A check for detecting if/else if/else chains where two or more branches are Type I clones of each other (that is, they contain identical code), for detecting switch statements where two or more consecutive branches are Type I clones of each other, and for detecting conditional operators where the true and false expressions are Type I clones of each other. More...
 
class  BugproneModule
 
class  CharExpressionDetector
 
class  CopyConstructorInitCheck
 Finds copy constructors where the ctor don't call the copy constructor of the base class. More...
 
class  DanglingHandleCheck
 Detect dangling references in value handlers like std::experimental::string_view. More...
 
class  DynamicStaticInitializersCheck
 Finds dynamically initialized static variables in header files. More...
 
class  EasilySwappableParametersCheck
 Finds function definitions where parameters of convertible types follow each other directly, making call sites prone to calling the function with swapped (or badly ordered) arguments. More...
 
class  ExceptionEscapeCheck
 Finds functions which should not throw exceptions: Destructors, move constructors, move assignment operators, the main() function, swap() functions, functions marked with throw() or noexcept and functions given as option to the checker. More...
 
class  FoldInitTypeCheck
 Find and flag invalid initializer values in folds, e.g. More...
 
class  ForwardDeclarationNamespaceCheck
 Checks if an unused forward declaration is in a wrong namespace. More...
 
class  ForwardingReferenceOverloadCheck
 The checker looks for constructors that can act as copy or move constructors through their forwarding reference parameters. More...
 
class  ImplicitWideningOfMultiplicationResultCheck
 Diagnoses instances of an implicit widening of multiplication result. More...
 
class  InaccurateEraseCheck
 Checks for inaccurate use of the erase() method. More...
 
class  IncorrectRoundingsCheck
 Checks the usage of patterns known to produce incorrect rounding. More...
 
class  InfiniteLoopCheck
 Finds obvious infinite loops (loops where the condition variable is not changed at all). More...
 
class  IntegerDivisionCheck
 Finds cases where integer division in a floating point context is likely to cause unintended loss of precision. More...
 
class  LambdaFunctionNameCheck
 Detect when func or FUNCTION is being used from within a lambda. More...
 
class  MacroParenthesesCheck
 Finds macros that can have unexpected behaviour due to missing parentheses. More...
 
class  MacroRepeatedSideEffectsCheck
 Checks for repeated argument with side effects in macros. More...
 
class  MisplacedOperatorInStrlenInAllocCheck
 Finds cases where 1 is added to the string in the argument to a function in the strlen() family instead of the result and value is used as an argument to a memory allocation function. More...
 
class  MisplacedPointerArithmeticInAllocCheck
 Finds cases where an integer is added to or subracted from the result of a memory allocation function instead of its argument. More...
 
class  MisplacedWideningCastCheck
 Find casts of calculation results to bigger type. More...
 
class  MoveForwardingReferenceCheck
 The check warns if std::move is applied to a forwarding reference (i.e. More...
 
class  MultipleStatementMacroCheck
 Detect multiple statement macros that are used in unbraced conditionals. More...
 
class  NoEscapeCheck
 Block arguments in dispatch_async() and dispatch_after() are guaranteed to escape. More...
 
class  NotNullTerminatedResultCheck
 Finds function calls where it is possible to cause a not null-terminated result. More...
 
class  ParentVirtualCallCheck
 Finds calls to grand..-parent virtual methods instead of parent's. More...
 
class  PosixReturnCheck
 
class  RedundantBranchConditionCheck
 Finds condition variables in nested if statements that were also checked in the outer if statement and were not changed. More...
 
class  ReservedIdentifierCheck
 Checks for usages of identifiers reserved for use by the implementation. More...
 
class  SignalHandlerCheck
 Checker for signal handler functions. More...
 
class  SignedCharMisuseCheck
 Finds those signed char -> integer conversions which might indicate a programming error. More...
 
class  SizeofContainerCheck
 Find usages of sizeof on expressions of STL container types. More...
 
class  SizeofExpressionCheck
 Find suspicious usages of sizeof expression. More...
 
class  SpuriouslyWakeUpFunctionsCheck
 Finds cnd_wait, cnd_timedwait, wait, wait_for, or wait_until function calls when the function is not invoked from a loop that checks whether a condition predicate holds or the function has a condition parameter. More...
 
class  StringConstructorCheck
 Finds suspicious string constructor and check their parameters. More...
 
class  StringIntegerAssignmentCheck
 Finds instances where an integer is assigned to a string. More...
 
class  StringLiteralWithEmbeddedNulCheck
 Find suspicious string literals with embedded NUL characters. More...
 
class  SuspiciousEnumUsageCheck
 The checker detects various cases when an enum is probably misused (as a bitmask). More...
 
class  SuspiciousIncludeCheck
 Warns on inclusion of files whose names suggest that they're implementation files, instead of headers. More...
 
class  SuspiciousMemoryComparisonCheck
 Finds potentially incorrect calls to memcmp() based on properties of the arguments. More...
 
class  SuspiciousMemsetUsageCheck
 Finds memset calls with potential mistakes in their arguments. More...
 
class  SuspiciousMissingCommaCheck
 This check finds string literals which are probably concatenated accidentally. More...
 
class  SuspiciousSemicolonCheck
 This check finds semicolon that modifies the meaning of the program unintendedly. More...
 
class  SuspiciousStringCompareCheck
 Find suspicious calls to string compare functions. More...
 
class  SwappedArgumentsCheck
 Finds potentially swapped arguments by looking at implicit conversions. More...
 
class  TerminatingContinueCheck
 Checks if a 'continue' statement terminates the loop (i.e. More...
 
class  ThrowKeywordMissingCheck
 Emits a warning about temporary objects whose type is (or is derived from) a class that has 'EXCEPTION', 'Exception' or 'exception' in its name. More...
 
class  TooSmallLoopVariableCheck
 This check gives a warning if a loop variable has a too small type which might not be able to represent all values which are part of the whole range in which the loop iterates. More...
 
class  UndefinedMemoryManipulationCheck
 Finds calls of memory manipulation functions memset(), memcpy() and memmove() on not TriviallyCopyable objects resulting in undefined behavior. More...
 
class  UndelegatedConstructorCheck
 Finds creation of temporary objects in constructors that look like a function call to another constructor of the same class. More...
 
class  UnhandledExceptionAtNewCheck
 Finds calls to 'new' that may throw unhandled exception at allocation failure. More...
 
class  UnhandledSelfAssignmentCheck
 Finds user-defined copy assignment operators which do not protect the code against self-assignment either by checking self-assignment explicitly or using the copy-and-swap or the copy-and-move method. More...
 
class  UnusedRaiiCheck
 Finds temporaries that look like RAII objects. More...
 
class  UnusedReturnValueCheck
 Detects function calls where the return value is unused. More...
 
class  UseAfterMoveCheck
 The check warns if an object is used after it has been moved, without an intervening reinitialization. More...
 
struct  ValueRange
 Stores a min and a max value which describe an interval. More...
 
class  VirtualNearMissCheck
 Checks for near miss of virtual methods. More...
 

Typedefs

using TheCheck = EasilySwappableParametersCheck
 
using BasesVector = llvm::SmallVector< const CXXRecordDecl *, 5 >
 

Enumerations

enum  LengthHandleKind { LengthHandleKind::Increase, LengthHandleKind::Decrease }
 

Functions

static std::vector< std::pair< SourceLocation, StringRef > > getCommentsInRange (ASTContext *Ctx, CharSourceRange Range)
 
static std::vector< std::pair< SourceLocation, StringRef > > getCommentsBeforeLoc (ASTContext *Ctx, SourceLocation Loc)
 
static bool isLikelyTypo (llvm::ArrayRef< ParmVarDecl * > Params, StringRef ArgName, unsigned ArgIndex)
 
static bool sameName (StringRef InComment, StringRef InDecl, bool StrictMode)
 
static bool looksLikeExpectMethod (const CXXMethodDecl *Expect)
 
static bool areMockAndExpectMethods (const CXXMethodDecl *Mock, const CXXMethodDecl *Expect)
 
static const CXXMethodDecl * findMockedMethod (const CXXMethodDecl *Method)
 
static const FunctionDecl * resolveMocks (const FunctionDecl *Func)
 
static void checkImpl (const MatchFinder::MatchResult &Result, const Expr *Ref, const IfStmt *If, const ast_matchers::internal::Matcher< Expr > &RefMatcher, ClangTidyCheck &Check)
 
 AST_MATCHER (clang::VarDecl, hasConstantDeclaration)
 
 AST_MATCHER_FUNCTION (ast_matchers::internal::Matcher< Stmt >, paramRefExpr)
 Matches DeclRefExprs and their ignorable wrappers to ParmVarDecls. More...
 
 AST_MATCHER_P (FunctionDecl, parameterCountGE, unsigned, N)
 Matches functions that have at least the specified amount of parameters. More...
 
 AST_MATCHER (FunctionDecl, isOverloadedUnaryOrBinaryOperator)
 Matches any overloaded unary and binary operators. More...
 
static unsigned clampMinimumLength (const unsigned Value)
 Returns the DefaultMinimumLength if the Value of requested minimum length is less than 2. More...
 
static SmallString< 64 > getName (const NamedDecl *ND)
 Returns the diagnostic-friendly name of the node, or empty string. More...
 
static SmallString< 64 > getNameOrUnnamed (const NamedDecl *ND)
 Returns the diagnostic-friendly name of the node, or a constant value. More...
 
static bool needsToPrintTypeInDiagnostic (const model::Mix &M)
 Returns whether a particular Mix between two parameters should have the types involved diagnosed to the user. More...
 
static bool needsToElaborateImplicitConversion (const model::Mix &M)
 Returns whether a particular Mix between the two parameters should have implicit conversions elaborated. More...
 
static bool isValidBuiltinFold (const BuiltinType &ValueType, const BuiltinType &InitType, const ASTContext &Context)
 Returns true if ValueType is allowed to fold into InitType, i.e. More...
 
static bool haveSameNamespaceOrTranslationUnit (const CXXRecordDecl *Decl1, const CXXRecordDecl *Decl2)
 
static std::string getNameOfNamespace (const CXXRecordDecl *Decl)
 
static const Expr * getLHSOfMulBinOp (const Expr *E)
 
static internal::Matcher< Stmt > loopEndingStmt (internal::Matcher< Stmt > Internal)
 
static bool isChanged (const Stmt *LoopStmt, const VarDecl *Var, ASTContext *Context)
 Return whether Var was changed in LoopStmt. More...
 
static bool isVarThatIsPossiblyChanged (const Decl *Func, const Stmt *LoopStmt, const Stmt *Cond, ASTContext *Context)
 Return whether Cond is a variable that is possibly changed in LoopStmt. More...
 
static bool isAtLeastOneCondVarChanged (const Decl *Func, const Stmt *LoopStmt, const Stmt *Cond, ASTContext *Context)
 Return whether at least one variable of Cond changed in LoopStmt. More...
 
static std::string getCondVarNames (const Stmt *Cond)
 Return the variable names in Cond. More...
 
static bool isKnownFalse (const Expr &Cond, const ASTContext &Ctx)
 
static bool isSurroundedLeft (const Token &T)
 Is argument surrounded properly with parentheses/braces/squares/commas? More...
 
static bool isSurroundedRight (const Token &T)
 Is argument surrounded properly with parentheses/braces/squares/commas? More...
 
static bool isKeyword (const Token &T)
 Is given TokenKind a keyword? More...
 
static bool isWarnOp (const Token &T)
 Warning is written when one of these operators are not within parentheses. More...
 
static bool isVarDeclKeyword (const Token &T)
 Is given Token a keyword that is used in variable declarations? More...
 
static bool possibleVarDecl (const MacroInfo *MI, const Token *Tok)
 Is there a possible variable declaration at Tok? More...
 
static unsigned getMaxCalculationWidth (const ASTContext &Context, const Expr *E)
 
static int relativeIntSizes (BuiltinType::Kind Kind)
 
static int relativeCharSizes (BuiltinType::Kind Kind)
 
static int relativeCharSizesW (BuiltinType::Kind Kind)
 
static bool isFirstWider (BuiltinType::Kind First, BuiltinType::Kind Second)
 
static void replaceMoveWithForward (const UnresolvedLookupExpr *Callee, const ParmVarDecl *ParmVar, const TemplateTypeParmDecl *TypeParmDecl, DiagnosticBuilder &Diag, const ASTContext &Context)
 
static const Expr * getDestCapacityExpr (const MatchFinder::MatchResult &Result)
 
static unsigned getLength (const Expr *E, const MatchFinder::MatchResult &Result)
 
static int getDestCapacity (const MatchFinder::MatchResult &Result)
 
static const CallExpr * getStrlenExpr (const MatchFinder::MatchResult &Result)
 
static int getGivenLength (const MatchFinder::MatchResult &Result)
 
static StringRef exprToStr (const Expr *E, const MatchFinder::MatchResult &Result)
 
static SourceLocation exprLocEnd (const Expr *E, const MatchFinder::MatchResult &Result)
 
static bool isInjectUL (const MatchFinder::MatchResult &Result)
 
static bool isKnownDest (const MatchFinder::MatchResult &Result)
 
static bool isDestBasedOnGivenLength (const MatchFinder::MatchResult &Result)
 
static bool isDestAndSrcEquals (const MatchFinder::MatchResult &Result)
 
static bool isStringDataAndLength (const MatchFinder::MatchResult &Result)
 
static bool isGivenLengthEqualToSrcLength (const MatchFinder::MatchResult &Result)
 
static bool isCorrectGivenLength (const MatchFinder::MatchResult &Result)
 
static bool isDestCapacityOverflows (const MatchFinder::MatchResult &Result)
 
static bool isFixedGivenLengthAndUnknownSrc (const MatchFinder::MatchResult &Result)
 
static void lengthExprHandle (const Expr *LengthExpr, LengthHandleKind LengthHandle, const MatchFinder::MatchResult &Result, DiagnosticBuilder &Diag)
 
static void lengthArgHandle (LengthHandleKind LengthHandle, const MatchFinder::MatchResult &Result, DiagnosticBuilder &Diag)
 
static void lengthArgPosHandle (unsigned ArgPos, LengthHandleKind LengthHandle, const MatchFinder::MatchResult &Result, DiagnosticBuilder &Diag)
 
static bool isDestExprFix (const MatchFinder::MatchResult &Result, DiagnosticBuilder &Diag)
 
static bool isDestCapacityFix (const MatchFinder::MatchResult &Result, DiagnosticBuilder &Diag)
 
static void removeArg (int ArgPos, const MatchFinder::MatchResult &Result, DiagnosticBuilder &Diag)
 
static void renameFunc (StringRef NewFuncName, const MatchFinder::MatchResult &Result, DiagnosticBuilder &Diag)
 
static void renameMemcpy (StringRef Name, bool IsCopy, bool IsSafe, const MatchFinder::MatchResult &Result, DiagnosticBuilder &Diag)
 
static void insertDestCapacityArg (bool IsOverflows, StringRef Name, const MatchFinder::MatchResult &Result, DiagnosticBuilder &Diag)
 
static void insertNullTerminatorExpr (StringRef Name, const MatchFinder::MatchResult &Result, DiagnosticBuilder &Diag)
 
static bool isParentOf (const CXXRecordDecl &Parent, const CXXRecordDecl &ThisClass)
 
static BasesVector getParentsByGrandParent (const CXXRecordDecl &GrandParent, const CXXRecordDecl &ThisClass, const CXXMethodDecl &MemberDecl)
 
static std::string getNameAsString (const NamedDecl *Decl)
 
static std::string getExprAsString (const clang::Expr &E, clang::ASTContext &AC)
 
static StringRef getFunctionSpelling (const MatchFinder::MatchResult &Result, const char *BindingStr)
 
static bool isChangedBefore (const Stmt *S, const Stmt *NextS, const Stmt *PrevS, const VarDecl *Var, ASTContext *Context)
 Returns whether Var is changed in range (PrevS..NextS). More...
 
static int getMessageSelectIndex (StringRef Tag)
 
static std::string collapseConsecutive (StringRef Str, char C)
 
static bool hasReservedDoubleUnderscore (StringRef Name, const LangOptions &LangOpts)
 
static Optional< std::string > getDoubleUnderscoreFixup (StringRef Name, const LangOptions &LangOpts)
 
static bool startsWithUnderscoreCapital (StringRef Name)
 
static Optional< std::string > getUnderscoreCapitalFixup (StringRef Name)
 
static bool startsWithUnderscoreInGlobalNamespace (StringRef Name, bool IsInGlobalNamespace)
 
static Optional< std::string > getUnderscoreGlobalNamespaceFixup (StringRef Name, bool IsInGlobalNamespace)
 
static std::string getNonReservedFixup (std::string Name)
 
static Optional< RenamerClangTidyCheck::FailureInfogetFailureInfoImpl (StringRef Name, bool IsInGlobalNamespace, const LangOptions &LangOpts, bool Invert, ArrayRef< std::string > AllowedIdentifiers)
 
static bool isSystemCall (const FunctionDecl *FD)
 
 AST_MATCHER (FunctionDecl, isSystemCall)
 
static Matcher< TypedefDecl > hasAnyListedName (const std::string &Names)
 
static int enumLength (const EnumDecl *EnumDec)
 Return the number of EnumConstantDecls in an EnumDecl. More...
 
static bool hasDisjointValueRange (const EnumDecl *Enum1, const EnumDecl *Enum2)
 
static bool isNonPowerOf2NorNullLiteral (const EnumConstantDecl *EnumConst)
 
static bool isMaxValAllBitSetLiteral (const EnumDecl *EnumDec)
 
static int countNonPowOfTwoLiteralNum (const EnumDecl *EnumDec)
 
static bool isPossiblyBitMask (const EnumDecl *EnumDec)
 Check if there is one or two enumerators that are not a power of 2 and are initialized by a literal in the enum type, and that the enumeration contains enough elements to reasonably act as a bitmask. More...
 
static llvm::Optional< uint64_t > tryEvaluateSizeExpr (const Expr *SizeExpr, const ASTContext &Ctx)
 
static const Expr * ignoreNoOpCasts (const Expr *E)
 Look through lvalue to rvalue and nop casts. More...
 
static bool isImplicitCastCandidate (const CastExpr *Cast)
 Restrict the warning to implicit casts that are most likely accidental. More...
 
static unsigned calcMagnitudeBits (const ASTContext &Context, const QualType &IntExprType)
 Returns the magnitude bits of an integer type. More...
 
static unsigned calcUpperBoundMagnitudeBits (const ASTContext &Context, const Expr *UpperBound, const QualType &UpperBoundType)
 Calculate the upper bound expression's magnitude bits, but ignore constant like values to reduce false positives. More...
 
 AST_MATCHER_P (CXXTryStmt, hasHandlerFor, ast_matchers::internal::Matcher< QualType >, InnerMatcher)
 
 AST_MATCHER (CXXNewExpr, mayThrow)
 
template<typename T >
void reportDiagnostic (DiagnosticBuilder D, const T *Node, SourceRange SR, bool DefaultConstruction)
 
static StatementMatcher inDecltypeOrTemplateArg ()
 
bool isStandardSmartPointer (const ValueDecl *VD)
 
static void emitDiagnostic (const Expr *MovingCall, const DeclRefExpr *MoveArg, const UseAfterMove &Use, ClangTidyCheck *Check, ASTContext *Context)
 
static bool isOverrideMethod (const CXXMethodDecl *MD)
 Finds out if the given method overrides some method. More...
 
static bool checkOverridingFunctionReturnType (const ASTContext *Context, const CXXMethodDecl *BaseMD, const CXXMethodDecl *DerivedMD)
 Checks whether the return types are covariant, according to C++[class.virtual]p7. More...
 
static QualType getDecayedType (QualType Type)
 
static bool checkParamTypes (const CXXMethodDecl *BaseMD, const CXXMethodDecl *DerivedMD)
 
static bool checkOverrideWithoutName (const ASTContext *Context, const CXXMethodDecl *BaseMD, const CXXMethodDecl *DerivedMD)
 
static bool checkOverrideByDerivedMethod (const CXXMethodDecl *BaseMD, const CXXMethodDecl *DerivedMD)
 Check whether BaseMD overrides DerivedMD. More...
 

Variables

static Preprocessor * PP
 
constexpr llvm::StringLiteral FunctionExprName = "FunctionExpr"
 
constexpr llvm::StringLiteral CastExprName = "CastExpr"
 
constexpr llvm::StringLiteral UnknownDestName = "UnknownDest"
 
constexpr llvm::StringLiteral DestArrayTyName = "DestArrayTy"
 
constexpr llvm::StringLiteral DestVarDeclName = "DestVarDecl"
 
constexpr llvm::StringLiteral DestMallocExprName = "DestMalloc"
 
constexpr llvm::StringLiteral DestExprName = "DestExpr"
 
constexpr llvm::StringLiteral SrcVarDeclName = "SrcVarDecl"
 
constexpr llvm::StringLiteral SrcExprName = "SrcExpr"
 
constexpr llvm::StringLiteral LengthExprName = "LengthExpr"
 
constexpr llvm::StringLiteral WrongLengthExprName = "WrongLength"
 
constexpr llvm::StringLiteral UnknownLengthName = "UnknownLength"
 
static const char CondVarStr [] = "cond_var"
 
static const char OuterIfStr [] = "outer_if"
 
static const char InnerIfStr [] = "inner_if"
 
static const char OuterIfVar1Str [] = "outer_if_var1"
 
static const char OuterIfVar2Str [] = "outer_if_var2"
 
static const char InnerIfVar1Str [] = "inner_if_var1"
 
static const char InnerIfVar2Str [] = "inner_if_var2"
 
static const char FuncStr [] = "func"
 
static const char DoubleUnderscoreTag [] = "du"
 
static const char UnderscoreCapitalTag [] = "uc"
 
static const char GlobalUnderscoreTag [] = "global-under"
 
static const char NonReservedTag [] = "non-reserved"
 
static const char Message []
 
static constexpr int UnsignedASCIIUpperBound = 127
 
static const char DifferentEnumErrorMessage []
 
static const char BitmaskErrorMessage []
 
static const char BitmaskVarErrorMessage []
 
static const char BitmaskNoteMessage [] = "used here as a bitmask"
 
static const char KnownStringCompareFunctions []
 
static constexpr llvm::StringLiteral LoopName
 
static constexpr llvm::StringLiteral LoopVarName
 
static constexpr llvm::StringLiteral LoopVarCastName
 
static constexpr llvm::StringLiteral LoopUpperBoundName
 
static constexpr llvm::StringLiteral LoopIncrementName
 

Typedef Documentation

◆ BasesVector

using clang::tidy::bugprone::BasesVector = typedef llvm::SmallVector<const CXXRecordDecl *, 5>

Definition at line 24 of file ParentVirtualCallCheck.cpp.

◆ TheCheck

Definition at line 84 of file EasilySwappableParametersCheck.cpp.

Enumeration Type Documentation

◆ LengthHandleKind

Enumerator
Increase 
Decrease 

Definition at line 36 of file NotNullTerminatedResultCheck.cpp.

Function Documentation

◆ areMockAndExpectMethods()

static bool clang::tidy::bugprone::areMockAndExpectMethods ( const CXXMethodDecl *  Mock,
const CXXMethodDecl *  Expect 
)
static

Definition at line 190 of file ArgumentCommentCheck.cpp.

References looksLikeExpectMethod().

Referenced by findMockedMethod().

◆ AST_MATCHER() [1/4]

clang::tidy::bugprone::AST_MATCHER ( clang::VarDecl  ,
hasConstantDeclaration   
)

Definition at line 19 of file DynamicStaticInitializersCheck.cpp.

◆ AST_MATCHER() [2/4]

clang::tidy::bugprone::AST_MATCHER ( CXXNewExpr  ,
mayThrow   
)

Definition at line 35 of file UnhandledExceptionAtNewCheck.cpp.

◆ AST_MATCHER() [3/4]

clang::tidy::bugprone::AST_MATCHER ( FunctionDecl  ,
isOverloadedUnaryOrBinaryOperator   
)

Matches any overloaded unary and binary operators.

Definition at line 1882 of file EasilySwappableParametersCheck.cpp.

◆ AST_MATCHER() [4/4]

clang::tidy::bugprone::AST_MATCHER ( FunctionDecl  ,
isSystemCall   
)

Definition at line 76 of file SignalHandlerCheck.cpp.

References isSystemCall().

◆ AST_MATCHER_FUNCTION()

clang::tidy::bugprone::AST_MATCHER_FUNCTION ( ast_matchers::internal::Matcher< Stmt >  ,
paramRefExpr   
)

Matches DeclRefExprs and their ignorable wrappers to ParmVarDecls.

Definition at line 1490 of file EasilySwappableParametersCheck.cpp.

◆ AST_MATCHER_P() [1/2]

clang::tidy::bugprone::AST_MATCHER_P ( CXXTryStmt  ,
hasHandlerFor  ,
ast_matchers::internal::Matcher< QualType >  ,
InnerMatcher   
)

Definition at line 19 of file UnhandledExceptionAtNewCheck.cpp.

◆ AST_MATCHER_P() [2/2]

clang::tidy::bugprone::AST_MATCHER_P ( FunctionDecl  ,
parameterCountGE  ,
unsigned  ,
 
)

Matches functions that have at least the specified amount of parameters.

Definition at line 1877 of file EasilySwappableParametersCheck.cpp.

◆ calcMagnitudeBits()

static unsigned clang::tidy::bugprone::calcMagnitudeBits ( const ASTContext &  Context,
const QualType &  IntExprType 
)
static

Returns the magnitude bits of an integer type.

Definition at line 98 of file TooSmallLoopVariableCheck.cpp.

◆ calcUpperBoundMagnitudeBits()

static unsigned clang::tidy::bugprone::calcUpperBoundMagnitudeBits ( const ASTContext &  Context,
const Expr *  UpperBound,
const QualType &  UpperBoundType 
)
static

Calculate the upper bound expression's magnitude bits, but ignore constant like values to reduce false positives.

Definition at line 109 of file TooSmallLoopVariableCheck.cpp.

◆ checkImpl()

static void clang::tidy::bugprone::checkImpl ( const MatchFinder::MatchResult &  Result,
const Expr *  Ref,
const IfStmt *  If,
const ast_matchers::internal::Matcher< Expr > &  RefMatcher,
ClangTidyCheck Check 
)
static

Definition at line 36 of file BoolPointerImplicitConversionCheck.cpp.

◆ checkOverrideByDerivedMethod()

static bool clang::tidy::bugprone::checkOverrideByDerivedMethod ( const CXXMethodDecl *  BaseMD,
const CXXMethodDecl *  DerivedMD 
)
static

Check whether BaseMD overrides DerivedMD.

Prerequisite: the class which BaseMD is in should be a base class of that DerivedMD is in.

Definition at line 169 of file VirtualNearMissCheck.cpp.

References E.

◆ checkOverrideWithoutName()

static bool clang::tidy::bugprone::checkOverrideWithoutName ( const ASTContext *  Context,
const CXXMethodDecl *  BaseMD,
const CXXMethodDecl *  DerivedMD 
)
static
Returns
true if derived method can override base method except for the name.

Definition at line 149 of file VirtualNearMissCheck.cpp.

◆ checkOverridingFunctionReturnType()

static bool clang::tidy::bugprone::checkOverridingFunctionReturnType ( const ASTContext *  Context,
const CXXMethodDecl *  BaseMD,
const CXXMethodDecl *  DerivedMD 
)
static

Checks whether the return types are covariant, according to C++[class.virtual]p7.

Similar with clang::Sema::CheckOverridingFunctionReturnType.

Returns
true if the return types of BaseMD and DerivedMD are covariant.

Check if the return types are covariant.

BTy is the class type in return type of BaseMD. For example, B* Base::md() While BRD is the declaration of B.

Definition at line 39 of file VirtualNearMissCheck.cpp.

◆ checkParamTypes()

static bool clang::tidy::bugprone::checkParamTypes ( const CXXMethodDecl *  BaseMD,
const CXXMethodDecl *  DerivedMD 
)
static
Returns
true if the param types are the same.

Definition at line 131 of file VirtualNearMissCheck.cpp.

References getDecayedType().

◆ clampMinimumLength()

static unsigned clang::tidy::bugprone::clampMinimumLength ( const unsigned  Value)
inlinestatic

Returns the DefaultMinimumLength if the Value of requested minimum length is less than 2.

Minimum lengths of 0 or 1 are not accepted.

Definition at line 1900 of file EasilySwappableParametersCheck.cpp.

References DefaultMinimumLength.

◆ collapseConsecutive()

static std::string clang::tidy::bugprone::collapseConsecutive ( StringRef  Str,
char  C 
)
static

Definition at line 57 of file ReservedIdentifierCheck.cpp.

◆ countNonPowOfTwoLiteralNum()

static int clang::tidy::bugprone::countNonPowOfTwoLiteralNum ( const EnumDecl *  EnumDec)
static

Definition at line 89 of file SuspiciousEnumUsageCheck.cpp.

References E.

Referenced by isPossiblyBitMask().

◆ emitDiagnostic()

static void clang::tidy::bugprone::emitDiagnostic ( const Expr *  MovingCall,
const DeclRefExpr *  MoveArg,
const UseAfterMove &  Use,
ClangTidyCheck Check,
ASTContext *  Context 
)
static

Definition at line 374 of file UseAfterMoveCheck.cpp.

◆ enumLength()

static int clang::tidy::bugprone::enumLength ( const EnumDecl *  EnumDec)
static

Return the number of EnumConstantDecls in an EnumDecl.

Definition at line 53 of file SuspiciousEnumUsageCheck.cpp.

Referenced by isPossiblyBitMask().

◆ exprLocEnd()

static SourceLocation clang::tidy::bugprone::exprLocEnd ( const Expr *  E,
const MatchFinder::MatchResult &  Result 
)
static

Definition at line 151 of file NotNullTerminatedResultCheck.cpp.

◆ exprToStr()

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

Definition at line 140 of file NotNullTerminatedResultCheck.cpp.

◆ findMockedMethod()

static const CXXMethodDecl* clang::tidy::bugprone::findMockedMethod ( const CXXMethodDecl *  Method)
static

Definition at line 205 of file ArgumentCommentCheck.cpp.

References areMockAndExpectMethods(), Ctx, ns1::ns2::D, and looksLikeExpectMethod().

Referenced by resolveMocks().

◆ getCommentsBeforeLoc()

static std::vector<std::pair<SourceLocation, StringRef> > clang::tidy::bugprone::getCommentsBeforeLoc ( ASTContext *  Ctx,
SourceLocation  Loc 
)
static

Definition at line 125 of file ArgumentCommentCheck.cpp.

References Loc.

◆ getCommentsInRange()

static std::vector<std::pair<SourceLocation, StringRef> > clang::tidy::bugprone::getCommentsInRange ( ASTContext *  Ctx,
CharSourceRange  Range 
)
static

Definition at line 81 of file ArgumentCommentCheck.cpp.

◆ getCondVarNames()

static std::string clang::tidy::bugprone::getCondVarNames ( const Stmt *  Cond)
static

Return the variable names in Cond.

Definition at line 101 of file InfiniteLoopCheck.cpp.

◆ getDecayedType()

static QualType clang::tidy::bugprone::getDecayedType ( QualType  Type)
static
Returns
decayed type for arrays and functions.

Definition at line 124 of file VirtualNearMissCheck.cpp.

References Type.

Referenced by checkParamTypes().

◆ getDestCapacity()

static int clang::tidy::bugprone::getDestCapacity ( const MatchFinder::MatchResult &  Result)
static

Definition at line 96 of file NotNullTerminatedResultCheck.cpp.

◆ getDestCapacityExpr()

static const Expr* clang::tidy::bugprone::getDestCapacityExpr ( const MatchFinder::MatchResult &  Result)
static

Definition at line 45 of file NotNullTerminatedResultCheck.cpp.

◆ getDoubleUnderscoreFixup()

static Optional<std::string> clang::tidy::bugprone::getDoubleUnderscoreFixup ( StringRef  Name,
const LangOptions &  LangOpts 
)
static

Definition at line 72 of file ReservedIdentifierCheck.cpp.

◆ getExprAsString()

static std::string clang::tidy::bugprone::getExprAsString ( const clang::Expr &  E,
clang::ASTContext &  AC 
)
static

Definition at line 73 of file ParentVirtualCallCheck.cpp.

◆ getFailureInfoImpl()

static Optional<RenamerClangTidyCheck::FailureInfo> clang::tidy::bugprone::getFailureInfoImpl ( StringRef  Name,
bool  IsInGlobalNamespace,
const LangOptions &  LangOpts,
bool  Invert,
ArrayRef< std::string >  AllowedIdentifiers 
)
static

Definition at line 110 of file ReservedIdentifierCheck.cpp.

◆ getFunctionSpelling()

static StringRef clang::tidy::bugprone::getFunctionSpelling ( const MatchFinder::MatchResult &  Result,
const char *  BindingStr 
)
static

Definition at line 21 of file PosixReturnCheck.cpp.

◆ getGivenLength()

static int clang::tidy::bugprone::getGivenLength ( const MatchFinder::MatchResult &  Result)
static

Definition at line 118 of file NotNullTerminatedResultCheck.cpp.

◆ getLength()

static unsigned clang::tidy::bugprone::getLength ( const Expr *  E,
const MatchFinder::MatchResult &  Result 
)
static

Definition at line 63 of file NotNullTerminatedResultCheck.cpp.

◆ getLHSOfMulBinOp()

static const Expr* clang::tidy::bugprone::getLHSOfMulBinOp ( const Expr *  E)
static

◆ getMaxCalculationWidth()

static unsigned clang::tidy::bugprone::getMaxCalculationWidth ( const ASTContext &  Context,
const Expr *  E 
)
static

Definition at line 53 of file MisplacedWideningCastCheck.cpp.

◆ getMessageSelectIndex()

static int clang::tidy::bugprone::getMessageSelectIndex ( StringRef  Tag)
static

Definition at line 35 of file ReservedIdentifierCheck.cpp.

References GlobalUnderscoreTag, NonReservedTag, and Tag.

◆ getName()

static SmallString<64> clang::tidy::bugprone::getName ( const NamedDecl *  ND)
static

Returns the diagnostic-friendly name of the node, or empty string.

Definition at line 1907 of file EasilySwappableParametersCheck.cpp.

References Name, and OS.

Referenced by getNameOrUnnamed().

◆ getNameAsString()

static std::string clang::tidy::bugprone::getNameAsString ( const NamedDecl *  Decl)
static

Definition at line 62 of file ParentVirtualCallCheck.cpp.

References Decl, OS, and PP.

◆ getNameOfNamespace()

static std::string clang::tidy::bugprone::getNameOfNamespace ( const CXXRecordDecl *  Decl)
static

◆ getNameOrUnnamed()

static SmallString<64> clang::tidy::bugprone::getNameOrUnnamed ( const NamedDecl *  ND)
static

Returns the diagnostic-friendly name of the node, or a constant value.

Definition at line 1915 of file EasilySwappableParametersCheck.cpp.

References getName(), and Name.

◆ getNonReservedFixup()

static std::string clang::tidy::bugprone::getNonReservedFixup ( std::string  Name)
static

Definition at line 100 of file ReservedIdentifierCheck.cpp.

References Name.

◆ getParentsByGrandParent()

static BasesVector clang::tidy::bugprone::getParentsByGrandParent ( const CXXRecordDecl &  GrandParent,
const CXXRecordDecl &  ThisClass,
const CXXMethodDecl &  MemberDecl 
)
static

Definition at line 39 of file ParentVirtualCallCheck.cpp.

◆ getStrlenExpr()

static const CallExpr* clang::tidy::bugprone::getStrlenExpr ( const MatchFinder::MatchResult &  Result)
static

Definition at line 104 of file NotNullTerminatedResultCheck.cpp.

◆ getUnderscoreCapitalFixup()

static Optional<std::string> clang::tidy::bugprone::getUnderscoreCapitalFixup ( StringRef  Name)
static

Definition at line 82 of file ReservedIdentifierCheck.cpp.

References Name, and startsWithUnderscoreCapital().

◆ getUnderscoreGlobalNamespaceFixup()

static Optional<std::string> clang::tidy::bugprone::getUnderscoreGlobalNamespaceFixup ( StringRef  Name,
bool  IsInGlobalNamespace 
)
static

Definition at line 94 of file ReservedIdentifierCheck.cpp.

References Name, and startsWithUnderscoreInGlobalNamespace().

◆ hasAnyListedName()

static Matcher<TypedefDecl> clang::tidy::bugprone::hasAnyListedName ( const std::string &  Names)
static

◆ hasDisjointValueRange()

static bool clang::tidy::bugprone::hasDisjointValueRange ( const EnumDecl *  Enum1,
const EnumDecl *  Enum2 
)
static

◆ hasReservedDoubleUnderscore()

static bool clang::tidy::bugprone::hasReservedDoubleUnderscore ( StringRef  Name,
const LangOptions &  LangOpts 
)
static

Definition at line 64 of file ReservedIdentifierCheck.cpp.

◆ haveSameNamespaceOrTranslationUnit()

static bool clang::tidy::bugprone::haveSameNamespaceOrTranslationUnit ( const CXXRecordDecl *  Decl1,
const CXXRecordDecl *  Decl2 
)
static

◆ ignoreNoOpCasts()

static const Expr* clang::tidy::bugprone::ignoreNoOpCasts ( const Expr *  E)
static

Look through lvalue to rvalue and nop casts.

This filters out implicit conversions that have no effect on the input but block our view for other implicit casts.

Definition at line 28 of file SwappedArgumentsCheck.cpp.

◆ inDecltypeOrTemplateArg()

static StatementMatcher clang::tidy::bugprone::inDecltypeOrTemplateArg ( )
static

Definition at line 98 of file UseAfterMoveCheck.cpp.

◆ insertDestCapacityArg()

static void clang::tidy::bugprone::insertDestCapacityArg ( bool  IsOverflows,
StringRef  Name,
const MatchFinder::MatchResult &  Result,
DiagnosticBuilder &  Diag 
)
static

Definition at line 448 of file NotNullTerminatedResultCheck.cpp.

◆ insertNullTerminatorExpr()

static void clang::tidy::bugprone::insertNullTerminatorExpr ( StringRef  Name,
const MatchFinder::MatchResult &  Result,
DiagnosticBuilder &  Diag 
)
static

Definition at line 469 of file NotNullTerminatedResultCheck.cpp.

◆ isAtLeastOneCondVarChanged()

static bool clang::tidy::bugprone::isAtLeastOneCondVarChanged ( const Decl Func,
const Stmt *  LoopStmt,
const Stmt *  Cond,
ASTContext *  Context 
)
static

Return whether at least one variable of Cond changed in LoopStmt.

Definition at line 85 of file InfiniteLoopCheck.cpp.

◆ isChanged()

static bool clang::tidy::bugprone::isChanged ( const Stmt *  LoopStmt,
const VarDecl *  Var,
ASTContext *  Context 
)
static

Return whether Var was changed in LoopStmt.

Definition at line 31 of file InfiniteLoopCheck.cpp.

◆ isChangedBefore()

static bool clang::tidy::bugprone::isChangedBefore ( const Stmt *  S,
const Stmt *  NextS,
const Stmt *  PrevS,
const VarDecl *  Var,
ASTContext *  Context 
)
static

Returns whether Var is changed in range (PrevS..NextS).

Definition at line 33 of file RedundantBranchConditionCheck.cpp.

◆ isCorrectGivenLength()

static bool clang::tidy::bugprone::isCorrectGivenLength ( const MatchFinder::MatchResult &  Result)
static

Definition at line 248 of file NotNullTerminatedResultCheck.cpp.

◆ isDestAndSrcEquals()

static bool clang::tidy::bugprone::isDestAndSrcEquals ( const MatchFinder::MatchResult &  Result)
static

Definition at line 186 of file NotNullTerminatedResultCheck.cpp.

◆ isDestBasedOnGivenLength()

static bool clang::tidy::bugprone::isDestBasedOnGivenLength ( const MatchFinder::MatchResult &  Result)
static

Definition at line 175 of file NotNullTerminatedResultCheck.cpp.

◆ isDestCapacityFix()

static bool clang::tidy::bugprone::isDestCapacityFix ( const MatchFinder::MatchResult &  Result,
DiagnosticBuilder &  Diag 
)
static

Definition at line 398 of file NotNullTerminatedResultCheck.cpp.

◆ isDestCapacityOverflows()

static bool clang::tidy::bugprone::isDestCapacityOverflows ( const MatchFinder::MatchResult &  Result)
static

Definition at line 258 of file NotNullTerminatedResultCheck.cpp.

◆ isDestExprFix()

static bool clang::tidy::bugprone::isDestExprFix ( const MatchFinder::MatchResult &  Result,
DiagnosticBuilder &  Diag 
)
static

Definition at line 381 of file NotNullTerminatedResultCheck.cpp.

◆ isFirstWider()

static bool clang::tidy::bugprone::isFirstWider ( BuiltinType::Kind  First,
BuiltinType::Kind  Second 
)
static

◆ isFixedGivenLengthAndUnknownSrc()

static bool clang::tidy::bugprone::isFixedGivenLengthAndUnknownSrc ( const MatchFinder::MatchResult &  Result)
static

Definition at line 279 of file NotNullTerminatedResultCheck.cpp.

◆ isGivenLengthEqualToSrcLength()

static bool clang::tidy::bugprone::isGivenLengthEqualToSrcLength ( const MatchFinder::MatchResult &  Result)
static

Definition at line 221 of file NotNullTerminatedResultCheck.cpp.

◆ isImplicitCastCandidate()

static bool clang::tidy::bugprone::isImplicitCastCandidate ( const CastExpr *  Cast)
static

Restrict the warning to implicit casts that are most likely accidental.

User defined or integral conversions fit in this category, lvalue to rvalue or derived to base does not.

Definition at line 39 of file SwappedArgumentsCheck.cpp.

◆ isInjectUL()

static bool clang::tidy::bugprone::isInjectUL ( const MatchFinder::MatchResult &  Result)
static

Definition at line 164 of file NotNullTerminatedResultCheck.cpp.

◆ isKeyword()

static bool clang::tidy::bugprone::isKeyword ( const Token &  T)
static

Is given TokenKind a keyword?

Definition at line 55 of file MacroParenthesesCheck.cpp.

◆ isKnownDest()

static bool clang::tidy::bugprone::isKnownDest ( const MatchFinder::MatchResult &  Result)
static

Definition at line 169 of file NotNullTerminatedResultCheck.cpp.

◆ isKnownFalse()

static bool clang::tidy::bugprone::isKnownFalse ( const Expr &  Cond,
const ASTContext &  Ctx 
)
static

Definition at line 120 of file InfiniteLoopCheck.cpp.

◆ isLikelyTypo()

static bool clang::tidy::bugprone::isLikelyTypo ( llvm::ArrayRef< ParmVarDecl * >  Params,
StringRef  ArgName,
unsigned  ArgIndex 
)
static

Definition at line 143 of file ArgumentCommentCheck.cpp.

References E.

◆ isMaxValAllBitSetLiteral()

static bool clang::tidy::bugprone::isMaxValAllBitSetLiteral ( const EnumDecl *  EnumDec)
static

Definition at line 74 of file SuspiciousEnumUsageCheck.cpp.

Referenced by isPossiblyBitMask().

◆ isNonPowerOf2NorNullLiteral()

static bool clang::tidy::bugprone::isNonPowerOf2NorNullLiteral ( const EnumConstantDecl *  EnumConst)
static

Definition at line 64 of file SuspiciousEnumUsageCheck.cpp.

◆ isOverrideMethod()

static bool clang::tidy::bugprone::isOverrideMethod ( const CXXMethodDecl *  MD)
static

Finds out if the given method overrides some method.

Definition at line 30 of file VirtualNearMissCheck.cpp.

References clang::doc::MD().

◆ isParentOf()

static bool clang::tidy::bugprone::isParentOf ( const CXXRecordDecl &  Parent,
const CXXRecordDecl &  ThisClass 
)
static

Definition at line 26 of file ParentVirtualCallCheck.cpp.

References Base, and Parent.

◆ isPossiblyBitMask()

static bool clang::tidy::bugprone::isPossiblyBitMask ( const EnumDecl *  EnumDec)
static

Check if there is one or two enumerators that are not a power of 2 and are initialized by a literal in the enum type, and that the enumeration contains enough elements to reasonably act as a bitmask.

Exclude the case where the last enumerator is the sum of the lesser values (and initialized by a literal) or when it could contain consecutive values.

Definition at line 100 of file SuspiciousEnumUsageCheck.cpp.

References countNonPowOfTwoLiteralNum(), enumLength(), isMaxValAllBitSetLiteral(), clang::tidy::bugprone::ValueRange::MaxVal, and clang::tidy::bugprone::ValueRange::MinVal.

◆ isStandardSmartPointer()

bool clang::tidy::bugprone::isStandardSmartPointer ( const ValueDecl *  VD)

Definition at line 230 of file UseAfterMoveCheck.cpp.

References ID, Name, and Type.

◆ isStringDataAndLength()

static bool clang::tidy::bugprone::isStringDataAndLength ( const MatchFinder::MatchResult &  Result)
static

Definition at line 196 of file NotNullTerminatedResultCheck.cpp.

◆ isSurroundedLeft()

static bool clang::tidy::bugprone::isSurroundedLeft ( const Token &  T)
static

Is argument surrounded properly with parentheses/braces/squares/commas?

Definition at line 43 of file MacroParenthesesCheck.cpp.

◆ isSurroundedRight()

static bool clang::tidy::bugprone::isSurroundedRight ( const Token &  T)
static

Is argument surrounded properly with parentheses/braces/squares/commas?

Definition at line 49 of file MacroParenthesesCheck.cpp.

◆ isSystemCall()

static bool clang::tidy::bugprone::isSystemCall ( const FunctionDecl *  FD)
static

Definition at line 45 of file SignalHandlerCheck.cpp.

Referenced by AST_MATCHER().

◆ isValidBuiltinFold()

static bool clang::tidy::bugprone::isValidBuiltinFold ( const BuiltinType &  ValueType,
const BuiltinType &  InitType,
const ASTContext &  Context 
)
static

Returns true if ValueType is allowed to fold into InitType, i.e.

if: static_cast<InitType>(ValueType{some_value}) does not result in trucation.

Definition at line 79 of file FoldInitTypeCheck.cpp.

◆ isVarDeclKeyword()

static bool clang::tidy::bugprone::isVarDeclKeyword ( const Token &  T)
static

Is given Token a keyword that is used in variable declarations?

Definition at line 69 of file MacroParenthesesCheck.cpp.

◆ isVarThatIsPossiblyChanged()

static bool clang::tidy::bugprone::isVarThatIsPossiblyChanged ( const Decl Func,
const Stmt *  LoopStmt,
const Stmt *  Cond,
ASTContext *  Context 
)
static

Return whether Cond is a variable that is possibly changed in LoopStmt.

Definition at line 47 of file InfiniteLoopCheck.cpp.

◆ isWarnOp()

static bool clang::tidy::bugprone::isWarnOp ( const Token &  T)
static

Warning is written when one of these operators are not within parentheses.

Definition at line 61 of file MacroParenthesesCheck.cpp.

◆ lengthArgHandle()

static void clang::tidy::bugprone::lengthArgHandle ( LengthHandleKind  LengthHandle,
const MatchFinder::MatchResult &  Result,
DiagnosticBuilder &  Diag 
)
static

Definition at line 365 of file NotNullTerminatedResultCheck.cpp.

◆ lengthArgPosHandle()

static void clang::tidy::bugprone::lengthArgPosHandle ( unsigned  ArgPos,
LengthHandleKind  LengthHandle,
const MatchFinder::MatchResult &  Result,
DiagnosticBuilder &  Diag 
)
static

Definition at line 372 of file NotNullTerminatedResultCheck.cpp.

◆ lengthExprHandle()

static void clang::tidy::bugprone::lengthExprHandle ( const Expr *  LengthExpr,
LengthHandleKind  LengthHandle,
const MatchFinder::MatchResult &  Result,
DiagnosticBuilder &  Diag 
)
static

Definition at line 291 of file NotNullTerminatedResultCheck.cpp.

◆ looksLikeExpectMethod()

static bool clang::tidy::bugprone::looksLikeExpectMethod ( const CXXMethodDecl *  Expect)
static

Definition at line 185 of file ArgumentCommentCheck.cpp.

Referenced by areMockAndExpectMethods(), and findMockedMethod().

◆ loopEndingStmt()

static internal::Matcher<Stmt> clang::tidy::bugprone::loopEndingStmt ( internal::Matcher< Stmt >  Internal)
static

Definition at line 23 of file InfiniteLoopCheck.cpp.

◆ needsToElaborateImplicitConversion()

static bool clang::tidy::bugprone::needsToElaborateImplicitConversion ( const model::Mix M)
inlinestatic

Returns whether a particular Mix between the two parameters should have implicit conversions elaborated.

Definition at line 1933 of file EasilySwappableParametersCheck.cpp.

References clang::tidy::bugprone::model::hasFlag(), and M.

◆ needsToPrintTypeInDiagnostic()

static bool clang::tidy::bugprone::needsToPrintTypeInDiagnostic ( const model::Mix M)
inlinestatic

Returns whether a particular Mix between two parameters should have the types involved diagnosed to the user.

This is only a flag check.

Definition at line 1924 of file EasilySwappableParametersCheck.cpp.

References M.

◆ possibleVarDecl()

static bool clang::tidy::bugprone::possibleVarDecl ( const MacroInfo *  MI,
const Token *  Tok 
)
static

Is there a possible variable declaration at Tok?

Definition at line 77 of file MacroParenthesesCheck.cpp.

◆ relativeCharSizes()

static int clang::tidy::bugprone::relativeCharSizes ( BuiltinType::Kind  Kind)
static

Definition at line 129 of file MisplacedWideningCastCheck.cpp.

References Kind.

Referenced by isFirstWider().

◆ relativeCharSizesW()

static int clang::tidy::bugprone::relativeCharSizesW ( BuiltinType::Kind  Kind)
static

Definition at line 148 of file MisplacedWideningCastCheck.cpp.

References Kind.

Referenced by isFirstWider().

◆ relativeIntSizes()

static int clang::tidy::bugprone::relativeIntSizes ( BuiltinType::Kind  Kind)
static

Definition at line 94 of file MisplacedWideningCastCheck.cpp.

References Kind.

Referenced by isFirstWider().

◆ removeArg()

static void clang::tidy::bugprone::removeArg ( int  ArgPos,
const MatchFinder::MatchResult &  Result,
DiagnosticBuilder &  Diag 
)
static

Definition at line 408 of file NotNullTerminatedResultCheck.cpp.

◆ renameFunc()

static void clang::tidy::bugprone::renameFunc ( StringRef  NewFuncName,
const MatchFinder::MatchResult &  Result,
DiagnosticBuilder &  Diag 
)
static

Definition at line 423 of file NotNullTerminatedResultCheck.cpp.

◆ renameMemcpy()

static void clang::tidy::bugprone::renameMemcpy ( StringRef  Name,
bool  IsCopy,
bool  IsSafe,
const MatchFinder::MatchResult &  Result,
DiagnosticBuilder &  Diag 
)
static

Definition at line 438 of file NotNullTerminatedResultCheck.cpp.

◆ replaceMoveWithForward()

static void clang::tidy::bugprone::replaceMoveWithForward ( const UnresolvedLookupExpr *  Callee,
const ParmVarDecl *  ParmVar,
const TemplateTypeParmDecl *  TypeParmDecl,
DiagnosticBuilder &  Diag,
const ASTContext &  Context 
)
static

Definition at line 21 of file MoveForwardingReferenceCheck.cpp.

◆ reportDiagnostic()

template<typename T >
void clang::tidy::bugprone::reportDiagnostic ( DiagnosticBuilder  D,
const T *  Node,
SourceRange  SR,
bool  DefaultConstruction 
)

Definition at line 41 of file UnusedRaiiCheck.cpp.

◆ resolveMocks()

static const FunctionDecl* clang::tidy::bugprone::resolveMocks ( const FunctionDecl *  Func)
static

Definition at line 230 of file ArgumentCommentCheck.cpp.

References findMockedMethod().

◆ sameName()

static bool clang::tidy::bugprone::sameName ( StringRef  InComment,
StringRef  InDecl,
bool  StrictMode 
)
static

Definition at line 176 of file ArgumentCommentCheck.cpp.

◆ startsWithUnderscoreCapital()

static bool clang::tidy::bugprone::startsWithUnderscoreCapital ( StringRef  Name)
static

Definition at line 78 of file ReservedIdentifierCheck.cpp.

References Name.

Referenced by getUnderscoreCapitalFixup().

◆ startsWithUnderscoreInGlobalNamespace()

static bool clang::tidy::bugprone::startsWithUnderscoreInGlobalNamespace ( StringRef  Name,
bool  IsInGlobalNamespace 
)
static

Definition at line 88 of file ReservedIdentifierCheck.cpp.

References Name.

Referenced by getUnderscoreGlobalNamespaceFixup().

◆ tryEvaluateSizeExpr()

static llvm::Optional<uint64_t> clang::tidy::bugprone::tryEvaluateSizeExpr ( const Expr *  SizeExpr,
const ASTContext &  Ctx 
)
static

Definition at line 19 of file SuspiciousMemoryComparisonCheck.cpp.

Variable Documentation

◆ BitmaskErrorMessage

const char clang::tidy::bugprone::BitmaskErrorMessage[]
static
Initial value:
=
"enum type seems like a bitmask (contains mostly "
"power-of-2 literals), but this literal is not a "
"power-of-2"

Definition at line 23 of file SuspiciousEnumUsageCheck.cpp.

◆ BitmaskNoteMessage

const char clang::tidy::bugprone::BitmaskNoteMessage[] = "used here as a bitmask"
static

Definition at line 33 of file SuspiciousEnumUsageCheck.cpp.

◆ BitmaskVarErrorMessage

const char clang::tidy::bugprone::BitmaskVarErrorMessage[]
static
Initial value:
=
"enum type seems like a bitmask (contains mostly "
"power-of-2 literals) but %plural{1:a literal is|:some literals are}0 not "
"power-of-2"

Definition at line 28 of file SuspiciousEnumUsageCheck.cpp.

◆ CastExprName

constexpr llvm::StringLiteral clang::tidy::bugprone::CastExprName = "CastExpr"
constexpr

Definition at line 24 of file NotNullTerminatedResultCheck.cpp.

◆ CondVarStr

const char clang::tidy::bugprone::CondVarStr[] = "cond_var"
static

Definition at line 23 of file RedundantBranchConditionCheck.cpp.

◆ DestArrayTyName

constexpr llvm::StringLiteral clang::tidy::bugprone::DestArrayTyName = "DestArrayTy"
constexpr

Definition at line 26 of file NotNullTerminatedResultCheck.cpp.

◆ DestExprName

constexpr llvm::StringLiteral clang::tidy::bugprone::DestExprName = "DestExpr"
constexpr

Definition at line 29 of file NotNullTerminatedResultCheck.cpp.

◆ DestMallocExprName

constexpr llvm::StringLiteral clang::tidy::bugprone::DestMallocExprName = "DestMalloc"
constexpr

Definition at line 28 of file NotNullTerminatedResultCheck.cpp.

◆ DestVarDeclName

constexpr llvm::StringLiteral clang::tidy::bugprone::DestVarDeclName = "DestVarDecl"
constexpr

Definition at line 27 of file NotNullTerminatedResultCheck.cpp.

◆ DifferentEnumErrorMessage

const char clang::tidy::bugprone::DifferentEnumErrorMessage[]
static
Initial value:
=
"enum values are from different enum types"

Definition at line 20 of file SuspiciousEnumUsageCheck.cpp.

◆ DoubleUnderscoreTag

const char clang::tidy::bugprone::DoubleUnderscoreTag[] = "du"
static

Definition at line 26 of file ReservedIdentifierCheck.cpp.

◆ FuncStr

const char clang::tidy::bugprone::FuncStr[] = "func"
static

Definition at line 30 of file RedundantBranchConditionCheck.cpp.

◆ FunctionExprName

constexpr llvm::StringLiteral clang::tidy::bugprone::FunctionExprName = "FunctionExpr"
constexpr

Definition at line 23 of file NotNullTerminatedResultCheck.cpp.

◆ GlobalUnderscoreTag

const char clang::tidy::bugprone::GlobalUnderscoreTag[] = "global-under"
static

Definition at line 28 of file ReservedIdentifierCheck.cpp.

Referenced by getMessageSelectIndex().

◆ InnerIfStr

const char clang::tidy::bugprone::InnerIfStr[] = "inner_if"
static

Definition at line 25 of file RedundantBranchConditionCheck.cpp.

◆ InnerIfVar1Str

const char clang::tidy::bugprone::InnerIfVar1Str[] = "inner_if_var1"
static

Definition at line 28 of file RedundantBranchConditionCheck.cpp.

◆ InnerIfVar2Str

const char clang::tidy::bugprone::InnerIfVar2Str[] = "inner_if_var2"
static

Definition at line 29 of file RedundantBranchConditionCheck.cpp.

◆ KnownStringCompareFunctions

const char clang::tidy::bugprone::KnownStringCompareFunctions[]
static

Definition at line 24 of file SuspiciousStringCompareCheck.cpp.

◆ LengthExprName

constexpr llvm::StringLiteral clang::tidy::bugprone::LengthExprName = "LengthExpr"
constexpr

Definition at line 32 of file NotNullTerminatedResultCheck.cpp.

◆ LoopIncrementName

constexpr llvm::StringLiteral clang::tidy::bugprone::LoopIncrementName
staticconstexpr
Initial value:
=
llvm::StringLiteral("loopIncrement")

Definition at line 27 of file TooSmallLoopVariableCheck.cpp.

◆ LoopName

constexpr llvm::StringLiteral clang::tidy::bugprone::LoopName
staticconstexpr
Initial value:
=
llvm::StringLiteral("forLoopName")

Definition at line 19 of file TooSmallLoopVariableCheck.cpp.

◆ LoopUpperBoundName

constexpr llvm::StringLiteral clang::tidy::bugprone::LoopUpperBoundName
staticconstexpr
Initial value:
=
llvm::StringLiteral("loopUpperBound")

Definition at line 25 of file TooSmallLoopVariableCheck.cpp.

◆ LoopVarCastName

constexpr llvm::StringLiteral clang::tidy::bugprone::LoopVarCastName
staticconstexpr
Initial value:
=
llvm::StringLiteral("loopVarCast")

Definition at line 23 of file TooSmallLoopVariableCheck.cpp.

◆ LoopVarName

constexpr llvm::StringLiteral clang::tidy::bugprone::LoopVarName
staticconstexpr
Initial value:
=
llvm::StringLiteral("loopVar")

Definition at line 21 of file TooSmallLoopVariableCheck.cpp.

◆ Message

const char clang::tidy::bugprone::Message[]
static
Initial value:
=
"declaration uses identifier '%0', which is %select{a reserved "
"identifier|not a reserved identifier|reserved in the global namespace}1"

Definition at line 31 of file ReservedIdentifierCheck.cpp.

Referenced by clang::pp_trace::error(), clang::clangd::remote::Marshaller::fromProtobuf(), and clang::clangd::trace::log().

◆ NonReservedTag

const char clang::tidy::bugprone::NonReservedTag[] = "non-reserved"
static

Definition at line 29 of file ReservedIdentifierCheck.cpp.

Referenced by getMessageSelectIndex().

◆ OuterIfStr

const char clang::tidy::bugprone::OuterIfStr[] = "outer_if"
static

Definition at line 24 of file RedundantBranchConditionCheck.cpp.

◆ OuterIfVar1Str

const char clang::tidy::bugprone::OuterIfVar1Str[] = "outer_if_var1"
static

Definition at line 26 of file RedundantBranchConditionCheck.cpp.

◆ OuterIfVar2Str

const char clang::tidy::bugprone::OuterIfVar2Str[] = "outer_if_var2"
static

Definition at line 27 of file RedundantBranchConditionCheck.cpp.

◆ PP

Preprocessor* clang::tidy::bugprone::PP
static

◆ SrcExprName

constexpr llvm::StringLiteral clang::tidy::bugprone::SrcExprName = "SrcExpr"
constexpr

Definition at line 31 of file NotNullTerminatedResultCheck.cpp.

◆ SrcVarDeclName

constexpr llvm::StringLiteral clang::tidy::bugprone::SrcVarDeclName = "SrcVarDecl"
constexpr

Definition at line 30 of file NotNullTerminatedResultCheck.cpp.

◆ UnderscoreCapitalTag

const char clang::tidy::bugprone::UnderscoreCapitalTag[] = "uc"
static

Definition at line 27 of file ReservedIdentifierCheck.cpp.

◆ UnknownDestName

constexpr llvm::StringLiteral clang::tidy::bugprone::UnknownDestName = "UnknownDest"
constexpr

Definition at line 25 of file NotNullTerminatedResultCheck.cpp.

◆ UnknownLengthName

constexpr llvm::StringLiteral clang::tidy::bugprone::UnknownLengthName = "UnknownLength"
constexpr

Definition at line 34 of file NotNullTerminatedResultCheck.cpp.

◆ UnsignedASCIIUpperBound

constexpr int clang::tidy::bugprone::UnsignedASCIIUpperBound = 127
staticconstexpr

Definition at line 21 of file SignedCharMisuseCheck.cpp.

◆ WrongLengthExprName

constexpr llvm::StringLiteral clang::tidy::bugprone::WrongLengthExprName = "WrongLength"
constexpr

Definition at line 33 of file NotNullTerminatedResultCheck.cpp.