[clang] [Clang] omit parentheses in fold expressions with a single expansion (PR #110761)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 7 06:36:07 PDT 2024


================
@@ -20224,6 +20224,8 @@ void Sema::DiagnoseEqualityWithExtraParens(ParenExpr *ParenE) {
     return;
 
   Expr *E = ParenE->IgnoreParens();
+  if (ParenE->isProducedByFoldExpansion() && ParenE->getSubExpr() == E)
+    return;
----------------
erichkeane wrote:

So we would expect htis to still diagnose in a case where:

`if (((a ==b )) or ...`

.  Note hte extra parens there.  Does this still work?  My point being, perhaps we have to strip off this set of parens before calling this function instead.

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


More information about the cfe-commits mailing list