[clang] [NFC] Fix Parens on assertion from 147514 (PR #158635)

Bruno De Fraine via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 15 06:34:34 PDT 2025


================
@@ -2142,9 +2142,9 @@ Value *ScalarExprEmitter::VisitInitListExpr(InitListExpr *E) {
   bool Ignore = TestAndClearIgnoreResultAssign();
   (void)Ignore;
   unsigned NumInitElements = E->getNumInits();
-  assert(Ignore == false ||
-         (NumInitElements == 0 && E->getType()->isVoidType()) &&
-             "init list ignored");
+  assert((Ignore == false ||
+          (NumInitElements == 0 && E->getType()->isVoidType())) &&
+         "init list ignored");
----------------
brunodf-snps wrote:

The following alternative is perhaps more clear, and allows to remove the `(void)Ignore` line from just above.

```suggestion
  if (Ignore)
    assert(NumInitElements == 0 && E->getType()->isVoidType()
           && "only ignore irrelevant init list");
```

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


More information about the cfe-commits mailing list