[clang-tools-extra] [clang-tidy] Address false positives in misc-redundant-expression checker (PR #121960)

via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 13 11:00:33 PST 2025


================
@@ -852,6 +874,58 @@ static bool areExprsMacroAndNonMacro(const Expr *&LhsExpr,
 
   return LhsLoc.isMacroID() != RhsLoc.isMacroID();
 }
+
+static bool areExprsSameMacroOrLiteral(const BinaryOperator *BinOp,
+                                       const ASTContext *Context) {
+
+  if (!BinOp)
+    return false;
+
+  const Expr *Lhs = BinOp->getLHS();
+  const Expr *Rhs = BinOp->getRHS();
+  const SourceManager &SM = Context->getSourceManager();
+
+  SourceRange Lsr = Lhs->getSourceRange();
----------------
earnol wrote:

Also agreed.

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


More information about the cfe-commits mailing list