[clang] [clang][NFC] Specify Type and ExtQuals as having 16-byte alignment (PR #68377)
Vlad Serebrennikov via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 5 23:34:52 PDT 2023
================
@@ -1982,9 +1986,9 @@ class alignas(8) Type : public ExtQualsTypeCommonBase {
Type(TypeClass tc, QualType canon, TypeDependence Dependence)
: ExtQualsTypeCommonBase(this,
canon.isNull() ? QualType(this_(), 0) : canon) {
- static_assert(sizeof(*this) <= 8 + sizeof(ExtQualsTypeCommonBase),
+ static_assert(sizeof(*this) <= 16 + sizeof(ExtQualsTypeCommonBase),
"changing bitfields changed sizeof(Type)!");
----------------
Endilll wrote:
This check has been broken, because `sizeof` didn't take into the account that `Type` objects are actually laid out in memory on 16-byte boundary, which results in 24 bytes of data and 8 bytes of padding. My change just affirms the status quo that Type is indeed takes 16 bytes more memory than `ExtQuals`, which has size 16.
https://github.com/llvm/llvm-project/pull/68377
More information about the cfe-commits
mailing list