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

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 15 06:37:31 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");
----------------
erichkeane wrote:

That version ends up having a weird dead branch in non-asserts builds, and is problematic as `assert` is a macro.  I don't see the losing the cast as worth the additional risk/breaking up the purpose of the assert here, so I'm going to leave it.

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


More information about the cfe-commits mailing list