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

Philipp Rados via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 21 08:43:46 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:

It does make sense for C++. It should be issued for both C and C++ (I'm not proficient in OpenMP/Cuda so I can't really talk for those).

I wanted to clarify that with the `if (getLangOpts().CPlusPlus || isC) && !getLangOpts().ObjC) {...}` line, that this would actually just affect C and C++ and none of the other languages.

Of course I could also just do `!isCuda && !isOpenMP && !isObjC` so that just C and C++ remain but that seems a little verbose.

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


More information about the cfe-commits mailing list