[clang] [Clang][Windows] Preserve x86_fp80 and vector alignment under #pragma pack. (PR #208256)
Oliver Hunt via cfe-commits
cfe-commits at lists.llvm.org
Sat Aug 1 13:22:07 PDT 2026
================
@@ -2539,9 +2548,22 @@ TypeInfo ASTContext::getTypeInfoImpl(const Type *T) const {
const ASTRecordLayout &Layout = getASTRecordLayout(RD);
Width = toBits(Layout.getSize());
Align = toBits(Layout.getAlignment());
- AlignRequirement = RD->hasAttr<AlignedAttr>()
- ? AlignRequirementKind::RequiredByRecord
- : AlignRequirementKind::None;
+ // Check if the record has an aligned attribute, or if it contains
+ // fields with ABI-required alignment (e.g., x86_fp80).
+ if (RD->hasAttr<AlignedAttr>()) {
+ AlignRequirement = AlignRequirementKind::RequiredByRecord;
+ } else {
+ // Check if any field has RequiredByABI alignment requirement.
+ // If so, propagate it to the record.
----------------
ojhunt wrote:
Is that correct behavior though? e.g. are we wrong to _not_ inherit the alignment requirement?
https://github.com/llvm/llvm-project/pull/208256
More information about the cfe-commits
mailing list