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 SourceLocation Loc
'#' location in the include directive
void storeOptions(ClangTidyOptions::OptionMap &Options) override
Should store all options supported by this check with their current values or default values for opti...
Looks for boolean expressions involving boolean constants and simplifies them to use the appropriate ...
Base class for all clang-tidy checks.
void check(const ast_matchers::MatchFinder::MatchResult &Result) override
ClangTidyChecks that register ASTMatchers should do the actual work in here.
SimplifyBooleanExprCheck(StringRef Name, ClangTidyContext *Context)
static constexpr llvm::StringLiteral Name
std::map< std::string, std::string > OptionMap
void registerMatchers(ast_matchers::MatchFinder *Finder) override
Override this to register AST matchers with Finder.
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
Every ClangTidyCheck reports errors through a DiagnosticsEngine provided by this context.