[clang] [clang] Rework `hasBooleanRepresentation`. (PR #136038)
Michele Scandale via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 17 10:54:18 PDT 2025
================
@@ -8623,6 +8624,13 @@ inline bool Type::isIntegralOrEnumerationType() const {
inline bool Type::isBooleanType() const {
if (const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
return BT->getKind() == BuiltinType::Bool;
+ if (const EnumType *ET = dyn_cast<EnumType>(CanonicalType)) {
+ // Incomplete enum types are not treated as integer types.
+ // FIXME: In C++, enum types are never integer types.
+ return IsEnumDeclComplete(ET->getDecl()) &&
+ !IsEnumDeclScoped(ET->getDecl()) &&
----------------
michele-scandale wrote:
This is just the same code that exist in `isIntegerType`. I am puzzled by this code as well, but I suppose there is a good reason for it.
https://github.com/llvm/llvm-project/pull/136038
More information about the cfe-commits
mailing list