[clang] [clang] Added warn-assignment-bool-context (PR #115234)

Philipp Rados via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 21 09:08:35 PST 2025


================
@@ -761,6 +803,17 @@ ExprResult Sema::ImpCastExprToType(Expr *E, QualType Ty,
     }
   }
 
+  // FIXME: Doesn't include C89, so this warning isn't emitted when passing
+  // `std=c89`.
+  auto isC = getLangOpts().C99 || getLangOpts().C11 || getLangOpts().C17 ||
----------------
PhilippRados wrote:

 > Why doesn't this make sense in ObjC?

I thought that this was some kind of common pattern in ObjC which is why the existing `DiagnoseAssignmentAsCondition()` also special cases this. I think I might have also seen some tests that check this, but I could be wrong.

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


More information about the cfe-commits mailing list