[clang-tools-extra] [clang-tidy] Apply DeMorgan to overloaded operator in the 'readability-simplify-boolean-expr' check (PR #164141)

Baranov Victor via cfe-commits cfe-commits at lists.llvm.org
Sun Oct 19 05:30:00 PDT 2025


================
@@ -829,22 +829,22 @@ static bool flipDemorganSide(SmallVectorImpl<FixItHint> &Fixes,
                              const ASTContext &Ctx, const Expr *E,
                              std::optional<BinaryOperatorKind> OuterBO);
 
-/// Inverts \p BinOp, Removing \p Parens if they exist and are safe to remove.
-/// returns \c true if there is any issue building the Fixes, \c false
-/// otherwise.
-static bool
-flipDemorganBinaryOperator(SmallVectorImpl<FixItHint> &Fixes,
-                           const ASTContext &Ctx, const BinaryOperator *BinOp,
-                           std::optional<BinaryOperatorKind> OuterBO,
-                           const ParenExpr *Parens = nullptr) {
-  switch (BinOp->getOpcode()) {
+/// Inverts \p BO, \p LHS, and \p RHS, Removing \p Parens if they exist and are
+/// safe to remove. returns \c true if there is any issue building the Fixes, \c
+/// false otherwise.
+static bool flipDemorganBinaryOperator(
+    SmallVectorImpl<FixItHint> &Fixes, const ASTContext &Ctx,
+    BinaryOperatorKind BO, const Expr *LHS, const Expr *RHS, SourceRange Range,
----------------
vbvictor wrote:

Could we give a more meaningful name for `Range`? From where to where this range is

https://github.com/llvm/llvm-project/pull/164141


More information about the cfe-commits mailing list