[clang] [clang] Rework `hasBooleanRepresentation`. (PR #136038)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 17 11:10:22 PDT 2025


================
@@ -2336,16 +2336,9 @@ bool Type::isArithmeticType() const {
 }
 
 bool Type::hasBooleanRepresentation() const {
-  if (isBooleanType())
-    return true;
-
-  if (const EnumType *ET = getAs<EnumType>())
-    return ET->getDecl()->getIntegerType()->isBooleanType();
-
-  if (const AtomicType *AT = getAs<AtomicType>())
-    return AT->getValueType()->hasBooleanRepresentation();
-
-  return false;
+  if (const auto *VT = dyn_cast<VectorType>(CanonicalType))
----------------
AaronBallman wrote:

All of those are different from your changes here though. In each of those cases, the type *is* of the requested representation or a vector of that type. In this PR, enums are reported as having a boolean representation, which is not something anyone will expect.

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


More information about the cfe-commits mailing list