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

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 20 07:32:21 PST 2025


================
@@ -687,6 +687,48 @@ void Sema::diagnoseZeroToNullptrConversion(CastKind Kind, const Expr *E) {
       << FixItHint::CreateReplacement(E->getSourceRange(), "nullptr");
 }
 
+void Sema::DiagnoseAssignmentBoolContext(Expr *E, QualType Ty) {
+  // Use copy to not alter original expression.
----------------
erichkeane wrote:

This is unnecessary.  You don't use the original value of `E` anywhere else below, so there isn't a good reason to  not just use the parameter.

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


More information about the cfe-commits mailing list