clang-tools 19.0.0git
Classes | Public Types | Public Member Functions | Static Public Member Functions | List of all members
clang::tidy::readability::SimplifyBooleanExprCheck::Visitor Class Reference
Inheritance diagram for clang::tidy::readability::SimplifyBooleanExprCheck::Visitor:
Inheritance graph
[legend]

Classes

struct  NodeAndBool
 

Public Types

using ExprAndBool = NodeAndBool< Expr >
 
using DeclAndBool = NodeAndBool< Decl >
 

Public Member Functions

 Visitor (SimplifyBooleanExprCheck *Check, ASTContext &Context)
 
bool traverse ()
 
bool dataTraverseStmtPre (Stmt *S)
 
bool dataTraverseStmtPost (Stmt *S)
 
bool VisitBinaryOperator (const BinaryOperator *Op) const
 
Stmt * parent () const
 
bool VisitIfStmt (IfStmt *If)
 
bool VisitConditionalOperator (ConditionalOperator *Cond)
 
bool VisitCompoundStmt (CompoundStmt *CS)
 
bool isExpectedUnaryLNot (const Expr *E)
 
bool isExpectedBinaryOp (const Expr *E)
 
bool nestedDemorgan (const Expr *E, unsigned NestingLevel)
 
bool TraverseUnaryOperator (UnaryOperator *Op)
 

Static Public Member Functions

static bool shouldIgnore (Stmt *S)
 
static std::optional< bool > getAsBoolLiteral (const Expr *E, bool FilterMacro)
 
static ExprAndBool parseReturnLiteralBool (const Stmt *S)
 Detect's return (true|false|!true|!false);.
 
template<typename Functor >
static auto checkSingleStatement (Stmt *S, Functor F) -> decltype(F(S))
 If S is not a CompoundStmt, applies F on S, otherwise if there is only 1 statement in the CompoundStmt, applies F on that single statement.
 
template<typename Functor >
static bool checkEitherSide (const BinaryOperator *BO, Functor Func)
 

Detailed Description

Definition at line 260 of file SimplifyBooleanExprCheck.cpp.

Member Typedef Documentation

◆ DeclAndBool

Definition at line 330 of file SimplifyBooleanExprCheck.cpp.

◆ ExprAndBool

Definition at line 329 of file SimplifyBooleanExprCheck.cpp.

Constructor & Destructor Documentation

◆ Visitor()

clang::tidy::readability::SimplifyBooleanExprCheck::Visitor::Visitor ( SimplifyBooleanExprCheck Check,
ASTContext &  Context 
)
inline

Definition at line 264 of file SimplifyBooleanExprCheck.cpp.

Member Function Documentation

◆ checkEitherSide()

template<typename Functor >
static bool clang::tidy::readability::SimplifyBooleanExprCheck::Visitor::checkEitherSide ( const BinaryOperator *  BO,
Functor  Func 
)
inlinestatic

Definition at line 528 of file SimplifyBooleanExprCheck.cpp.

Referenced by nestedDemorgan(), and TraverseUnaryOperator().

◆ checkSingleStatement()

template<typename Functor >
static auto clang::tidy::readability::SimplifyBooleanExprCheck::Visitor::checkSingleStatement ( Stmt *  S,
Functor  F 
) -> decltype(F(S))
inlinestatic

If S is not a CompoundStmt, applies F on S, otherwise if there is only 1 statement in the CompoundStmt, applies F on that single statement.

Definition at line 348 of file SimplifyBooleanExprCheck.cpp.

Referenced by VisitCompoundStmt(), and VisitIfStmt().

◆ dataTraverseStmtPost()

bool clang::tidy::readability::SimplifyBooleanExprCheck::Visitor::dataTraverseStmtPost ( Stmt *  S)
inline

Definition at line 291 of file SimplifyBooleanExprCheck.cpp.

References shouldIgnore().

◆ dataTraverseStmtPre()

bool clang::tidy::readability::SimplifyBooleanExprCheck::Visitor::dataTraverseStmtPre ( Stmt *  S)
inline

Definition at line 280 of file SimplifyBooleanExprCheck.cpp.

References shouldIgnore().

◆ getAsBoolLiteral()

static std::optional< bool > clang::tidy::readability::SimplifyBooleanExprCheck::Visitor::getAsBoolLiteral ( const Expr *  E,
bool  FilterMacro 
)
inlinestatic

◆ isExpectedBinaryOp()

bool clang::tidy::readability::SimplifyBooleanExprCheck::Visitor::isExpectedBinaryOp ( const Expr *  E)
inline

Definition at line 521 of file SimplifyBooleanExprCheck.cpp.

References E.

Referenced by TraverseUnaryOperator().

◆ isExpectedUnaryLNot()

bool clang::tidy::readability::SimplifyBooleanExprCheck::Visitor::isExpectedUnaryLNot ( const Expr *  E)
inline

Definition at line 516 of file SimplifyBooleanExprCheck.cpp.

References E.

Referenced by nestedDemorgan(), and TraverseUnaryOperator().

◆ nestedDemorgan()

bool clang::tidy::readability::SimplifyBooleanExprCheck::Visitor::nestedDemorgan ( const Expr *  E,
unsigned  NestingLevel 
)
inline

◆ parent()

Stmt * clang::tidy::readability::SimplifyBooleanExprCheck::Visitor::parent ( ) const
inline

Definition at line 357 of file SimplifyBooleanExprCheck.cpp.

Referenced by TraverseUnaryOperator(), and VisitIfStmt().

◆ parseReturnLiteralBool()

static ExprAndBool clang::tidy::readability::SimplifyBooleanExprCheck::Visitor::parseReturnLiteralBool ( const Stmt *  S)
inlinestatic

Detect's return (true|false|!true|!false);.

Definition at line 333 of file SimplifyBooleanExprCheck.cpp.

References getAsBoolLiteral().

Referenced by VisitCompoundStmt(), and VisitIfStmt().

◆ shouldIgnore()

static bool clang::tidy::readability::SimplifyBooleanExprCheck::Visitor::shouldIgnore ( Stmt *  S)
inlinestatic

Definition at line 269 of file SimplifyBooleanExprCheck.cpp.

Referenced by dataTraverseStmtPost(), and dataTraverseStmtPre().

◆ traverse()

bool clang::tidy::readability::SimplifyBooleanExprCheck::Visitor::traverse ( )
inline

◆ TraverseUnaryOperator()

bool clang::tidy::readability::SimplifyBooleanExprCheck::Visitor::TraverseUnaryOperator ( UnaryOperator *  Op)
inline

◆ VisitBinaryOperator()

bool clang::tidy::readability::SimplifyBooleanExprCheck::Visitor::VisitBinaryOperator ( const BinaryOperator *  Op) const
inline

Definition at line 299 of file SimplifyBooleanExprCheck.cpp.

◆ VisitCompoundStmt()

bool clang::tidy::readability::SimplifyBooleanExprCheck::Visitor::VisitCompoundStmt ( CompoundStmt *  CS)
inline

◆ VisitConditionalOperator()

bool clang::tidy::readability::SimplifyBooleanExprCheck::Visitor::VisitConditionalOperator ( ConditionalOperator *  Cond)
inline

Definition at line 441 of file SimplifyBooleanExprCheck.cpp.

References getAsBoolLiteral().

◆ VisitIfStmt()

bool clang::tidy::readability::SimplifyBooleanExprCheck::Visitor::VisitIfStmt ( IfStmt *  If)
inline

The documentation for this class was generated from the following file: