[clang] [clang][NFC] Refactor CodeGen's hasBooleanRepresentation (PR #134159)
Andy Kaylor via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 16 10:09:44 PDT 2025
andykaylor wrote:
> Given that there are already similar functions in the `Type` class -- e.g. `has{Signed,Unsigned,}IntegerRepresentation`, `hasFloatingRepresentation` -- it seems a bit inconsistent the definition of `hasBooleanRepresentation`. I would expect that "vector of booleans" to have `hasBooleanRepresentation` returning `true`, and I would expect `_Atomic(<type with boolean representation>)` to have `hasBooleanRepresentation` returning `false`. Any thoughts?
Yes, I also noticed that when I was moving this. I wasn't sure which way it should go, so I opted to keep the code the same as it was in its original location. There is already a precedent (`hasPointerRepresentation`) for not including vectors. Also, vectors of Booleans have different considerations that scalar Booleans. For instance, they are stored differently in memory.
Maybe the function should have a different name to avoid confusion?
https://github.com/llvm/llvm-project/pull/134159
More information about the cfe-commits
mailing list