[clang] [clang] Rework `hasBooleanRepresentation`. (PR #136038)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 17 11:56:17 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:
Sure, that's what I was trying to understand. An enumeration whose underlying type is bool and a bool have the same representation as an i1. So does `unsigned _BitInt(1)`, so does that have a boolean representation?
("representation" is what is throwing me off.)
https://github.com/llvm/llvm-project/pull/136038
More information about the cfe-commits
mailing list