9 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_SIMPLIFY_BOOLEAN_EXPR_H
10 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_SIMPLIFY_BOOLEAN_EXPR_H
12 #include "../ClangTidyCheck.h"
16 namespace readability {
29 void check(
const ast_matchers::MatchFinder::MatchResult &Result)
override;
34 void reportBinOp(
const ast_matchers::MatchFinder::MatchResult &Result,
35 const BinaryOperator *Op);
37 void matchBoolCondition(ast_matchers::MatchFinder *Finder,
bool Value,
40 void matchTernaryResult(ast_matchers::MatchFinder *Finder,
bool Value,
43 void matchIfReturnsBool(ast_matchers::MatchFinder *Finder,
bool Value,
46 void matchIfAssignsBool(ast_matchers::MatchFinder *Finder,
bool Value,
49 void matchCompoundIfReturnsBool(ast_matchers::MatchFinder *Finder,
bool Value,
53 replaceWithThenStatement(
const ast_matchers::MatchFinder::MatchResult &Result,
54 const CXXBoolLiteralExpr *BoolLiteral);
57 replaceWithElseStatement(
const ast_matchers::MatchFinder::MatchResult &Result,
58 const CXXBoolLiteralExpr *FalseConditionRemoved);
61 replaceWithCondition(
const ast_matchers::MatchFinder::MatchResult &Result,
62 const ConditionalOperator *Ternary,
63 bool Negated =
false);
65 void replaceWithReturnCondition(
66 const ast_matchers::MatchFinder::MatchResult &Result,
const IfStmt *If,
67 bool Negated =
false);
70 replaceWithAssignment(
const ast_matchers::MatchFinder::MatchResult &Result,
71 const IfStmt *If,
bool Negated =
false);
73 void replaceCompoundReturnWithCondition(
74 const ast_matchers::MatchFinder::MatchResult &Result,
75 const CompoundStmt *Compound,
bool Negated =
false);
77 void issueDiag(
const ast_matchers::MatchFinder::MatchResult &Result,
79 SourceRange ReplacementRange, StringRef Replacement);
81 const bool ChainedConditionalReturn;
82 const bool ChainedConditionalAssignment;
89 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_SIMPLIFY_BOOLEAN_EXPR_H