[clang] [clang] Implement -fstrict-bool (PR #160790)

via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 2 09:44:00 PST 2025


=?utf-8?q?Félix?= Cloutier <fcloutier at apple.com>,
=?utf-8?q?Félix?= Cloutier <fcloutier at apple.com>,
=?utf-8?q?Félix?= Cloutier <fcloutier at apple.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/160790 at github.com>


================
@@ -213,6 +213,16 @@ class CodeGenOptions : public CodeGenOptionsBase {
               ///< larger debug info than `Basic`.
   };
 
+  enum class BoolFromMem {
+    Strict,   ///< In-memory bool values are assumed to be 0 or 1, and any other
+              ///< value is UB.
+    Truncate, ///< Convert in-memory bools to i1 by checking if the least
+              ///< significant bit is 1.
+    NonZero,  ///< Convert in-memory bools to i1 by checking if any bit is set
+              ///< to 1.
----------------
apple-fcloutier wrote:

Something we currently use as in "the name already exists" or "the change references it"? I think you may have been looking at an older version of the change, this is now an `enum class`, so if the concern was scoping it should be resolved. (With that said, within `CodeGenOptions`, there was no conflict.)

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


More information about the cfe-commits mailing list