clang-tools 22.0.0git
RedundantExpressionCheck.cpp File Reference
#include "RedundantExpressionCheck.h"
#include "../utils/Matchers.h"
#include "clang/AST/ASTContext.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/Basic/LLVM.h"
#include "clang/Basic/SourceLocation.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Lex/Lexer.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/APSInt.h"
#include "llvm/ADT/FoldingSet.h"
#include "llvm/ADT/SmallBitVector.h"
#include "llvm/Support/FormatVariadic.h"
#include <algorithm>
#include <cassert>
#include <cstdint>
#include <optional>
#include <string>

Go to the source code of this file.

Namespaces

namespace  clang
 ===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
namespace  clang::tidy
namespace  clang::tidy::misc

Functions

static bool clang::tidy::misc::incrementWithoutOverflow (const APSInt &Value, APSInt &Result)
static bool clang::tidy::misc::areEquivalentExpr (const Expr *Left, const Expr *Right)
static bool clang::tidy::misc::areEquivalentRanges (BinaryOperatorKind OpcodeLHS, const APSInt &ValueLHS, BinaryOperatorKind OpcodeRHS, const APSInt &ValueRHS)
static bool clang::tidy::misc::areExclusiveRanges (BinaryOperatorKind OpcodeLHS, const APSInt &ValueLHS, BinaryOperatorKind OpcodeRHS, const APSInt &ValueRHS)
static bool clang::tidy::misc::rangesFullyCoverDomain (BinaryOperatorKind OpcodeLHS, const APSInt &ValueLHS, BinaryOperatorKind OpcodeRHS, const APSInt &ValueRHS)
static bool clang::tidy::misc::rangeSubsumesRange (BinaryOperatorKind OpcodeLHS, const APSInt &ValueLHS, BinaryOperatorKind OpcodeRHS, const APSInt &ValueRHS)
static void clang::tidy::misc::transformSubToCanonicalAddExpr (BinaryOperatorKind &Opcode, APSInt &Value)
static OverloadedOperatorKind clang::tidy::misc::getOp (const BinaryOperator *Op)
static OverloadedOperatorKind clang::tidy::misc::getOp (const CXXOperatorCallExpr *Op)
static std::pair< const Expr *, const Expr * > clang::tidy::misc::getOperands (const BinaryOperator *Op)
static std::pair< const Expr *, const Expr * > clang::tidy::misc::getOperands (const CXXOperatorCallExpr *Op)
template<typename TExpr>
static const TExpr * clang::tidy::misc::checkOpKind (const Expr *TheExpr, OverloadedOperatorKind OpKind)
template<typename TExpr, unsigned N>
static bool clang::tidy::misc::collectOperands (const Expr *Part, SmallVector< const Expr *, N > &AllOperands, OverloadedOperatorKind OpKind)
template<typename TExpr>
static bool clang::tidy::misc::hasSameOperatorParent (const Expr *TheExpr, OverloadedOperatorKind OpKind, ASTContext &Context)
template<typename TExpr>
static bool clang::tidy::misc::markDuplicateOperands (const TExpr *TheExpr, ast_matchers::internal::BoundNodesTreeBuilder *Builder, ASTContext &Context)
static ast_matchers::internal::Matcher< Expr > clang::tidy::misc::matchIntegerConstantExpr (StringRef Id)
static bool clang::tidy::misc::retrieveIntegerConstantExpr (const MatchFinder::MatchResult &Result, StringRef Id, APSInt &Value, const Expr *&ConstExpr)
static bool clang::tidy::misc::retrieveIntegerConstantExpr (const MatchFinder::MatchResult &Result, StringRef Id, APSInt &Value)
static ast_matchers::internal::Matcher< Expr > clang::tidy::misc::matchSymbolicExpr (StringRef Id)
static bool clang::tidy::misc::retrieveSymbolicExpr (const MatchFinder::MatchResult &Result, StringRef Id, const Expr *&SymExpr)
static ast_matchers::internal::Matcher< Expr > clang::tidy::misc::matchBinOpIntegerConstantExpr (StringRef Id)
static bool clang::tidy::misc::retrieveBinOpIntegerConstantExpr (const MatchFinder::MatchResult &Result, StringRef Id, BinaryOperatorKind &Opcode, const Expr *&Symbol, APSInt &Value)
static ast_matchers::internal::Matcher< Expr > clang::tidy::misc::matchRelationalIntegerConstantExpr (StringRef Id)
static bool clang::tidy::misc::isNonConstReferenceType (QualType ParamType)
static bool clang::tidy::misc::canOverloadedOperatorArgsBeModified (const CXXOperatorCallExpr *OperatorCall, bool CheckSecondParam)
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 bool clang::tidy::misc::areSidesBinaryConstExpressions (const BinaryOperator *&BinOp, const ASTContext *AstCtx)
static bool clang::tidy::misc::areSidesBinaryConstExpressionsOrDefinesOrIntegerConstant (const BinaryOperator *&BinOp, const ASTContext *AstCtx)
static bool clang::tidy::misc::retrieveConstExprFromBothSides (const BinaryOperator *&BinOp, BinaryOperatorKind &MainOpcode, BinaryOperatorKind &SideOpcode, const Expr *&LhsConst, const Expr *&RhsConst, const ASTContext *AstCtx)
static bool clang::tidy::misc::isSameRawIdentifierToken (const Token &T1, const Token &T2, const SourceManager &SM)
static bool clang::tidy::misc::isTokAtEndOfExpr (SourceRange ExprSR, Token T, const SourceManager &SM)
static bool clang::tidy::misc::areExprsFromDifferentMacros (const Expr *LhsExpr, const Expr *RhsExpr, const ASTContext *AstCtx)
 Returns true if both LhsExpr and RhsExpr are macro expressions and they are expanded from different macros.
static bool clang::tidy::misc::areExprsMacroAndNonMacro (const Expr *&LhsExpr, const Expr *&RhsExpr)
static bool clang::tidy::misc::areStringsSameIgnoreSpaces (const llvm::StringRef Left, const llvm::StringRef Right)
static bool clang::tidy::misc::areExprsSameMacroOrLiteral (const BinaryOperator *BinOp, const ASTContext *Context)
static bool clang::tidy::misc::exprEvaluatesToZero (BinaryOperatorKind Opcode, APSInt Value)
static bool clang::tidy::misc::exprEvaluatesToBitwiseNegatedZero (BinaryOperatorKind Opcode, APSInt Value)
static bool clang::tidy::misc::exprEvaluatesToSymbolic (BinaryOperatorKind Opcode, APSInt Value)

Variables

static constexpr llvm::StringLiteral clang::tidy::misc::KnownBannedMacroNames []