clang-tools
3.9.0
|
Classes | |
class | ArgumentCommentCheck |
class | AssertSideEffectCheck |
Finds assert() with side effect. More... | |
class | BoolPointerImplicitConversionCheck |
Checks for conditions based on implicit conversion from a bool pointer to bool. More... | |
class | DanglingHandleCheck |
Detect dangling references in value handlers like std::experimental::string_view. More... | |
class | DefinitionsInHeadersCheck |
Finds non-extern non-inline function and variable definitions in header files, which can lead to potential ODR violations. 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 | InaccurateEraseCheck |
Checks for inaccurate use of the erase() method. More... | |
class | IncorrectRoundings |
Checks the usage of patterns known to produce incorrect rounding. More... | |
class | InefficientAlgorithmCheck |
Warns on inefficient use of STL algorithms on associative containers. 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 | MoveConstantArgumentCheck |
class | MoveConstructorInitCheck |
The check flags user-defined move constructors that have a ctor-initializer initializing a member or base class through a copy constructor instead of a move constructor. More... | |
class | MultipleStatementMacroCheck |
Detect multiple statement macros that are used in unbraced conditionals. More... | |
class | NewDeleteOverloadsCheck |
class | NoexceptMoveConstructorCheck |
The check flags user-defined move constructors and assignment operators not marked with noexcept or marked with noexcept(expr) where expr evaluates to false (but is not a false literal itself). More... | |
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 | PointerAndIntegralOperationCheck |
Find suspicious expressions involving pointer and integral types. More... | |
class | RedundantExpressionCheck |
Detect useless or suspicious redundant expressions. 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 | 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 | 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... | |
class | VirtualNearMissCheck |
Checks for near miss of virtual methods. More... | |
Functions | |
static std::vector< std::pair < SourceLocation, StringRef > > | getCommentsInRange (ASTContext *Ctx, CharSourceRange Range) |
*that are placed right before the argument **code *void | f (bool foo) |
Checks that argument comments match parameter names. More... | |
*** | f (true) |
static bool | isValidBuiltinFold (const BuiltinType &ValueType, const BuiltinType &InitType, const ASTContext &Context) |
Returns true if ValueType is allowed to fold into InitType, i.e. More... | |
static bool | haveSameNamespaceOrTranslationUnit (const CXXRecordDecl *Decl1, const CXXRecordDecl *Decl2) |
static std::string | getNameOfNamespace (const CXXRecordDecl *Decl) |
static bool | areTypesCompatible (QualType Left, QualType Right) |
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 void | ReplaceCallWithArg (const CallExpr *Call, DiagnosticBuilder &Diag, const SourceManager &SM, const LangOptions &LangOpts) |
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 | canonicalNegateExpr (BinaryOperatorKind &Opcode, APSInt &Value) |
AST_MATCHER (Expr, isIntegerConstantExpr) | |
static ast_matchers::internal::Matcher < Expr > | matchIntegerConstantExpr (StringRef Id) |
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 | retrieveRelationalIntegerConstantExpr (const MatchFinder::MatchResult &Result, StringRef Id, const Expr *&OperandExpr, BinaryOperatorKind &Opcode, const Expr *&Symbol, APSInt &Value) |
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, std::set< std::string >, Names) | |
AST_MATCHER_P (IntegerLiteral, isBiggerThan, unsigned, N) | |
AST_MATCHER (StringLiteral, containsNul) | |
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) |
AST_MATCHER (CXXMethodDecl, isStatic) | |
AST_MATCHER (CXXMethodDecl, isOverloadedOperator) | |
static bool | isOverrideMethod (const CXXMethodDecl *MD) |
Finds out if the given method overrides some method. More... | |
static bool | checkOverridingFunctionReturnType (const ASTContext *Context, const CXXMethodDecl *BaseMD, const CXXMethodDecl *DerivedMD) |
Checks whether the return types are covariant, according to C++[class.virtual]p7. More... | |
static QualType | getDecayedType (QualType Type) |
static bool | checkParamTypes (const CXXMethodDecl *BaseMD, const CXXMethodDecl *DerivedMD) |
static bool | checkOverrideWithoutName (const ASTContext *Context, const CXXMethodDecl *BaseMD, const CXXMethodDecl *DerivedMD) |
static bool | checkOverrideByDerivedMethod (const CXXMethodDecl *BaseMD, const CXXMethodDecl *DerivedMD) |
Check whether BaseMD overrides DerivedMD. More... | |
Variables | |
static const char | KnownBannedMacroNames [] |
static const char | KnownStringCompareFunctions [] |
|
static |
Definition at line 45 of file RedundantExpressionCheck.cpp.
References areEquivalentNameSpecifier().
Referenced by AST_MATCHER().
|
static |
Definition at line 37 of file RedundantExpressionCheck.cpp.
Referenced by areEquivalentExpr().
|
static |
Definition at line 126 of file RedundantExpressionCheck.cpp.
References incrementWithoutOverflow().
|
static |
Definition at line 146 of file RedundantExpressionCheck.cpp.
References incrementWithoutOverflow().
|
static |
Definition at line 21 of file InefficientAlgorithmCheck.cpp.
Referenced by clang::tidy::misc::InefficientAlgorithmCheck::check().
clang::tidy::misc::AST_MATCHER | ( | StringLiteral | , |
containsNul | |||
) |
Definition at line 20 of file StringLiteralWithEmbeddedNulCheck.cpp.
clang::tidy::misc::AST_MATCHER | ( | CXXMethodDecl | , |
isStatic | |||
) |
Definition at line 22 of file VirtualNearMissCheck.cpp.
clang::tidy::misc::AST_MATCHER | ( | CXXMethodDecl | , |
isOverloadedOperator | |||
) |
Definition at line 24 of file VirtualNearMissCheck.cpp.
clang::tidy::misc::AST_MATCHER | ( | Expr | , |
isIntegerConstantExpr | |||
) |
Definition at line 274 of file RedundantExpressionCheck.cpp.
References Finder.
clang::tidy::misc::AST_MATCHER | ( | BinaryOperator | , |
operandsAreEquivalent | |||
) |
Definition at line 420 of file RedundantExpressionCheck.cpp.
References areEquivalentExpr().
clang::tidy::misc::AST_MATCHER | ( | ConditionalOperator | , |
expressionsAreEquivalent | |||
) |
Definition at line 424 of file RedundantExpressionCheck.cpp.
References areEquivalentExpr().
clang::tidy::misc::AST_MATCHER | ( | CallExpr | , |
parametersAreEquivalent | |||
) |
Definition at line 428 of file RedundantExpressionCheck.cpp.
References areEquivalentExpr().
clang::tidy::misc::AST_MATCHER | ( | BinaryOperator | , |
binaryOperatorIsInMacro | |||
) |
Definition at line 433 of file RedundantExpressionCheck.cpp.
clang::tidy::misc::AST_MATCHER | ( | ConditionalOperator | , |
conditionalOperatorIsInMacro | |||
) |
Definition at line 437 of file RedundantExpressionCheck.cpp.
clang::tidy::misc::AST_MATCHER | ( | Expr | , |
isMacro | |||
) |
Definition at line 441 of file RedundantExpressionCheck.cpp.
clang::tidy::misc::AST_MATCHER_P | ( | IntegerLiteral | , |
isBiggerThan | , | ||
unsigned | , | ||
N | |||
) |
Definition at line 21 of file StringConstructorCheck.cpp.
clang::tidy::misc::AST_MATCHER_P | ( | Expr | , |
expandedByMacro | , | ||
std::set< std::string > | , | ||
Names | |||
) |
Definition at line 443 of file RedundantExpressionCheck.cpp.
|
static |
Definition at line 267 of file RedundantExpressionCheck.cpp.
|
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 168 of file VirtualNearMissCheck.cpp.
|
static |
Definition at line 148 of file VirtualNearMissCheck.cpp.
References checkOverridingFunctionReturnType(), and checkParamTypes().
Referenced by clang::tidy::misc::VirtualNearMissCheck::check().
|
static |
Checks whether the return types are covariant, according to C++[class.virtual]p7.
Similar with clang::Sema::CheckOverridingFunctionReturnType.
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 38 of file VirtualNearMissCheck.cpp.
References Path.
Referenced by checkOverrideWithoutName().
|
static |
Definition at line 130 of file VirtualNearMissCheck.cpp.
References getDecayedType().
Referenced by checkOverrideWithoutName().
* that are placed right before the argument* * code* void clang::tidy::misc::f | ( | bool | foo | ) |
Checks that argument comments match parameter names.
The check understands argument comments in the form `/*parameter_name=
* * * clang::tidy::misc::f | ( | true | ) |
|
static |
Definition at line 41 of file ArgumentCommentCheck.cpp.
References SM.
|
static |
Definition at line 123 of file VirtualNearMissCheck.cpp.
Referenced by checkParamTypes().
|
static |
Definition at line 57 of file MisplacedWideningCastCheck.cpp.
Referenced by clang::tidy::misc::MisplacedWideningCastCheck::check().
|
static |
Definition at line 104 of file ForwardDeclarationNamespaceCheck.cpp.
Referenced by clang::tidy::misc::ForwardDeclarationNamespaceCheck::onEndOfTranslationUnit().
|
static |
Definition at line 32 of file MisplacedConstCheck.cpp.
Referenced by clang::tidy::misc::MisplacedConstCheck::check().
|
static |
Definition at line 83 of file ForwardDeclarationNamespaceCheck.cpp.
Referenced by clang::tidy::misc::ForwardDeclarationNamespaceCheck::onEndOfTranslationUnit().
|
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 31 of file RedundantExpressionCheck.cpp.
References Result.
Referenced by areEquivalentRanges(), areExclusiveRanges(), and rangesFullyCoverDomain().
|
static |
Definition at line 171 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.
|
static |
Finds out if the given method overrides some method.
Definition at line 29 of file VirtualNearMissCheck.cpp.
|
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 |
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 80 of file FoldInitTypeCheck.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.
|
static |
Definition at line 319 of file RedundantExpressionCheck.cpp.
References matchIntegerConstantExpr(), and matchSymbolicExpr().
Referenced by clang::tidy::misc::RedundantExpressionCheck::registerMatchers().
|
static |
Definition at line 282 of file RedundantExpressionCheck.cpp.
Referenced by matchBinOpIntegerConstantExpr(), matchRelationalIntegerConstantExpr(), and clang::tidy::misc::RedundantExpressionCheck::registerMatchers().
|
static |
Definition at line 349 of file RedundantExpressionCheck.cpp.
References matchIntegerConstantExpr(), and matchSymbolicExpr().
Referenced by clang::tidy::misc::RedundantExpressionCheck::registerMatchers().
|
static |
Definition at line 298 of file RedundantExpressionCheck.cpp.
Referenced by matchBinOpIntegerConstantExpr(), matchRelationalIntegerConstantExpr(), and clang::tidy::misc::RedundantExpressionCheck::registerMatchers().
|
static |
Is there a possible variable declaration at Tok?
Definition at line 78 of file MacroParenthesesCheck.cpp.
References isVarDeclKeyword().
|
static |
Definition at line 190 of file RedundantExpressionCheck.cpp.
References incrementWithoutOverflow().
|
static |
Definition at line 232 of file RedundantExpressionCheck.cpp.
|
static |
Definition at line 133 of file MisplacedWideningCastCheck.cpp.
Referenced by isFirstWider().
|
static |
Definition at line 152 of file MisplacedWideningCastCheck.cpp.
Referenced by isFirstWider().
|
static |
Definition at line 98 of file MisplacedWideningCastCheck.cpp.
Referenced by isFirstWider().
|
static |
Definition at line 60 of file UnusedParametersCheck.cpp.
References removeNode().
|
static |
Definition at line 34 of file UnusedParametersCheck.cpp.
Referenced by removeArgument(), and removeParameter().
|
static |
Definition at line 51 of file UnusedParametersCheck.cpp.
References removeNode().
|
static |
Definition at line 20 of file MoveConstantArgumentCheck.cpp.
Referenced by clang::tidy::misc::MoveConstantArgumentCheck::check().
|
static |
Definition at line 336 of file RedundantExpressionCheck.cpp.
References retrieveIntegerConstantExpr(), and retrieveSymbolicExpr().
|
static |
Definition at line 289 of file RedundantExpressionCheck.cpp.
Referenced by retrieveBinOpIntegerConstantExpr(), and retrieveRelationalIntegerConstantExpr().
|
static |
Definition at line 386 of file RedundantExpressionCheck.cpp.
References retrieveIntegerConstantExpr(), and retrieveSymbolicExpr().
|
static |
Definition at line 306 of file RedundantExpressionCheck.cpp.
Referenced by retrieveBinOpIntegerConstantExpr(), and retrieveRelationalIntegerConstantExpr().
|
static |
Definition at line 24 of file UnusedUsingDeclsCheck.cpp.
Referenced by clang::tidy::misc::UnusedUsingDeclsCheck::check().
|
static |
Definition at line 28 of file RedundantExpressionCheck.cpp.
Referenced by clang::tidy::misc::RedundantExpressionCheck::registerMatchers().
|
static |
Definition at line 26 of file SuspiciousStringCompareCheck.cpp.
Referenced by clang::tidy::misc::SuspiciousStringCompareCheck::registerMatchers().