clang-tools 6.0.0

Classes | Functions | Variables
clang::tidy::misc Namespace Reference

## 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 []

## Function Documentation

## ◆ areEquivalentExpr()

static bool clang::tidy::misc::areEquivalentExpr | ( | const Expr * | Left,
|  | const Expr * | Right
| ) |  |
| static

Definition at line 58 of file RedundantExpressionCheck.cpp.

References areEquivalentNameSpecifier().

Referenced by AST_MATCHER(), and exprEvaluatesToSymbolic().

## ◆ areEquivalentNameSpecifier()

static bool clang::tidy::misc::areEquivalentNameSpecifier | ( | const NestedNameSpecifier * | Left,
|  | const NestedNameSpecifier * | Right
| ) |  |
| static

Definition at line 50 of file RedundantExpressionCheck.cpp.

Referenced by areEquivalentExpr().

## ◆ areEquivalentRanges()

static bool clang::tidy::misc::areEquivalentRanges | ( | BinaryOperatorKind | OpcodeLHS,
|  | const APSInt & | ValueLHS,
|  | BinaryOperatorKind | OpcodeRHS,
|  | const APSInt & | ValueRHS
| ) |  |
| static

Definition at line 139 of file RedundantExpressionCheck.cpp.

References incrementWithoutOverflow().

Referenced by exprEvaluatesToSymbolic().

## ◆ areExclusiveRanges()

static bool clang::tidy::misc::areExclusiveRanges | ( | BinaryOperatorKind | OpcodeLHS,
|  | const APSInt & | ValueLHS,
|  | BinaryOperatorKind | OpcodeRHS,
|  | const APSInt & | ValueRHS
| ) |  |
| static

Definition at line 159 of file RedundantExpressionCheck.cpp.

References incrementWithoutOverflow().

Referenced by exprEvaluatesToSymbolic().

## ◆ areExprsFromDifferentMacros()

static bool clang::tidy::misc::areExprsFromDifferentMacros | ( | const Expr * | LhsExpr,
|  | const Expr * | RhsExpr,
|  | const ASTContext * | AstCtx
| ) |  |
| static

Definition at line 600 of file RedundantExpressionCheck.cpp.

Referenced by clang::tidy::misc::RedundantExpressionCheck::check(), and exprEvaluatesToSymbolic().

## ◆ areExprsMacroAndNonMacro()

static bool clang::tidy::misc::areExprsMacroAndNonMacro | ( | const Expr *& | LhsExpr,
|  | const Expr *& | RhsExpr
| ) |  |
| static

Definition at line 619 of file RedundantExpressionCheck.cpp.

Referenced by clang::tidy::misc::RedundantExpressionCheck::check(), and exprEvaluatesToSymbolic().

## ◆ areSidesBinaryConstExpressions()

static bool clang::tidy::misc::areSidesBinaryConstExpressions | ( | const BinaryOperator *& | BinOp,
|  | const ASTContext * | AstCtx
| ) |  |
| static

Definition at line 550 of file RedundantExpressionCheck.cpp.

Referenced by clang::tidy::misc::RedundantExpressionCheck::check(), and retrieveConstExprFromBothSides().

## ◆ AST_MATCHER() [1/8]

clang::tidy::misc::AST_MATCHER | ( | StringLiteral | ,
|  | containsNul |
| ) |  |

Definition at line 20 of file StringLiteralWithEmbeddedNulCheck.cpp.

## ◆ AST_MATCHER() [2/8]

clang::tidy::misc::AST_MATCHER | ( | Expr | ,
|  | isIntegerConstantExpr |
| ) |  |

Definition at line 293 of file RedundantExpressionCheck.cpp.

## ◆ AST_MATCHER() [3/8]

clang::tidy::misc::AST_MATCHER | ( | BinaryOperator | ,
|  | operandsAreEquivalent |
| ) |  |

Definition at line 299 of file RedundantExpressionCheck.cpp.

References areEquivalentExpr().

## ◆ AST_MATCHER() [4/8]

clang::tidy::misc::AST_MATCHER | ( | ConditionalOperator | ,
|  | expressionsAreEquivalent |
| ) |  |

Definition at line 303 of file RedundantExpressionCheck.cpp.

References areEquivalentExpr().

## ◆ AST_MATCHER() [5/8]

clang::tidy::misc::AST_MATCHER | ( | CallExpr | ,
|  | parametersAreEquivalent |
| ) |  |

Definition at line 307 of file RedundantExpressionCheck.cpp.

References areEquivalentExpr().

## ◆ AST_MATCHER() [6/8]

clang::tidy::misc::AST_MATCHER | ( | BinaryOperator | ,
|  | binaryOperatorIsInMacro |
| ) |  |

Definition at line 312 of file RedundantExpressionCheck.cpp.

## ◆ AST_MATCHER() [7/8]

clang::tidy::misc::AST_MATCHER | ( | ConditionalOperator | ,
|  | conditionalOperatorIsInMacro |
| ) |  |

Definition at line 316 of file RedundantExpressionCheck.cpp.

## ◆ AST_MATCHER() [8/8]

clang::tidy::misc::AST_MATCHER | ( | Expr | ,
|  | isMacro |
| ) |  |

Definition at line 320 of file RedundantExpressionCheck.cpp.

## ◆ AST_MATCHER_P()

clang::tidy::misc::AST_MATCHER_P | ( | Expr | ,
|  | expandedByMacro | ,
|  | llvm::StringSet<> | ,
|  | Names |
| ) |  |

Definition at line 322 of file RedundantExpressionCheck.cpp.

## ◆ canOverloadedOperatorArgsBeModified()

static bool clang::tidy::misc::canOverloadedOperatorArgsBeModified | ( | const FunctionDecl * | OperatorDecl,
|  | bool | checkSecondParam
| ) |  |
| static

Definition at line 473 of file RedundantExpressionCheck.cpp.

References isNonConstReferenceType().

Referenced by clang::tidy::misc::RedundantExpressionCheck::check(), and retrieveRelationalIntegerConstantExpr().

## ◆ countNonPowOfTwoLiteralNum()

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

Definition at line 90 of file SuspiciousEnumUsageCheck.cpp.

References isNonPowerOf2NorNullLiteral().

Referenced by isPossiblyBitMask().

## ◆ enumLength()

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

Return the number of EnumConstantDecls in an EnumDecl.

Definition at line 54 of file SuspiciousEnumUsageCheck.cpp.

Referenced by isPossiblyBitMask().

## ◆ exprEvaluatesToBitwiseNegatedZero()

static bool clang::tidy::misc::exprEvaluatesToBitwiseNegatedZero | ( | BinaryOperatorKind | Opcode,
|  | APSInt | Value
| ) |  |
| static

Definition at line 821 of file RedundantExpressionCheck.cpp.

Referenced by exprEvaluatesToSymbolic().

## ◆ exprEvaluatesToSymbolic()

static bool clang::tidy::misc::exprEvaluatesToSymbolic | ( | BinaryOperatorKind | Opcode,
|  | APSInt | Value
| ) |  |
| 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().

## ◆ exprEvaluatesToZero()

static bool clang::tidy::misc::exprEvaluatesToZero | ( | BinaryOperatorKind | Opcode,
|  | APSInt | Value
| ) |  |
| static

Definition at line 817 of file RedundantExpressionCheck.cpp.

Referenced by exprEvaluatesToSymbolic().

## ◆ getMaxCalculationWidth()

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

Definition at line 56 of file MisplacedWideningCastCheck.cpp.

Referenced by clang::tidy::misc::MisplacedWideningCastCheck::check().

## ◆ guessAlternateQualification()

static QualType clang::tidy::misc::guessAlternateQualification | ( | ASTContext & | Context,
|  | QualType | QT
| ) |  |
| static

Definition at line 32 of file MisplacedConstCheck.cpp.

Referenced by clang::tidy::misc::MisplacedConstCheck::check().

## ◆ hasDisjointValueRange()

static bool clang::tidy::misc::hasDisjointValueRange | ( | const EnumDecl * | Enum1,
|  | const EnumDecl * | Enum2
| ) |  |
| 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().

## ◆ ignoreNoOpCasts()

static const Expr* clang::tidy::misc::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 29 of file SwappedArgumentsCheck.cpp.

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

## ◆ incrementWithoutOverflow()

static bool clang::tidy::misc::incrementWithoutOverflow | ( | const APSInt & | Value,
|  | APSInt & | Result
| ) |  |
| static

Definition at line 44 of file RedundantExpressionCheck.cpp.

Referenced by areEquivalentRanges(), areExclusiveRanges(), and rangesFullyCoverDomain().

## ◆ isFirstWider()

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

Definition at line 170 of file MisplacedWideningCastCheck.cpp.

References relativeCharSizes(), relativeCharSizesW(), and relativeIntSizes().

Referenced by clang::tidy::misc::MisplacedWideningCastCheck::check().

## ◆ isImplicitCastCandidate()

static bool clang::tidy::misc::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 40 of file SwappedArgumentsCheck.cpp.

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

## ◆ isKeyword()

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

Is given TokenKind a keyword?

Definition at line 56 of file MacroParenthesesCheck.cpp.

Referenced by possibleVarDecl().

## ◆ isMaxValAllBitSetLiteral()

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

Definition at line 75 of file SuspiciousEnumUsageCheck.cpp.

Referenced by isPossiblyBitMask().

## ◆ isNonConstReferenceType()

static bool clang::tidy::misc::isNonConstReferenceType | ( | QualType | ParamType | ) |
| static

Definition at line 461 of file RedundantExpressionCheck.cpp.

Referenced by canOverloadedOperatorArgsBeModified().

## ◆ isNonPowerOf2NorNullLiteral()

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

Definition at line 65 of file SuspiciousEnumUsageCheck.cpp.

Referenced by countNonPowOfTwoLiteralNum().

## ◆ isPossiblyBitMask()

static bool clang::tidy::misc::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 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().

## ◆ isSurroundedLeft()

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

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

Definition at line 44 of file MacroParenthesesCheck.cpp.

## ◆ isSurroundedRight()

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

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

Definition at line 50 of file MacroParenthesesCheck.cpp.

## ◆ isVarDeclKeyword()

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

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

Definition at line 70 of file MacroParenthesesCheck.cpp.

Referenced by possibleVarDecl().

## ◆ isWarnOp()

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

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

Definition at line 62 of file MacroParenthesesCheck.cpp.

Referenced by possibleVarDecl().

## ◆ matchBinOpIntegerConstantExpr()

static ast_matchers::internal::Matcher<Expr> clang::tidy::misc::matchBinOpIntegerConstantExpr | ( | StringRef | Id | ) |
| static

Definition at line 383 of file RedundantExpressionCheck.cpp.

References matchIntegerConstantExpr(), and matchSymbolicExpr().

## ◆ matchIntegerConstantExpr()

static ast_matchers::internal::Matcher<Expr> clang::tidy::misc::matchIntegerConstantExpr | ( | StringRef | Id | ) |
| static

Definition at line 337 of file RedundantExpressionCheck.cpp.

Referenced by matchBinOpIntegerConstantExpr(), and matchRelationalIntegerConstantExpr().

## ◆ matchRelationalIntegerConstantExpr()

static ast_matchers::internal::Matcher<Expr> clang::tidy::misc::matchRelationalIntegerConstantExpr | ( | StringRef | Id | ) |
| static

Definition at line 413 of file RedundantExpressionCheck.cpp.

References matchIntegerConstantExpr(), and matchSymbolicExpr().

## ◆ matchSymbolicExpr()

static ast_matchers::internal::Matcher<Expr> clang::tidy::misc::matchSymbolicExpr | ( | StringRef | Id | ) |
| static

Definition at line 362 of file RedundantExpressionCheck.cpp.

Referenced by matchBinOpIntegerConstantExpr(), and matchRelationalIntegerConstantExpr().

## ◆ possibleVarDecl()

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

Is there a possible variable declaration at Tok?

Definition at line 78 of file MacroParenthesesCheck.cpp.

References isKeyword(), isVarDeclKeyword(), isWarnOp(), and Loc.

## ◆ rangesFullyCoverDomain()

static bool clang::tidy::misc::rangesFullyCoverDomain | ( | BinaryOperatorKind | OpcodeLHS,
|  | const APSInt & | ValueLHS,
|  | BinaryOperatorKind | OpcodeRHS,
|  | const APSInt & | ValueRHS
| ) |  |
| static

Definition at line 203 of file RedundantExpressionCheck.cpp.

References incrementWithoutOverflow().

Referenced by exprEvaluatesToSymbolic().

## ◆ rangeSubsumesRange()

static bool clang::tidy::misc::rangeSubsumesRange | ( | BinaryOperatorKind | OpcodeLHS,
|  | const APSInt & | ValueLHS,
|  | BinaryOperatorKind | OpcodeRHS,
|  | const APSInt & | ValueRHS
| ) |  |
| static

Definition at line 250 of file RedundantExpressionCheck.cpp.

Referenced by exprEvaluatesToSymbolic().

## ◆ relativeCharSizes()

static int clang::tidy::misc::relativeCharSizes | ( | BuiltinType::Kind | Kind | ) |
| static

Definition at line 132 of file MisplacedWideningCastCheck.cpp.

Referenced by isFirstWider().

## ◆ relativeCharSizesW()

static int clang::tidy::misc::relativeCharSizesW | ( | BuiltinType::Kind | Kind | ) |
| static

Definition at line 151 of file MisplacedWideningCastCheck.cpp.

Referenced by isFirstWider().

## ◆ relativeIntSizes()

static int clang::tidy::misc::relativeIntSizes | ( | BuiltinType::Kind | Kind | ) |
| static

Definition at line 97 of file MisplacedWideningCastCheck.cpp.

Referenced by isFirstWider().

## ◆ removeArgument()

static FixItHint clang::tidy::misc::removeArgument | ( | const MatchFinder::MatchResult & | Result,
|  | const CallExpr * | Call,
|  | unsigned | Index
| ) |  |
| static

Definition at line 65 of file UnusedParametersCheck.cpp.

References removeNode().

## ◆ removeNode()

template<typename T >

static CharSourceRange clang::tidy::misc::removeNode | ( | const MatchFinder::MatchResult & | Result,
|  | const T * | PrevNode,
|  | const T * | Node,
|  | const T * | NextNode
| ) |  |
| static

Definition at line 39 of file UnusedParametersCheck.cpp.

Referenced by removeArgument(), and removeParameter().

## ◆ removeParameter()

static FixItHint clang::tidy::misc::removeParameter | ( | const MatchFinder::MatchResult & | Result,
|  | const FunctionDecl * | Function,
|  | unsigned | Index
| ) |  |
| static

Definition at line 56 of file UnusedParametersCheck.cpp.

References removeNode().

## ◆ retrieveBinOpIntegerConstantExpr()

static bool clang::tidy::misc::retrieveBinOpIntegerConstantExpr | ( | const MatchFinder::MatchResult & | Result,
|  | StringRef | Id,
|  | BinaryOperatorKind & | Opcode,
|  | const Expr *& | Symbol,
|  | APSInt & | Value
| ) |  |
| static

Definition at line 400 of file RedundantExpressionCheck.cpp.

References retrieveIntegerConstantExpr(), and retrieveSymbolicExpr().

Referenced by exprEvaluatesToSymbolic().

## ◆ retrieveConstExprFromBothSides()

static bool clang::tidy::misc::retrieveConstExprFromBothSides | ( | const BinaryOperator *& | BinOp,
|  | BinaryOperatorKind & | MainOpcode,
|  | BinaryOperatorKind & | SideOpcode,
|  | const Expr *& | LhsConst,
|  | const Expr *& | RhsConst,
|  | const ASTContext * | AstCtx
| ) |  |
| static

Definition at line 568 of file RedundantExpressionCheck.cpp.

References areSidesBinaryConstExpressions().

Referenced by clang::tidy::misc::RedundantExpressionCheck::check().

## ◆ retrieveIntegerConstantExpr() [1/2]

static bool clang::tidy::misc::retrieveIntegerConstantExpr | ( | const MatchFinder::MatchResult & | Result,
|  | StringRef | Id,
|  | APSInt & | Value,
|  | const Expr *& | ConstExpr
| ) |  |
| static

Definition at line 345 of file RedundantExpressionCheck.cpp.

## ◆ retrieveIntegerConstantExpr() [2/2]

static bool clang::tidy::misc::retrieveIntegerConstantExpr | ( | const MatchFinder::MatchResult & | Result,
|  | StringRef | Id,
|  | APSInt & | Value
| ) |  |
| static

Definition at line 354 of file RedundantExpressionCheck.cpp.

Referenced by exprEvaluatesToSymbolic(), retrieveBinOpIntegerConstantExpr(), and retrieveRelationalIntegerConstantExpr().

## ◆ retrieveRelationalIntegerConstantExpr()

static bool clang::tidy::misc::retrieveRelationalIntegerConstantExpr | ( | const MatchFinder::MatchResult & | Result,
|  | StringRef | Id,
|  | const Expr *& | OperandExpr,
|  | BinaryOperatorKind & | Opcode,
|  | const Expr *& | Symbol,
|  | APSInt & | Value,
|  | const Expr *& | ConstExpr
| ) |  |
| static

Definition at line 493 of file RedundantExpressionCheck.cpp.

References canOverloadedOperatorArgsBeModified(), retrieveIntegerConstantExpr(), and retrieveSymbolicExpr().

Referenced by exprEvaluatesToSymbolic().

## ◆ retrieveSymbolicExpr()

static bool clang::tidy::misc::retrieveSymbolicExpr | ( | const MatchFinder::MatchResult & | Result,
|  | StringRef | Id,
|  | const Expr *& | SymExpr
| ) |  |
| static

Definition at line 370 of file RedundantExpressionCheck.cpp.

Referenced by exprEvaluatesToSymbolic(), retrieveBinOpIntegerConstantExpr(), and retrieveRelationalIntegerConstantExpr().

## ◆ ShouldCheckDecl()

static bool clang::tidy::misc::ShouldCheckDecl | ( | const Decl * | TargetDecl | ) |
| static

Definition at line 24 of file UnusedUsingDeclsCheck.cpp.

## ◆ transformSubToCanonicalAddExpr()

static void clang::tidy::misc::transformSubToCanonicalAddExpr | ( | BinaryOperatorKind & | Opcode,
|  | APSInt & | Value
| ) |  |
| static

Definition at line 285 of file RedundantExpressionCheck.cpp.

## Variable Documentation

## ◆ BitmaskErrorMessage

const char clang::tidy::misc::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 24 of file SuspiciousEnumUsageCheck.cpp.

## ◆ BitmaskNoteMessage

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

Definition at line 34 of file SuspiciousEnumUsageCheck.cpp.

## ◆ BitmaskVarErrorMessage

const char clang::tidy::misc::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 29 of file SuspiciousEnumUsageCheck.cpp.

## ◆ CompareMessage

const StringRef clang::tidy::misc::CompareMessage
| static

Initial value:
= "do not use 'compare' to test equality "
"of strings; use the string equality "
"operator instead"

Definition at line 22 of file StringCompareCheck.cpp.

Referenced by clang::tidy::misc::StringCompareCheck::check().

## ◆ DifferentEnumErrorMessage

const char clang::tidy::misc::DifferentEnumErrorMessage[]
| static

Initial value:
=
"enum values are from different enum types"

Definition at line 21 of file SuspiciousEnumUsageCheck.cpp.

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

## ◆ KnownBannedMacroNames

const llvm::StringSet clang::tidy::misc::KnownBannedMacroNames
| static

Initial value:
= {"EAGAIN", "EWOULDBLOCK",
"SIGCLD", "SIGCHLD"}

Definition at line 41 of file RedundantExpressionCheck.cpp.

## ◆ KnownStringCompareFunctions

const char clang::tidy::misc::KnownStringCompareFunctions[]
| static

Definition at line 25 of file SuspiciousStringCompareCheck.cpp.