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

Namespaces

namespace  filter
namespace  model

Classes

class  ArgumentCommentCheck
class  AssertSideEffectCheck
 Finds assert() with side effect. More...
class  AssignmentInIfConditionCheck
 Catches assignments within the condition clause of an if statement. More...
class  BadSignalToKillThreadCheck
 Finds pthread_kill function calls when thread is terminated by / SIGTERM signal. More...
class  BitwisePointerCastCheck
 Warns about code that tries to cast between pointers by means of std::bit_cast or memcpy. 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  CapturingThisInMemberVariableCheck
 Finds lambda captures that capture the this pointer and store it as class members without handle the copy and move constructors and the assignments. More...
class  CastingThroughVoidCheck
 Detects unsafe or redundant two-step casting operations involving void*. More...
class  ChainedComparisonCheck
 Check detects chained comparison operators that can lead to unintended behavior or logical errors. More...
class  CharExpressionDetector
class  CommandProcessorCheck
 Execution of a command processor can lead to security vulnerabilities, and is generally not required. More...
class  ComparePointerToMemberVirtualFunctionCheck
 Detects unspecified behavior about equality comparison between pointer to member virtual function and anything other than null-pointer-constant. More...
class  CopyConstructorInitCheck
 Finds copy constructors where the ctor don't call the copy constructor of the base class. More...
class  CrtpConstructorAccessibilityCheck
 Detects error-prone Curiously Recurring Template Pattern usage, when the CRTP can be constructed outside itself and the derived class. More...
class  DanglingHandleCheck
 Detect dangling references in value handlers like std::string_view. More...
class  DerivedMethodShadowingBaseMethodCheck
 Checks that a derived class does not define the same (non virtual) method as a base class. 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  EmptyCatchCheck
 Detects and suggests addressing issues with empty catch statements. 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  IncDecInConditionsCheck
 Detects when a variable is both incremented/decremented and referenced inside a complex condition and suggests moving them outside to avoid ambiguity in the variable's value. More...
class  IncorrectEnableIfCheck
 Detects incorrect usages of std::enable_if that don't name the nested / type type. More...
class  IncorrectEnableSharedFromThisCheck
 Detect classes or structs that do not publicly inherit from std::enable_shared_from_this, because unintended behavior will / otherwise occur when calling shared_from_this. 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  InvalidEnumDefaultInitializationCheck
 Detects default initialization (to 0) of variables with enum type where the enum has no enumerator with value of 0. 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  MisleadingSetterOfReferenceCheck
 Emits a warning when a setter-like function that has a pointer parameter is used to set value of a field with reference type. 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  MultiLevelImplicitPointerConversionCheck
 Detects implicit conversions between pointers of different levels of indirection. More...
class  MultipleNewInOneExpressionCheck
 For the user-facing documentation see: https://clang.llvm.org/extra/clang-tidy/checks/bugprone/multiple-new-in-one-expression.html. More...
class  MultipleStatementMacroCheck
 Detect multiple statement macros that are used in unbraced conditionals. More...
class  NarrowingConversionsCheck
 Checks for narrowing conversions, e.g: int i = 0; i += 0.1;. More...
class  NoEscapeCheck
 Block arguments in dispatch_async() and dispatch_after() are guaranteed to escape. More...
class  NondeterministicPointerIterationOrderCheck
 Finds nondeterministic usages of pointers in unordered containers. More...
class  NonZeroEnumToBoolConversionCheck
 Detect implicit and explicit casts of enum type into bool where enum type doesn't have a zero-value enumerator. More...
class  NotNullTerminatedResultCheck
 Finds function calls where it is possible to cause a not null-terminated result. More...
class  OptionalValueConversionCheck
 Detects potentially unintentional and redundant conversions where a value is extracted from an optional-like type and then used to create a new instance of the same optional-like type. More...
class  ParentVirtualCallCheck
 Finds calls to grand..-parent virtual methods instead of parent's. More...
class  PointerArithmeticOnPolymorphicObjectCheck
 Finds pointer arithmetic performed on classes that contain a virtual function. 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  ReturnConstRefFromParameterCheck
 Detects return statements that return a constant reference parameter as constant reference. More...
class  SharedPtrArrayMismatchCheck
 Find std::shared_ptr<T>(new T[...]), replace it (if applicable) with std::shared_ptr<T[]>(new T[...]). 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 expressions. More...
class  SmartPtrArrayMismatchCheck
 Find constructions of smart (unique or shared) pointers where the pointer is declared with non-array target type and an array (created with a new-expression) is passed to it. 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  StandaloneEmptyCheck
 Checks for ignored calls to empty() on a range and suggests clear() as an alternative if it is an existing member function. 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  StringviewNullptrCheck
 Checks for various ways that the const CharT* constructor of std::basic_string_view can be passed a null argument and replaces them with the default constructor in most cases. 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  SuspiciousReallocUsageCheck
 Finds usages of realloc where the return value is assigned to the same variable as passed to the first argument. 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  SuspiciousStringviewDataUsageCheck
 Identifies suspicious usages of std::string_view::data() that could lead to reading out-of-bounds data due to inadequate or incorrect string null termination. More...
class  SwappedArgumentsCheck
 Finds potentially swapped arguments by looking at implicit conversions. More...
class  SwitchMissingDefaultCaseCheck
 Ensures that switch statements without default cases are flagged, focuses only on covering cases with non-enums where the compiler may not issue warnings. More...
class  TaggedUnionMemberCountCheck
 Gives warnings for tagged unions, where the number of tags is different from the number of data members inside the union. More...
class  TerminatingContinueCheck
 Checks if a 'continue' statement terminates the loop (i.e. More...
class  ThrowingStaticInitializationCheck
 Checks whether the constructor for a static or thread_local object will throw. 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  UncheckedOptionalAccessCheck
 Warns when the code is unwrapping a std::optional<T>, absl::optional<T>, or base::std::optional<T> object without assuring that it contains a value. More...
class  UncheckedStringToNumberConversionCheck
 Guards against use of string conversion functions that do not have reasonable error handling for conversion errors. More...
class  UndefinedMemoryManipulationCheck
 Finds calls of memory manipulation functions memset(), memcpy() and / memmove() on non-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  UnintendedCharOstreamOutputCheck
 Finds unintended character output from unsigned char and signed char to an ostream. More...
class  UniquePtrArrayMismatchCheck
 Finds initializations of C++ unique pointers to non-array type that are initialized with an array. More...
class  UnsafeFunctionsCheck
 Checks for functions that have safer, more secure replacements available, or are considered deprecated due to design flaws. More...
class  UnusedLocalNonTrivialVariableCheck
 Warns when a local non trivial variable is unused within a function. 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 class  LengthHandleKind { Increase , Decrease }
enum class  MoveType { Move , Forward }

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)
*that are placed right before the argument **code *void f (bool foo)
 Checks that argument comments match parameter names.
*** f (true)
static void checkImpl (const MatchFinder::MatchResult &Result, const Expr *Ref, const IfStmt *If, const ast_matchers::internal::Matcher< Expr > &RefMatcher, ClangTidyCheck &Check)
static bool isIdenticalStmt (const ASTContext &Ctx, const Stmt *Stmt1, const Stmt *Stmt2, bool IgnoreSideEffects)
 Determines whether two statement trees are identical regarding operators and symbols.
static bool isExprAComparisonOperator (const Expr *E)
static bool hasPrivateConstructor (const CXXRecordDecl *RD)
static bool isDerivedParameterBefriended (const CXXRecordDecl *CRTP, const NamedDecl *Param)
static bool isDerivedClassBefriended (const CXXRecordDecl *CRTP, const CXXRecordDecl *Derived)
static const NamedDecl * getDerivedParameter (const ClassTemplateSpecializationDecl *CRTP, const CXXRecordDecl *Derived)
static std::vector< FixItHint > hintMakeCtorPrivate (const CXXConstructorDecl *Ctor, const std::string &OriginalAccess)
static bool sameBasicType (const ParmVarDecl *Lhs, const ParmVarDecl *Rhs)
static bool namesCollide (const CXXMethodDecl &Lhs, const CXXMethodDecl &Rhs)
static unsigned clampMinimumLength (const unsigned Value)
 Returns the DefaultMinimumLength if the Value of requested minimum length is less than 2.
static SmallString< 64 > getName (const NamedDecl *ND)
 Returns the diagnostic-friendly name of the node, or empty string.
static SmallString< 64 > getNameOrUnnamed (const NamedDecl *ND)
 Returns the diagnostic-friendly name of the node, or a constant value.
static bool needsToPrintTypeInDiagnostic (const model::Mix &M)
 Returns whether a particular Mix between two parameters should have the types involved diagnosed to the user.
static bool needsToElaborateImplicitConversion (const model::Mix &M)
 Returns whether a particular Mix between the two parameters should have implicit conversions elaborated.
static bool isValidBuiltinFold (const BuiltinType &ValueType, const BuiltinType &InitType, const ASTContext &Context)
 Returns true if ValueType is allowed to fold into InitType, i.e.
static bool haveSameNamespaceOrTranslationUnit (const CXXRecordDecl *Decl1, const CXXRecordDecl *Decl2)
static std::string getNameOfNamespace (const CXXRecordDecl *Decl)
static const Expr * getLHSOfMulBinOp (const Expr *E)
static llvm::APFloat getHalf (const llvm::fltSemantics &Semantics)
static Matcher< Stmt > loopEndingStmt (Matcher< Stmt > Internal)
static bool isChanged (const Stmt *LoopStmt, const ValueDecl *Var, ASTContext *Context)
 Return whether Var was changed in LoopStmt.
static bool isVarPossiblyChanged (const Decl *Func, const Stmt *LoopStmt, const ValueDecl *VD, ASTContext *Context)
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.
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.
static std::string getCondVarNames (const Stmt *Cond)
 Return the variable names in Cond.
static bool isKnownToHaveValue (const Expr &Cond, const ASTContext &Ctx, bool ExpectedValue)
static bool populateCallees (const Stmt *StmtNode, llvm::SmallPtrSet< const Decl *, 16 > &Callees)
 populates the set Callees with all function (and objc method) declarations called in StmtNode if all visited call sites have resolved call targets.
static bool overlap (ArrayRef< CallGraphNode * > SCC, const llvm::SmallPtrSet< const Decl *, 16 > &Callees, const Decl *Func)
 returns true iff SCC contains Func and its' function set overlaps with Callees
static bool hasStaticLocalVariable (const Stmt *Cond)
 returns true iff Cond involves at least one static local variable.
static bool hasRecursionOverStaticLoopCondVariables (const Expr *Cond, const Stmt *LoopStmt, const Decl *Func, const ASTContext *Ctx)
 Tests if the loop condition Cond involves static local variables and the enclosing function Func is recursive.
static bool isSurroundedLeft (const Token &T)
 Is argument surrounded properly with parentheses/braces/squares/commas?
static bool isSurroundedRight (const Token &T)
 Is argument surrounded properly with parentheses/braces/squares/commas?
static bool isKeyword (const Token &T)
 Is given TokenKind a keyword?
static bool isWarnOp (const Token &T)
 Warning is written when one of these operators are not within parentheses.
static bool isVarDeclKeyword (const Token &T)
 Is given Token a keyword that is used in variable declarations?
static bool possibleVarDecl (const MacroInfo *MI, const Token *Tok)
 Is there a possible variable declaration at Tok?
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 unsigned getPointerLevel (const QualType &PtrType)
static bool isExprValueStored (const Expr *E, ASTContext &C)
static const BuiltinType * getBuiltinType (const Expr &E)
static QualType getUnqualifiedType (const Expr &E)
static APValue getConstantExprValue (const ASTContext &Ctx, const Expr &E)
static bool getIntegerConstantExprValue (const ASTContext &Context, const Expr &E, llvm::APSInt &Value)
static bool getFloatingConstantExprValue (const ASTContext &Context, const Expr &E, llvm::APFloat &Value)
static IntegerRange createFromType (const ASTContext &Context, const BuiltinType &T)
static bool isWideEnoughToHold (const ASTContext &Context, const BuiltinType &FromType, const BuiltinType &ToType)
static bool isWideEnoughToHold (const ASTContext &Context, const llvm::APSInt &IntegerConstant, const BuiltinType &ToType)
static bool isFloatExactlyRepresentable (const ASTContext &Context, const llvm::APFloat &FloatConstant, const QualType &DestType)
static llvm::SmallString< 64 > getValueAsString (const llvm::APSInt &Value, uint64_t HexBits)
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)
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).
static int getMessageSelectIndex (StringRef Tag)
static std::string collapseConsecutive (StringRef Str, char C)
static bool hasReservedDoubleUnderscore (StringRef Name, const LangOptions &LangOpts)
static std::optional< std::string > getDoubleUnderscoreFixup (StringRef Name, const LangOptions &LangOpts)
static bool startsWithUnderscoreCapital (StringRef Name)
static std::optional< std::string > getUnderscoreCapitalFixup (StringRef Name)
static bool startsWithUnderscoreInGlobalNamespace (StringRef Name, bool IsInGlobalNamespace, bool IsMacro)
static std::optional< std::string > getUnderscoreGlobalNamespaceFixup (StringRef Name, bool IsInGlobalNamespace, bool IsMacro)
static std::string getNonReservedFixup (std::string Name)
static std::optional< RenamerClangTidyCheck::FailureInfogetFailureInfoImpl (StringRef Name, bool IsInGlobalNamespace, bool IsMacro, const LangOptions &LangOpts, bool Invert, ArrayRef< llvm::Regex > AllowedIdentifiers)
static bool isSameTypeIgnoringConst (QualType A, QualType B)
static bool isSameTypeIgnoringConstRef (QualType A, QualType B)
static bool hasSameParameterTypes (const FunctionDecl &FD, const FunctionDecl &O, const ParmVarDecl &PD)
static const Decl * findRVRefOverload (const FunctionDecl &FD, const ParmVarDecl &PD)
static const Expr * getCondition (const BoundNodes &Nodes, const StringRef NodeId)
static RewriteRuleWith< std::string > stringviewNullptrCheckImpl ()
static int enumLength (const EnumDecl *EnumDec)
 Return the number of EnumConstantDecls in an EnumDecl.
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.
static std::optional< uint64_t > tryEvaluateSizeExpr (const Expr *SizeExpr, const ASTContext &Ctx)
static bool isConcatenatedLiteralsOnPurpose (ASTContext *Ctx, const StringLiteral *Lit)
static const Expr * ignoreNoOpCasts (const Expr *E)
 Look through lvalue to rvalue and nop casts.
static bool isImplicitCastCandidate (const CastExpr *Cast)
 Restrict the warning to implicit casts that are most likely accidental.
static bool areTypesSemiEqual (const QualType L, const QualType R)
static bool areArgumentsPotentiallySwapped (const QualType LTo, const QualType RTo, const QualType LFrom, const QualType RFrom)
static MagnitudeBits calcMagnitudeBits (const ASTContext &Context, const QualType &IntExprType, const Expr *IntExpr)
 Returns the magnitude bits of an integer type.
static MagnitudeBits 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.
static std::string formatIntegralType (const QualType &Type, const MagnitudeBits &Info)
static constexpr llvm::StringLiteral FuncID ("fun")
static ConversionKind classifyConversionFunc (const FunctionDecl *FD)
static ConversionKind classifyFormatString (StringRef Fmt, const LangOptions &LO, const TargetInfo &TI)
static StringRef classifyConversionType (ConversionKind K)
static StringRef classifyReplacement (ConversionKind K)
static std::optional< std::string > getAnnexKReplacementFor (StringRef FunctionName)
static StringRef getReplacementFor (StringRef FunctionName, bool IsAnnexKAvailable)
static StringRef getReplacementForAdditional (StringRef FunctionName, bool IsAnnexKAvailable)
static StringRef getRationaleFor (StringRef FunctionName)
static bool isAnnexKAvailable (std::optional< bool > &CacheVar, Preprocessor *PP, const LangOptions &LO)
 Calculates whether Annex K is available for the current translation unit based on the macro definitions and the language options.
static std::vector< UnsafeFunctionsCheck::CheckedFunctionparseCheckedFunctions (StringRef Option, ClangTidyContext *Context)
static std::string serializeCheckedFunctions (const std::vector< UnsafeFunctionsCheck::CheckedFunction > &Functions)
template<typename T>
static void reportDiagnostic (DiagnosticBuilder D, const T *Node, SourceRange SR, bool DefaultConstruction)
static StatementMatcher inDecltypeOrTemplateArg ()
static bool isStandardSmartPointer (const ValueDecl *VD)
static MoveType determineMoveType (const FunctionDecl *FuncDecl)
static void emitDiagnostic (const Expr *MovingCall, const DeclRefExpr *MoveArg, const UseAfterMove &Use, ClangTidyCheck *Check, ASTContext *Context, MoveType Type)
static bool isOverrideMethod (const CXXMethodDecl *MD)
 Finds out if the given method overrides some method.
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.
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.

Variables

static Preprocessor * PP
constexpr const char * DefaultFunctionWrapperTypes
constexpr const char * DefaultBindFunctions
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 StrictModeOptionName = "StrictMode"
static constexpr llvm::StringLiteral EnableCountingEnumHeuristicOptionName
static constexpr llvm::StringLiteral CountingEnumPrefixesOptionName
static constexpr llvm::StringLiteral CountingEnumSuffixesOptionName
static constexpr bool StrictModeOptionDefaultValue = false
static constexpr bool EnableCountingEnumHeuristicOptionDefaultValue = true
static constexpr llvm::StringLiteral CountingEnumPrefixesOptionDefaultValue
static constexpr llvm::StringLiteral CountingEnumSuffixesOptionDefaultValue
static constexpr llvm::StringLiteral RootMatchBindName = "root"
static constexpr llvm::StringLiteral UnionMatchBindName = "union"
static constexpr llvm::StringLiteral TagMatchBindName = "tags"
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
static constexpr llvm::StringLiteral OptionNameCustomFunctions
static constexpr llvm::StringLiteral OptionNameReportDefaultFunctions
static constexpr llvm::StringLiteral OptionNameReportMoreUnsafeFunctions
static constexpr llvm::StringLiteral FunctionNamesWithAnnexKReplacementId
static constexpr llvm::StringLiteral FunctionNamesId = "FunctionsNames"
static constexpr llvm::StringLiteral AdditionalFunctionNamesId
static constexpr llvm::StringLiteral CustomFunctionNamesId
static constexpr llvm::StringLiteral DeclRefId = "DRE"

Typedef Documentation

◆ BasesVector

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

Definition at line 21 of file ParentVirtualCallCheck.cpp.

◆ TheCheck

Enumeration Type Documentation

◆ LengthHandleKind

Enumerator
Increase 
Decrease 

Definition at line 35 of file NotNullTerminatedResultCheck.cpp.

◆ MoveType

Enumerator
Move 
Forward 

Definition at line 391 of file UseAfterMoveCheck.cpp.

Function Documentation

◆ areArgumentsPotentiallySwapped()

bool clang::tidy::bugprone::areArgumentsPotentiallySwapped ( const QualType LTo,
const QualType RTo,
const QualType LFrom,
const QualType RFrom )
static

◆ areMockAndExpectMethods()

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().

◆ areTypesSemiEqual()

bool clang::tidy::bugprone::areTypesSemiEqual ( const QualType L,
const QualType R )
static

Definition at line 50 of file SwappedArgumentsCheck.cpp.

Referenced by areArgumentsPotentiallySwapped().

◆ calcMagnitudeBits()

MagnitudeBits clang::tidy::bugprone::calcMagnitudeBits ( const ASTContext & Context,
const QualType & IntExprType,
const Expr * IntExpr )
static

Returns the magnitude bits of an integer type.

Definition at line 119 of file TooSmallLoopVariableCheck.cpp.

Referenced by calcUpperBoundMagnitudeBits(), and clang::tidy::bugprone::TooSmallLoopVariableCheck::check().

◆ calcUpperBoundMagnitudeBits()

MagnitudeBits 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 138 of file TooSmallLoopVariableCheck.cpp.

References calcMagnitudeBits().

Referenced by clang::tidy::bugprone::TooSmallLoopVariableCheck::check().

◆ checkImpl()

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

◆ checkOverrideByDerivedMethod()

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 167 of file VirtualNearMissCheck.cpp.

◆ checkOverrideWithoutName()

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 147 of file VirtualNearMissCheck.cpp.

References checkOverridingFunctionReturnType(), and checkParamTypes().

Referenced by clang::tidy::bugprone::VirtualNearMissCheck::check().

◆ checkOverridingFunctionReturnType()

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 37 of file VirtualNearMissCheck.cpp.

Referenced by checkOverrideWithoutName().

◆ checkParamTypes()

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

Definition at line 129 of file VirtualNearMissCheck.cpp.

References getDecayedType().

Referenced by checkOverrideWithoutName().

◆ clampMinimumLength()

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 1921 of file EasilySwappableParametersCheck.cpp.

References DefaultMinimumLength.

Referenced by clang::tidy::bugprone::EasilySwappableParametersCheck::EasilySwappableParametersCheck().

◆ classifyConversionFunc()

ConversionKind clang::tidy::bugprone::classifyConversionFunc ( const FunctionDecl * FD)
static

◆ classifyConversionType()

StringRef clang::tidy::bugprone::classifyConversionType ( ConversionKind K)
static

◆ classifyFormatString()

ConversionKind clang::tidy::bugprone::classifyFormatString ( StringRef Fmt,
const LangOptions & LO,
const TargetInfo & TI )
static

◆ classifyReplacement()

StringRef clang::tidy::bugprone::classifyReplacement ( ConversionKind K)
static

◆ collapseConsecutive()

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

Definition at line 71 of file ReservedIdentifierCheck.cpp.

Referenced by getDoubleUnderscoreFixup().

◆ countNonPowOfTwoLiteralNum()

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

Definition at line 87 of file SuspiciousEnumUsageCheck.cpp.

References isNonPowerOf2NorNullLiteral().

Referenced by isPossiblyBitMask().

◆ createFromType()

IntegerRange clang::tidy::bugprone::createFromType ( const ASTContext & Context,
const BuiltinType & T )
static

Definition at line 243 of file NarrowingConversionsCheck.cpp.

Referenced by isWideEnoughToHold(), and isWideEnoughToHold().

◆ determineMoveType()

MoveType clang::tidy::bugprone::determineMoveType ( const FunctionDecl * FuncDecl)
static

◆ emitDiagnostic()

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

◆ enumLength()

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

Return the number of EnumConstantDecls in an EnumDecl.

Definition at line 51 of file SuspiciousEnumUsageCheck.cpp.

Referenced by isPossiblyBitMask().

◆ exprLocEnd()

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

◆ exprToStr()

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

◆ f() [1/2]

*that are placed right before the argument **code *void clang::tidy::bugprone::f ( bool foo)

Checks that argument comments match parameter names.

The check understands argument comments in the form `/*parameter_name=

◆ f() [2/2]

*** clang::tidy::bugprone::f ( true )

◆ findMockedMethod()

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

Definition at line 205 of file ArgumentCommentCheck.cpp.

References areMockAndExpectMethods(), and looksLikeExpectMethod().

Referenced by resolveMocks().

◆ findRVRefOverload()

const Decl * clang::tidy::bugprone::findRVRefOverload ( const FunctionDecl & FD,
const ParmVarDecl & PD )
static

◆ formatIntegralType()

std::string clang::tidy::bugprone::formatIntegralType ( const QualType & Type,
const MagnitudeBits & Info )
static

◆ FuncID()

constexpr llvm::StringLiteral clang::tidy::bugprone::FuncID ( "fun" )
staticconstexpr

◆ getAnnexKReplacementFor()

std::optional< std::string > clang::tidy::bugprone::getAnnexKReplacementFor ( StringRef FunctionName)
static

◆ getBuiltinType()

const BuiltinType * clang::tidy::bugprone::getBuiltinType ( const Expr & E)
static

Definition at line 189 of file NarrowingConversionsCheck.cpp.

◆ getCommentsBeforeLoc()

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

◆ getCommentsInRange()

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

Definition at line 81 of file ArgumentCommentCheck.cpp.

◆ getCondition()

const Expr * clang::tidy::bugprone::getCondition ( const BoundNodes & Nodes,
const StringRef NodeId )
static

◆ getCondVarNames()

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

Return the variable names in Cond.

Definition at line 133 of file InfiniteLoopCheck.cpp.

References getCondVarNames().

Referenced by clang::tidy::bugprone::InfiniteLoopCheck::check(), and getCondVarNames().

◆ getConstantExprValue()

APValue clang::tidy::bugprone::getConstantExprValue ( const ASTContext & Ctx,
const Expr & E )
static

◆ getDecayedType()

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

Definition at line 122 of file VirtualNearMissCheck.cpp.

Referenced by checkParamTypes().

◆ getDerivedParameter()

const NamedDecl * clang::tidy::bugprone::getDerivedParameter ( const ClassTemplateSpecializationDecl * CRTP,
const CXXRecordDecl * Derived )
static

◆ getDestCapacity()

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

Definition at line 95 of file NotNullTerminatedResultCheck.cpp.

References getDestCapacityExpr(), and getLength().

Referenced by insertDestCapacityArg().

◆ getDestCapacityExpr()

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

◆ getDoubleUnderscoreFixup()

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

Definition at line 86 of file ReservedIdentifierCheck.cpp.

References collapseConsecutive(), and hasReservedDoubleUnderscore().

Referenced by getFailureInfoImpl().

◆ getExprAsString()

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

◆ getFailureInfoImpl()

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

◆ getFloatingConstantExprValue()

bool clang::tidy::bugprone::getFloatingConstantExprValue ( const ASTContext & Context,
const Expr & E,
llvm::APFloat & Value )
static

Definition at line 215 of file NarrowingConversionsCheck.cpp.

References getConstantExprValue().

◆ getFunctionSpelling()

StringRef clang::tidy::bugprone::getFunctionSpelling ( const MatchFinder::MatchResult & Result)
static

Definition at line 19 of file PosixReturnCheck.cpp.

Referenced by clang::tidy::bugprone::PosixReturnCheck::check().

◆ getGivenLength()

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

◆ getHalf()

llvm::APFloat clang::tidy::bugprone::getHalf ( const llvm::fltSemantics & Semantics)
static

Definition at line 17 of file IncorrectRoundingsCheck.cpp.

◆ getIntegerConstantExprValue()

bool clang::tidy::bugprone::getIntegerConstantExprValue ( const ASTContext & Context,
const Expr & E,
llvm::APSInt & Value )
static

Definition at line 206 of file NarrowingConversionsCheck.cpp.

References getConstantExprValue().

◆ getLength()

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

◆ getLHSOfMulBinOp()

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

◆ getMaxCalculationWidth()

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

◆ getMessageSelectIndex()

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

Definition at line 32 of file ReservedIdentifierCheck.cpp.

References GlobalUnderscoreTag, and NonReservedTag.

◆ getName()

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

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

Definition at line 1928 of file EasilySwappableParametersCheck.cpp.

Referenced by clang::tidy::bugprone::EasilySwappableParametersCheck::check(), getNameOrUnnamed(), and isLikelyTypo().

◆ getNameAsString()

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

Definition at line 58 of file ParentVirtualCallCheck.cpp.

References PP.

Referenced by clang::tidy::bugprone::ParentVirtualCallCheck::check().

◆ getNameOfNamespace()

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

◆ getNameOrUnnamed()

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 1936 of file EasilySwappableParametersCheck.cpp.

References getName().

Referenced by clang::tidy::bugprone::EasilySwappableParametersCheck::check().

◆ getNonReservedFixup()

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

Definition at line 116 of file ReservedIdentifierCheck.cpp.

Referenced by getFailureInfoImpl().

◆ getParentsByGrandParent()

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

◆ getPointerLevel()

unsigned clang::tidy::bugprone::getPointerLevel ( const QualType & PtrType)
static

Definition at line 17 of file MultiLevelImplicitPointerConversionCheck.cpp.

References getPointerLevel().

Referenced by getPointerLevel().

◆ getRationaleFor()

StringRef clang::tidy::bugprone::getRationaleFor ( StringRef FunctionName)
static
Returns
The rationale for replacing the function FunctionName with the safer alternative.

Definition at line 91 of file UnsafeFunctionsCheck.cpp.

Referenced by clang::tidy::bugprone::UnsafeFunctionsCheck::check().

◆ getReplacementFor()

StringRef clang::tidy::bugprone::getReplacementFor ( StringRef FunctionName,
bool IsAnnexKAvailable )
static

◆ getReplacementForAdditional()

StringRef clang::tidy::bugprone::getReplacementForAdditional ( StringRef FunctionName,
bool IsAnnexKAvailable )
static

◆ getStrlenExpr()

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

◆ getUnderscoreCapitalFixup()

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

Definition at line 96 of file ReservedIdentifierCheck.cpp.

References startsWithUnderscoreCapital().

Referenced by getFailureInfoImpl().

◆ getUnderscoreGlobalNamespaceFixup()

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

Definition at line 109 of file ReservedIdentifierCheck.cpp.

References startsWithUnderscoreInGlobalNamespace().

Referenced by getFailureInfoImpl().

◆ getUnqualifiedType()

QualType clang::tidy::bugprone::getUnqualifiedType ( const Expr & E)
static

Definition at line 193 of file NarrowingConversionsCheck.cpp.

◆ getValueAsString()

llvm::SmallString< 64 > clang::tidy::bugprone::getValueAsString ( const llvm::APSInt & Value,
uint64_t HexBits )
static

Definition at line 302 of file NarrowingConversionsCheck.cpp.

◆ hasDisjointValueRange()

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

◆ hasPrivateConstructor()

bool clang::tidy::bugprone::hasPrivateConstructor ( const CXXRecordDecl * RD)
static

◆ hasRecursionOverStaticLoopCondVariables()

bool clang::tidy::bugprone::hasRecursionOverStaticLoopCondVariables ( const Expr * Cond,
const Stmt * LoopStmt,
const Decl * Func,
const ASTContext * Ctx )
static

Tests if the loop condition Cond involves static local variables and the enclosing function Func is recursive.

void f() {
static int i = 10;
i--;
while (i >= 0) f();
}
*that are placed right before the argument **code *void f(bool foo)
Checks that argument comments match parameter names.

The example above is NOT an infinite loop.

Definition at line 260 of file InfiniteLoopCheck.cpp.

References hasStaticLocalVariable(), overlap(), and populateCallees().

Referenced by clang::tidy::bugprone::InfiniteLoopCheck::check().

◆ hasReservedDoubleUnderscore()

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

Definition at line 78 of file ReservedIdentifierCheck.cpp.

Referenced by getDoubleUnderscoreFixup(), and getFailureInfoImpl().

◆ hasSameParameterTypes()

bool clang::tidy::bugprone::hasSameParameterTypes ( const FunctionDecl & FD,
const FunctionDecl & O,
const ParmVarDecl & PD )
static

◆ hasStaticLocalVariable()

bool clang::tidy::bugprone::hasStaticLocalVariable ( const Stmt * Cond)
static

returns true iff Cond involves at least one static local variable.

Definition at line 231 of file InfiniteLoopCheck.cpp.

References hasStaticLocalVariable().

Referenced by hasRecursionOverStaticLoopCondVariables(), and hasStaticLocalVariable().

◆ haveSameNamespaceOrTranslationUnit()

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

◆ hintMakeCtorPrivate()

std::vector< FixItHint > clang::tidy::bugprone::hintMakeCtorPrivate ( const CXXConstructorDecl * Ctor,
const std::string & OriginalAccess )
static

◆ ignoreNoOpCasts()

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 27 of file SwappedArgumentsCheck.cpp.

References ignoreNoOpCasts().

Referenced by clang::tidy::bugprone::SwappedArgumentsCheck::check(), and ignoreNoOpCasts().

◆ inDecltypeOrTemplateArg()

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

◆ insertDestCapacityArg()

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

◆ insertNullTerminatorExpr()

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

◆ isAnnexKAvailable()

bool clang::tidy::bugprone::isAnnexKAvailable ( std::optional< bool > & CacheVar,
Preprocessor * PP,
const LangOptions & LO )
static

Calculates whether Annex K is available for the current translation unit based on the macro definitions and the language options.

The result is cached and saved in CacheVar.

Definition at line 109 of file UnsafeFunctionsCheck.cpp.

References PP.

Referenced by clang::tidy::bugprone::UnsafeFunctionsCheck::check().

◆ isAtLeastOneCondVarChanged()

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 117 of file InfiniteLoopCheck.cpp.

References isAtLeastOneCondVarChanged(), and isVarThatIsPossiblyChanged().

Referenced by clang::tidy::bugprone::InfiniteLoopCheck::check(), and isAtLeastOneCondVarChanged().

◆ isChanged()

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

Return whether Var was changed in LoopStmt.

Definition at line 52 of file InfiniteLoopCheck.cpp.

Referenced by isVarPossiblyChanged().

◆ isChangedBefore()

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 31 of file RedundantBranchConditionCheck.cpp.

Referenced by clang::tidy::bugprone::RedundantBranchConditionCheck::check().

◆ isConcatenatedLiteralsOnPurpose()

bool clang::tidy::bugprone::isConcatenatedLiteralsOnPurpose ( ASTContext * Ctx,
const StringLiteral * Lit )
static

Definition at line 17 of file SuspiciousMissingCommaCheck.cpp.

◆ isCorrectGivenLength()

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

◆ isDerivedClassBefriended()

bool clang::tidy::bugprone::isDerivedClassBefriended ( const CXXRecordDecl * CRTP,
const CXXRecordDecl * Derived )
static

◆ isDerivedParameterBefriended()

bool clang::tidy::bugprone::isDerivedParameterBefriended ( const CXXRecordDecl * CRTP,
const NamedDecl * Param )
static

◆ isDestAndSrcEquals()

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

Definition at line 185 of file NotNullTerminatedResultCheck.cpp.

References DestExprName, and SrcExprName.

◆ isDestBasedOnGivenLength()

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

◆ isDestCapacityFix()

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

◆ isDestCapacityOverflows()

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

◆ isDestExprFix()

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

Definition at line 380 of file NotNullTerminatedResultCheck.cpp.

References DestExprName.

◆ isExprAComparisonOperator()

bool clang::tidy::bugprone::isExprAComparisonOperator ( const Expr * E)
static

Definition at line 19 of file ChainedComparisonCheck.cpp.

◆ isExprValueStored()

bool clang::tidy::bugprone::isExprValueStored ( const Expr * E,
ASTContext & C )
static

◆ isFirstWider()

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

◆ isFixedGivenLengthAndUnknownSrc()

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

Definition at line 278 of file NotNullTerminatedResultCheck.cpp.

References getLength(), SrcExprName, and WrongLengthExprName.

◆ isFloatExactlyRepresentable()

bool clang::tidy::bugprone::isFloatExactlyRepresentable ( const ASTContext & Context,
const llvm::APFloat & FloatConstant,
const QualType & DestType )
static

Definition at line 289 of file NarrowingConversionsCheck.cpp.

◆ isGivenLengthEqualToSrcLength()

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

◆ isIdenticalStmt()

bool clang::tidy::bugprone::isIdenticalStmt ( const ASTContext & Ctx,
const Stmt * Stmt1,
const Stmt * Stmt2,
bool IgnoreSideEffects )
static

Determines whether two statement trees are identical regarding operators and symbols.

Exceptions: expressions containing macros or functions with possible side effects are never considered identical. Limitations: (t + u) and (u + t) are not considered identical. t*(u + t) and t*u + t*t are not considered identical.

Definition at line 118 of file BranchCloneCheck.cpp.

References isIdenticalStmt().

Referenced by clang::tidy::bugprone::BranchCloneCheck::check(), and isIdenticalStmt().

◆ isImplicitCastCandidate()

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 38 of file SwappedArgumentsCheck.cpp.

Referenced by clang::tidy::bugprone::SwappedArgumentsCheck::check().

◆ isInjectUL()

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

Definition at line 163 of file NotNullTerminatedResultCheck.cpp.

References getGivenLength().

Referenced by insertDestCapacityArg(), and lengthExprHandle().

◆ isKeyword()

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

Is given TokenKind a keyword?

Definition at line 53 of file MacroParenthesesCheck.cpp.

◆ isKnownDest()

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

Definition at line 168 of file NotNullTerminatedResultCheck.cpp.

References UnknownDestName.

Referenced by isDestCapacityOverflows().

◆ isKnownToHaveValue()

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

◆ isLikelyTypo()

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

Definition at line 143 of file ArgumentCommentCheck.cpp.

References ArgName, and getName().

◆ isMaxValAllBitSetLiteral()

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

Definition at line 72 of file SuspiciousEnumUsageCheck.cpp.

Referenced by isPossiblyBitMask().

◆ isNonPowerOf2NorNullLiteral()

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

Definition at line 62 of file SuspiciousEnumUsageCheck.cpp.

Referenced by countNonPowOfTwoLiteralNum().

◆ isOverrideMethod()

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

Finds out if the given method overrides some method.

Definition at line 28 of file VirtualNearMissCheck.cpp.

◆ isParentOf()

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

◆ isPossiblyBitMask()

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 96 of file SuspiciousEnumUsageCheck.cpp.

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

Referenced by clang::tidy::bugprone::SuspiciousEnumUsageCheck::check().

◆ isSameTypeIgnoringConst()

bool clang::tidy::bugprone::isSameTypeIgnoringConst ( QualType A,
QualType B )
static

◆ isSameTypeIgnoringConstRef()

bool clang::tidy::bugprone::isSameTypeIgnoringConstRef ( QualType A,
QualType B )
static

Definition at line 55 of file ReturnConstRefFromParameterCheck.cpp.

References isSameTypeIgnoringConst().

Referenced by hasSameParameterTypes().

◆ isStandardSmartPointer()

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

Definition at line 245 of file UseAfterMoveCheck.cpp.

References isStandardSmartPointer().

Referenced by isStandardSmartPointer().

◆ isStringDataAndLength()

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

◆ isSurroundedLeft()

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

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

Definition at line 41 of file MacroParenthesesCheck.cpp.

◆ isSurroundedRight()

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

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

Definition at line 47 of file MacroParenthesesCheck.cpp.

◆ isValidBuiltinFold()

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 92 of file FoldInitTypeCheck.cpp.

◆ isVarDeclKeyword()

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

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

Definition at line 67 of file MacroParenthesesCheck.cpp.

Referenced by possibleVarDecl().

◆ isVarPossiblyChanged()

bool clang::tidy::bugprone::isVarPossiblyChanged ( const Decl * Func,
const Stmt * LoopStmt,
const ValueDecl * VD,
ASTContext * Context )
static

Definition at line 67 of file InfiniteLoopCheck.cpp.

References hasPtrOrReferenceInFunc(), and isChanged().

Referenced by isVarThatIsPossiblyChanged().

◆ isVarThatIsPossiblyChanged()

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 91 of file InfiniteLoopCheck.cpp.

References isVarPossiblyChanged().

Referenced by isAtLeastOneCondVarChanged().

◆ isWarnOp()

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

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

Definition at line 59 of file MacroParenthesesCheck.cpp.

◆ isWideEnoughToHold() [1/2]

bool clang::tidy::bugprone::isWideEnoughToHold ( const ASTContext & Context,
const BuiltinType & FromType,
const BuiltinType & ToType )
static

Definition at line 271 of file NarrowingConversionsCheck.cpp.

References createFromType().

◆ isWideEnoughToHold() [2/2]

bool clang::tidy::bugprone::isWideEnoughToHold ( const ASTContext & Context,
const llvm::APSInt & IntegerConstant,
const BuiltinType & ToType )
static

Definition at line 279 of file NarrowingConversionsCheck.cpp.

References createFromType().

◆ lengthArgHandle()

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

Definition at line 364 of file NotNullTerminatedResultCheck.cpp.

References lengthExprHandle(), and LengthExprName.

◆ lengthArgPosHandle()

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

Definition at line 371 of file NotNullTerminatedResultCheck.cpp.

References FunctionExprName, and lengthExprHandle().

◆ lengthExprHandle()

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

◆ looksLikeExpectMethod()

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

Definition at line 185 of file ArgumentCommentCheck.cpp.

Referenced by areMockAndExpectMethods(), and findMockedMethod().

◆ loopEndingStmt()

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

◆ namesCollide()

bool clang::tidy::bugprone::namesCollide ( const CXXMethodDecl & Lhs,
const CXXMethodDecl & Rhs )
static

Definition at line 28 of file DerivedMethodShadowingBaseMethodCheck.cpp.

References sameBasicType().

◆ needsToElaborateImplicitConversion()

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 1954 of file EasilySwappableParametersCheck.cpp.

References clang::tidy::bugprone::model::Mix::flags(), and clang::tidy::bugprone::model::ImplicitConversion.

Referenced by clang::tidy::bugprone::EasilySwappableParametersCheck::check().

◆ needsToPrintTypeInDiagnostic()

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 1945 of file EasilySwappableParametersCheck.cpp.

References clang::tidy::bugprone::model::Mix::flags().

Referenced by clang::tidy::bugprone::EasilySwappableParametersCheck::check().

◆ overlap()

bool clang::tidy::bugprone::overlap ( ArrayRef< CallGraphNode * > SCC,
const llvm::SmallPtrSet< const Decl *, 16 > & Callees,
const Decl * Func )
static

returns true iff SCC contains Func and its' function set overlaps with Callees

Definition at line 214 of file InfiniteLoopCheck.cpp.

Referenced by hasRecursionOverStaticLoopCondVariables().

◆ parseCheckedFunctions()

◆ populateCallees()

bool clang::tidy::bugprone::populateCallees ( const Stmt * StmtNode,
llvm::SmallPtrSet< const Decl *, 16 > & Callees )
static

populates the set Callees with all function (and objc method) declarations called in StmtNode if all visited call sites have resolved call targets.

Returns
true iff all CallExprs visited have callees; false otherwise indicating there is an unresolved indirect call.

Definition at line 190 of file InfiniteLoopCheck.cpp.

References populateCallees().

Referenced by hasRecursionOverStaticLoopCondVariables(), and populateCallees().

◆ possibleVarDecl()

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

Is there a possible variable declaration at Tok?

Definition at line 75 of file MacroParenthesesCheck.cpp.

References isVarDeclKeyword().

◆ relativeCharSizes()

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

Definition at line 126 of file MisplacedWideningCastCheck.cpp.

Referenced by isFirstWider().

◆ relativeCharSizesW()

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

Definition at line 145 of file MisplacedWideningCastCheck.cpp.

Referenced by isFirstWider().

◆ relativeIntSizes()

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

Definition at line 91 of file MisplacedWideningCastCheck.cpp.

Referenced by isFirstWider().

◆ removeArg()

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

Definition at line 407 of file NotNullTerminatedResultCheck.cpp.

References exprLocEnd(), and FunctionExprName.

◆ renameFunc()

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

Definition at line 422 of file NotNullTerminatedResultCheck.cpp.

References FunctionExprName.

Referenced by renameMemcpy().

◆ renameMemcpy()

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

Definition at line 437 of file NotNullTerminatedResultCheck.cpp.

References renameFunc().

◆ replaceMoveWithForward()

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

◆ reportDiagnostic()

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

Definition at line 40 of file UnusedRaiiCheck.cpp.

Referenced by clang::tidy::bugprone::UnusedRaiiCheck::check().

◆ resolveMocks()

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

Definition at line 230 of file ArgumentCommentCheck.cpp.

References findMockedMethod().

◆ sameBasicType()

bool clang::tidy::bugprone::sameBasicType ( const ParmVarDecl * Lhs,
const ParmVarDecl * Rhs )
static

Definition at line 17 of file DerivedMethodShadowingBaseMethodCheck.cpp.

Referenced by namesCollide().

◆ sameName()

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

Definition at line 176 of file ArgumentCommentCheck.cpp.

◆ serializeCheckedFunctions()

std::string clang::tidy::bugprone::serializeCheckedFunctions ( const std::vector< UnsafeFunctionsCheck::CheckedFunction > & Functions)
static

◆ startsWithUnderscoreCapital()

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

Definition at line 92 of file ReservedIdentifierCheck.cpp.

Referenced by getFailureInfoImpl(), and getUnderscoreCapitalFixup().

◆ startsWithUnderscoreInGlobalNamespace()

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

◆ stringviewNullptrCheckImpl()

RewriteRuleWith< std::string > clang::tidy::bugprone::stringviewNullptrCheckImpl ( )
static

◆ tryEvaluateSizeExpr()

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

Variable Documentation

◆ AdditionalFunctionNamesId

llvm::StringLiteral clang::tidy::bugprone::AdditionalFunctionNamesId
staticconstexpr
Initial value:
=
"AdditionalFunctionsNames"

Definition at line 32 of file UnsafeFunctionsCheck.cpp.

Referenced by clang::tidy::bugprone::UnsafeFunctionsCheck::check(), and clang::tidy::bugprone::UnsafeFunctionsCheck::registerMatchers().

◆ 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 21 of file SuspiciousEnumUsageCheck.cpp.

◆ BitmaskNoteMessage

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

Definition at line 31 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 26 of file SuspiciousEnumUsageCheck.cpp.

◆ CastExprName

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

◆ CondVarStr

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

◆ CountingEnumPrefixesOptionDefaultValue

llvm::StringLiteral clang::tidy::bugprone::CountingEnumPrefixesOptionDefaultValue
staticconstexpr

◆ CountingEnumPrefixesOptionName

llvm::StringLiteral clang::tidy::bugprone::CountingEnumPrefixesOptionName
staticconstexpr

◆ CountingEnumSuffixesOptionDefaultValue

llvm::StringLiteral clang::tidy::bugprone::CountingEnumSuffixesOptionDefaultValue
staticconstexpr

◆ CountingEnumSuffixesOptionName

llvm::StringLiteral clang::tidy::bugprone::CountingEnumSuffixesOptionName
staticconstexpr

◆ CustomFunctionNamesId

llvm::StringLiteral clang::tidy::bugprone::CustomFunctionNamesId
staticconstexpr

◆ DeclRefId

llvm::StringLiteral clang::tidy::bugprone::DeclRefId = "DRE"
staticconstexpr

◆ DefaultBindFunctions

const char* clang::tidy::bugprone::DefaultBindFunctions
constexpr
Initial value:
=
"::std::bind;::boost::bind;::std::bind_front;::std::bind_back;"
"::boost::compat::bind_front;::boost::compat::bind_back"

Definition at line 67 of file CapturingThisInMemberVariableCheck.cpp.

Referenced by clang::tidy::bugprone::CapturingThisInMemberVariableCheck::CapturingThisInMemberVariableCheck().

◆ DefaultFunctionWrapperTypes

const char* clang::tidy::bugprone::DefaultFunctionWrapperTypes
constexpr
Initial value:
=
"::std::function;::std::move_only_function;::boost::function"

Definition at line 65 of file CapturingThisInMemberVariableCheck.cpp.

Referenced by clang::tidy::bugprone::CapturingThisInMemberVariableCheck::CapturingThisInMemberVariableCheck().

◆ DestArrayTyName

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

◆ DestExprName

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

◆ DestMallocExprName

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

◆ DestVarDeclName

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

◆ DifferentEnumErrorMessage

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

Definition at line 18 of file SuspiciousEnumUsageCheck.cpp.

Referenced by clang::tidy::bugprone::SuspiciousEnumUsageCheck::check().

◆ DoubleUnderscoreTag

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

Definition at line 23 of file ReservedIdentifierCheck.cpp.

Referenced by getFailureInfoImpl().

◆ EnableCountingEnumHeuristicOptionDefaultValue

bool clang::tidy::bugprone::EnableCountingEnumHeuristicOptionDefaultValue = true
staticconstexpr

◆ EnableCountingEnumHeuristicOptionName

llvm::StringLiteral clang::tidy::bugprone::EnableCountingEnumHeuristicOptionName
staticconstexpr

◆ FuncStr

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

◆ FunctionExprName

◆ FunctionNamesId

llvm::StringLiteral clang::tidy::bugprone::FunctionNamesId = "FunctionsNames"
staticconstexpr

◆ FunctionNamesWithAnnexKReplacementId

llvm::StringLiteral clang::tidy::bugprone::FunctionNamesWithAnnexKReplacementId
staticconstexpr
Initial value:
=
"FunctionNamesWithAnnexKReplacement"

Definition at line 29 of file UnsafeFunctionsCheck.cpp.

Referenced by clang::tidy::bugprone::UnsafeFunctionsCheck::check(), and clang::tidy::bugprone::UnsafeFunctionsCheck::registerMatchers().

◆ GlobalUnderscoreTag

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

Definition at line 25 of file ReservedIdentifierCheck.cpp.

Referenced by getFailureInfoImpl(), and getMessageSelectIndex().

◆ InnerIfStr

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

◆ InnerIfVar1Str

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

◆ InnerIfVar2Str

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

◆ KnownStringCompareFunctions

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

◆ LengthExprName

◆ LoopIncrementName

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

Definition at line 25 of file TooSmallLoopVariableCheck.cpp.

Referenced by clang::tidy::bugprone::TooSmallLoopVariableCheck::check(), and clang::tidy::bugprone::TooSmallLoopVariableCheck::registerMatchers().

◆ LoopName

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

Definition at line 17 of file TooSmallLoopVariableCheck.cpp.

Referenced by clang::tidy::bugprone::TooSmallLoopVariableCheck::registerMatchers().

◆ LoopUpperBoundName

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

Definition at line 23 of file TooSmallLoopVariableCheck.cpp.

Referenced by clang::tidy::bugprone::TooSmallLoopVariableCheck::check(), and clang::tidy::bugprone::TooSmallLoopVariableCheck::registerMatchers().

◆ LoopVarCastName

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

Definition at line 21 of file TooSmallLoopVariableCheck.cpp.

Referenced by clang::tidy::bugprone::TooSmallLoopVariableCheck::registerMatchers().

◆ LoopVarName

llvm::StringLiteral clang::tidy::bugprone::LoopVarName
staticconstexpr

◆ 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 28 of file ReservedIdentifierCheck.cpp.

◆ NonReservedTag

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

Definition at line 26 of file ReservedIdentifierCheck.cpp.

Referenced by getFailureInfoImpl(), and getMessageSelectIndex().

◆ OptionNameCustomFunctions

llvm::StringLiteral clang::tidy::bugprone::OptionNameCustomFunctions
staticconstexpr

◆ OptionNameReportDefaultFunctions

llvm::StringLiteral clang::tidy::bugprone::OptionNameReportDefaultFunctions
staticconstexpr

◆ OptionNameReportMoreUnsafeFunctions

llvm::StringLiteral clang::tidy::bugprone::OptionNameReportMoreUnsafeFunctions
staticconstexpr

◆ OuterIfStr

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

◆ OuterIfVar1Str

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

◆ OuterIfVar2Str

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

◆ PP

◆ RootMatchBindName

llvm::StringLiteral clang::tidy::bugprone::RootMatchBindName = "root"
staticconstexpr

◆ SrcExprName

◆ SrcVarDeclName

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

◆ StrictModeOptionDefaultValue

bool clang::tidy::bugprone::StrictModeOptionDefaultValue = false
staticconstexpr

◆ StrictModeOptionName

llvm::StringLiteral clang::tidy::bugprone::StrictModeOptionName = "StrictMode"
staticconstexpr

◆ TagMatchBindName

llvm::StringLiteral clang::tidy::bugprone::TagMatchBindName = "tags"
staticconstexpr

◆ UnderscoreCapitalTag

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

Definition at line 24 of file ReservedIdentifierCheck.cpp.

Referenced by getFailureInfoImpl().

◆ UnionMatchBindName

llvm::StringLiteral clang::tidy::bugprone::UnionMatchBindName = "union"
staticconstexpr

◆ UnknownDestName

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

◆ UnknownLengthName

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

◆ UnsignedASCIIUpperBound

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

◆ WrongLengthExprName

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