clang-tools
6.0.0
|
Classes | |
class | DefinitionsInHeadersCheck |
Finds non-extern non-inline function and variable definitions in header files, which can lead to potential ODR violations. More... | |
class | ForwardingReferenceOverloadCheck |
The checker looks for constructors that can act as copy or move constructors through their forwarding reference parameters. More... | |
class | IncorrectRoundings |
Checks the usage of patterns known to produce incorrect rounding. 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 | MiscModule |
class | MisplacedConstCheck |
This check diagnoses when a const qualifier is applied to a typedef to a pointer type rather than to the pointee. More... | |
class | MisplacedWideningCastCheck |
Find casts of calculation results to bigger type. More... | |
class | NewDeleteOverloadsCheck |
class | NonCopyableObjectsCheck |
The check flags dereferences and non-pointer declarations of objects that are not meant to be passed by value, such as C FILE objects. More... | |
class | RedundantExpressionCheck |
The checker detects expressions that are redundant, because they contain ineffective, useless parts. More... | |
class | SizeofContainerCheck |
Find usages of sizeof on expressions of STL container types. More... | |
class | SizeofExpressionCheck |
Find suspicious usages of sizeof expression. More... | |
class | StaticAssertCheck |
Replaces assert() with static_assert() if the condition is evaluatable at compile time. More... | |
class | StringCompareCheck |
This check flags all calls compare when used to check for string equality or inequality. 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 | 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 | ThrowByValueCatchByReferenceCheck |
checks for locations that do not throw by value More... | |
class | UnconventionalAssignOperatorCheck |
Finds declarations of assignment operators with the wrong return and/or argument types and definitions with good return type but wrong return statements. 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 | UniqueptrResetReleaseCheck |
Find and replace unique_ptr::reset(release()) with std::move() . More... | |
class | UnusedAliasDeclsCheck |
Finds unused namespace alias declarations. More... | |
class | UnusedParametersCheck |
Finds unused parameters and fixes them, so that -Wunused-parameter can be turned on. More... | |
class | UnusedRAIICheck |
Finds temporaries that look like RAII objects. More... | |
class | UnusedUsingDeclsCheck |
Finds unused using declarations. More... | |
struct | ValueRange |
Stores a min and a max value which describe an interval. More... | |
Functions | |
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 QualType | guessAlternateQualification (ASTContext &Context, QualType QT) |
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 bool | incrementWithoutOverflow (const APSInt &Value, APSInt &Result) |
static bool | areEquivalentNameSpecifier (const NestedNameSpecifier *Left, const NestedNameSpecifier *Right) |
static bool | areEquivalentExpr (const Expr *Left, const Expr *Right) |
static bool | areEquivalentRanges (BinaryOperatorKind OpcodeLHS, const APSInt &ValueLHS, BinaryOperatorKind OpcodeRHS, const APSInt &ValueRHS) |
static bool | areExclusiveRanges (BinaryOperatorKind OpcodeLHS, const APSInt &ValueLHS, BinaryOperatorKind OpcodeRHS, const APSInt &ValueRHS) |
static bool | rangesFullyCoverDomain (BinaryOperatorKind OpcodeLHS, const APSInt &ValueLHS, BinaryOperatorKind OpcodeRHS, const APSInt &ValueRHS) |
static bool | rangeSubsumesRange (BinaryOperatorKind OpcodeLHS, const APSInt &ValueLHS, BinaryOperatorKind OpcodeRHS, const APSInt &ValueRHS) |
static void | transformSubToCanonicalAddExpr (BinaryOperatorKind &Opcode, APSInt &Value) |
AST_MATCHER (Expr, isIntegerConstantExpr) | |
AST_MATCHER (BinaryOperator, operandsAreEquivalent) | |
AST_MATCHER (ConditionalOperator, expressionsAreEquivalent) | |
AST_MATCHER (CallExpr, parametersAreEquivalent) | |
AST_MATCHER (BinaryOperator, binaryOperatorIsInMacro) | |
AST_MATCHER (ConditionalOperator, conditionalOperatorIsInMacro) | |
AST_MATCHER (Expr, isMacro) | |
AST_MATCHER_P (Expr, expandedByMacro, llvm::StringSet<>, Names) | |
static ast_matchers::internal::Matcher< Expr > | matchIntegerConstantExpr (StringRef Id) |
static bool | retrieveIntegerConstantExpr (const MatchFinder::MatchResult &Result, StringRef Id, APSInt &Value, const Expr *&ConstExpr) |
static bool | retrieveIntegerConstantExpr (const MatchFinder::MatchResult &Result, StringRef Id, APSInt &Value) |
static ast_matchers::internal::Matcher< Expr > | matchSymbolicExpr (StringRef Id) |
static bool | retrieveSymbolicExpr (const MatchFinder::MatchResult &Result, StringRef Id, const Expr *&SymExpr) |
static ast_matchers::internal::Matcher< Expr > | matchBinOpIntegerConstantExpr (StringRef Id) |
static bool | retrieveBinOpIntegerConstantExpr (const MatchFinder::MatchResult &Result, StringRef Id, BinaryOperatorKind &Opcode, const Expr *&Symbol, APSInt &Value) |
static ast_matchers::internal::Matcher< Expr > | matchRelationalIntegerConstantExpr (StringRef Id) |
static bool | isNonConstReferenceType (QualType ParamType) |
static bool | canOverloadedOperatorArgsBeModified (const FunctionDecl *OperatorDecl, bool checkSecondParam) |
static bool | retrieveRelationalIntegerConstantExpr (const MatchFinder::MatchResult &Result, StringRef Id, const Expr *&OperandExpr, BinaryOperatorKind &Opcode, const Expr *&Symbol, APSInt &Value, const Expr *&ConstExpr) |
static bool | areSidesBinaryConstExpressions (const BinaryOperator *&BinOp, const ASTContext *AstCtx) |
static bool | retrieveConstExprFromBothSides (const BinaryOperator *&BinOp, BinaryOperatorKind &MainOpcode, BinaryOperatorKind &SideOpcode, const Expr *&LhsConst, const Expr *&RhsConst, const ASTContext *AstCtx) |
static bool | areExprsFromDifferentMacros (const Expr *LhsExpr, const Expr *RhsExpr, const ASTContext *AstCtx) |
static bool | areExprsMacroAndNonMacro (const Expr *&LhsExpr, const Expr *&RhsExpr) |
static bool | exprEvaluatesToZero (BinaryOperatorKind Opcode, APSInt Value) |
static bool | exprEvaluatesToBitwiseNegatedZero (BinaryOperatorKind Opcode, APSInt Value) |
static bool | exprEvaluatesToSymbolic (BinaryOperatorKind Opcode, APSInt Value) |
AST_MATCHER (StringLiteral, containsNul) | |
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 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... | |
template<typename T > | |
static CharSourceRange | removeNode (const MatchFinder::MatchResult &Result, const T *PrevNode, const T *Node, const T *NextNode) |
static FixItHint | removeParameter (const MatchFinder::MatchResult &Result, const FunctionDecl *Function, unsigned Index) |
static FixItHint | removeArgument (const MatchFinder::MatchResult &Result, const CallExpr *Call, unsigned Index) |
static bool | ShouldCheckDecl (const Decl *TargetDecl) |
Variables | |
static const llvm::StringSet | KnownBannedMacroNames |
static const StringRef | CompareMessage |
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 |
Definition at line 58 of file RedundantExpressionCheck.cpp.
References areEquivalentNameSpecifier().
Referenced by AST_MATCHER(), and exprEvaluatesToSymbolic().
|
static |
Definition at line 50 of file RedundantExpressionCheck.cpp.
Referenced by areEquivalentExpr().
|
static |
Definition at line 139 of file RedundantExpressionCheck.cpp.
References incrementWithoutOverflow().
Referenced by exprEvaluatesToSymbolic().
|
static |
Definition at line 159 of file RedundantExpressionCheck.cpp.
References incrementWithoutOverflow().
Referenced by exprEvaluatesToSymbolic().
|
static |
Definition at line 600 of file RedundantExpressionCheck.cpp.
Referenced by clang::tidy::misc::RedundantExpressionCheck::check(), and exprEvaluatesToSymbolic().
|
static |
Definition at line 619 of file RedundantExpressionCheck.cpp.
Referenced by clang::tidy::misc::RedundantExpressionCheck::check(), and exprEvaluatesToSymbolic().
|
static |
Definition at line 550 of file RedundantExpressionCheck.cpp.
Referenced by clang::tidy::misc::RedundantExpressionCheck::check(), and retrieveConstExprFromBothSides().
clang::tidy::misc::AST_MATCHER | ( | StringLiteral | , |
containsNul | |||
) |
Definition at line 20 of file StringLiteralWithEmbeddedNulCheck.cpp.
clang::tidy::misc::AST_MATCHER | ( | Expr | , |
isIntegerConstantExpr | |||
) |
Definition at line 293 of file RedundantExpressionCheck.cpp.
clang::tidy::misc::AST_MATCHER | ( | BinaryOperator | , |
operandsAreEquivalent | |||
) |
Definition at line 299 of file RedundantExpressionCheck.cpp.
References areEquivalentExpr().
clang::tidy::misc::AST_MATCHER | ( | ConditionalOperator | , |
expressionsAreEquivalent | |||
) |
Definition at line 303 of file RedundantExpressionCheck.cpp.
References areEquivalentExpr().
clang::tidy::misc::AST_MATCHER | ( | CallExpr | , |
parametersAreEquivalent | |||
) |
Definition at line 307 of file RedundantExpressionCheck.cpp.
References areEquivalentExpr().
clang::tidy::misc::AST_MATCHER | ( | BinaryOperator | , |
binaryOperatorIsInMacro | |||
) |
Definition at line 312 of file RedundantExpressionCheck.cpp.
clang::tidy::misc::AST_MATCHER | ( | ConditionalOperator | , |
conditionalOperatorIsInMacro | |||
) |
Definition at line 316 of file RedundantExpressionCheck.cpp.
clang::tidy::misc::AST_MATCHER | ( | Expr | , |
isMacro | |||
) |
Definition at line 320 of file RedundantExpressionCheck.cpp.
clang::tidy::misc::AST_MATCHER_P | ( | Expr | , |
expandedByMacro | , | ||
llvm::StringSet<> | , | ||
Names | |||
) |
Definition at line 322 of file RedundantExpressionCheck.cpp.
|
static |
Definition at line 473 of file RedundantExpressionCheck.cpp.
References isNonConstReferenceType().
Referenced by clang::tidy::misc::RedundantExpressionCheck::check(), and retrieveRelationalIntegerConstantExpr().
|
static |
Definition at line 90 of file SuspiciousEnumUsageCheck.cpp.
References isNonPowerOf2NorNullLiteral().
Referenced by isPossiblyBitMask().
|
static |
Return the number of EnumConstantDecls in an EnumDecl.
Definition at line 54 of file SuspiciousEnumUsageCheck.cpp.
Referenced by isPossiblyBitMask().
|
static |
Definition at line 821 of file RedundantExpressionCheck.cpp.
Referenced by exprEvaluatesToSymbolic().
|
static |
Definition at line 826 of file RedundantExpressionCheck.cpp.
References areEquivalentExpr(), areEquivalentRanges(), areExclusiveRanges(), areExprsFromDifferentMacros(), areExprsMacroAndNonMacro(), exprEvaluatesToBitwiseNegatedZero(), exprEvaluatesToZero(), Loc, rangesFullyCoverDomain(), rangeSubsumesRange(), retrieveBinOpIntegerConstantExpr(), retrieveIntegerConstantExpr(), retrieveRelationalIntegerConstantExpr(), and retrieveSymbolicExpr().
|
static |
Definition at line 817 of file RedundantExpressionCheck.cpp.
Referenced by exprEvaluatesToSymbolic().
|
static |
Definition at line 56 of file MisplacedWideningCastCheck.cpp.
Referenced by clang::tidy::misc::MisplacedWideningCastCheck::check().
|
static |
Definition at line 32 of file MisplacedConstCheck.cpp.
Referenced by clang::tidy::misc::MisplacedConstCheck::check().
|
static |
Definition at line 58 of file SuspiciousEnumUsageCheck.cpp.
References clang::tidy::misc::ValueRange::MaxVal, and clang::tidy::misc::ValueRange::MinVal.
Referenced by clang::tidy::misc::SuspiciousEnumUsageCheck::check().
|
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 29 of file SwappedArgumentsCheck.cpp.
Referenced by clang::tidy::misc::SwappedArgumentsCheck::check().
|
static |
Definition at line 44 of file RedundantExpressionCheck.cpp.
Referenced by areEquivalentRanges(), areExclusiveRanges(), and rangesFullyCoverDomain().
|
static |
Definition at line 170 of file MisplacedWideningCastCheck.cpp.
References relativeCharSizes(), relativeCharSizesW(), and relativeIntSizes().
Referenced by clang::tidy::misc::MisplacedWideningCastCheck::check().
|
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 40 of file SwappedArgumentsCheck.cpp.
Referenced by clang::tidy::misc::SwappedArgumentsCheck::check().
|
static |
Is given TokenKind a keyword?
Definition at line 56 of file MacroParenthesesCheck.cpp.
Referenced by possibleVarDecl().
|
static |
Definition at line 75 of file SuspiciousEnumUsageCheck.cpp.
Referenced by isPossiblyBitMask().
|
static |
Definition at line 461 of file RedundantExpressionCheck.cpp.
Referenced by canOverloadedOperatorArgsBeModified().
|
static |
Definition at line 65 of file SuspiciousEnumUsageCheck.cpp.
Referenced by countNonPowOfTwoLiteralNum().
|
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 101 of file SuspiciousEnumUsageCheck.cpp.
References countNonPowOfTwoLiteralNum(), enumLength(), isMaxValAllBitSetLiteral(), clang::tidy::misc::ValueRange::MaxVal, and clang::tidy::misc::ValueRange::MinVal.
Referenced by clang::tidy::misc::SuspiciousEnumUsageCheck::check().
|
static |
Is argument surrounded properly with parentheses/braces/squares/commas?
Definition at line 44 of file MacroParenthesesCheck.cpp.
|
static |
Is argument surrounded properly with parentheses/braces/squares/commas?
Definition at line 50 of file MacroParenthesesCheck.cpp.
|
static |
Is given Token a keyword that is used in variable declarations?
Definition at line 70 of file MacroParenthesesCheck.cpp.
Referenced by possibleVarDecl().
|
static |
Warning is written when one of these operators are not within parentheses.
Definition at line 62 of file MacroParenthesesCheck.cpp.
Referenced by possibleVarDecl().
|
static |
Definition at line 383 of file RedundantExpressionCheck.cpp.
References matchIntegerConstantExpr(), and matchSymbolicExpr().
|
static |
Definition at line 337 of file RedundantExpressionCheck.cpp.
Referenced by matchBinOpIntegerConstantExpr(), and matchRelationalIntegerConstantExpr().
|
static |
Definition at line 413 of file RedundantExpressionCheck.cpp.
References matchIntegerConstantExpr(), and matchSymbolicExpr().
|
static |
Definition at line 362 of file RedundantExpressionCheck.cpp.
Referenced by matchBinOpIntegerConstantExpr(), and matchRelationalIntegerConstantExpr().
|
static |
Is there a possible variable declaration at Tok?
Definition at line 78 of file MacroParenthesesCheck.cpp.
References isKeyword(), isVarDeclKeyword(), isWarnOp(), and Loc.
|
static |
Definition at line 203 of file RedundantExpressionCheck.cpp.
References incrementWithoutOverflow().
Referenced by exprEvaluatesToSymbolic().
|
static |
Definition at line 250 of file RedundantExpressionCheck.cpp.
Referenced by exprEvaluatesToSymbolic().
|
static |
Definition at line 132 of file MisplacedWideningCastCheck.cpp.
Referenced by isFirstWider().
|
static |
Definition at line 151 of file MisplacedWideningCastCheck.cpp.
Referenced by isFirstWider().
|
static |
Definition at line 97 of file MisplacedWideningCastCheck.cpp.
Referenced by isFirstWider().
|
static |
Definition at line 65 of file UnusedParametersCheck.cpp.
References removeNode().
|
static |
Definition at line 39 of file UnusedParametersCheck.cpp.
Referenced by removeArgument(), and removeParameter().
|
static |
Definition at line 56 of file UnusedParametersCheck.cpp.
References removeNode().
|
static |
Definition at line 400 of file RedundantExpressionCheck.cpp.
References retrieveIntegerConstantExpr(), and retrieveSymbolicExpr().
Referenced by exprEvaluatesToSymbolic().
|
static |
Definition at line 568 of file RedundantExpressionCheck.cpp.
References areSidesBinaryConstExpressions().
Referenced by clang::tidy::misc::RedundantExpressionCheck::check().
|
static |
Definition at line 345 of file RedundantExpressionCheck.cpp.
|
static |
Definition at line 354 of file RedundantExpressionCheck.cpp.
Referenced by exprEvaluatesToSymbolic(), retrieveBinOpIntegerConstantExpr(), and retrieveRelationalIntegerConstantExpr().
|
static |
Definition at line 493 of file RedundantExpressionCheck.cpp.
References canOverloadedOperatorArgsBeModified(), retrieveIntegerConstantExpr(), and retrieveSymbolicExpr().
Referenced by exprEvaluatesToSymbolic().
|
static |
Definition at line 370 of file RedundantExpressionCheck.cpp.
Referenced by exprEvaluatesToSymbolic(), retrieveBinOpIntegerConstantExpr(), and retrieveRelationalIntegerConstantExpr().
|
static |
Definition at line 24 of file UnusedUsingDeclsCheck.cpp.
|
static |
Definition at line 285 of file RedundantExpressionCheck.cpp.
|
static |
Definition at line 24 of file SuspiciousEnumUsageCheck.cpp.
|
static |
Definition at line 34 of file SuspiciousEnumUsageCheck.cpp.
|
static |
Definition at line 29 of file SuspiciousEnumUsageCheck.cpp.
|
static |
Definition at line 22 of file StringCompareCheck.cpp.
Referenced by clang::tidy::misc::StringCompareCheck::check().
|
static |
Definition at line 21 of file SuspiciousEnumUsageCheck.cpp.
Referenced by clang::tidy::misc::SuspiciousEnumUsageCheck::check().
|
static |
Definition at line 41 of file RedundantExpressionCheck.cpp.
|
static |
Definition at line 25 of file SuspiciousStringCompareCheck.cpp.