================
@@ -747,6 +747,31 @@ static bool areSidesBinaryConstExpressions(const 
BinaryOperator *&BinOp, const A
   return false;
 }
 
+static bool
+areSidesBinaryConstExpressionsOrDefines(const BinaryOperator *&BinOp,
+                                        const ASTContext *AstCtx) {
+  if (areSidesBinaryConstExpressions(BinOp, AstCtx))
+    return true;
+
+  const auto *Lhs = BinOp->getLHS();
+  const auto *Rhs = BinOp->getRHS();
+
+  if (!Lhs || !Rhs)
+    return false;
+
+  auto IsDefineExpr = [AstCtx](const Expr *E) {
+    SourceRange Lsr = E->getSourceRange();
+    if (!Lsr.getBegin().isMacroID() || E->isValueDependent() ||
+        !E->isIntegerConstantExpr(*AstCtx))
+      return false;
+    return true;
+  };
+
+  if (IsDefineExpr(Lhs) || IsDefineExpr(Rhs))
+    return true;
+  return false;
----------------
PiotrZSL wrote:

```suggestion
  return IsDefineExpr(Lhs) || IsDefineExpr(Rhs);
```

https://github.com/llvm/llvm-project/pull/121960
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to