Skip to content

Commit 4d56dfc

Browse files
committed
[AST] NFC: Repack misc EnumCaseDecl bits
1 parent 7bede89 commit 4d56dfc

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

include/swift/AST/Decl.h

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,13 @@ class alignas(1 << DeclAlignInBits) Decl {
283283
unsigned NumPatternEntries : 16;
284284
BITFIELD_END;
285285

286+
BITFIELD_START(EnumCaseDecl, Decl, 51);
287+
unsigned : 19; // unused / padding
288+
289+
/// The number of tail-allocated element pointers.
290+
unsigned NumElements : 32;
291+
BITFIELD_END;
292+
286293
BITFIELD_START(ValueDecl, Decl, 3);
287294
friend class MemberLookupTable;
288295

@@ -597,6 +604,7 @@ class alignas(1 << DeclAlignInBits) Decl {
597604
union {
598605
DeclBitfields DeclBits;
599606
PatternBindingDeclBitfields PatternBindingDeclBits;
607+
EnumCaseDeclBitfields EnumCaseDeclBits;
600608
ValueDeclBitfields ValueDeclBits;
601609
AbstractStorageDeclBitfields AbstractStorageDeclBits;
602610
AbstractFunctionDeclBitfields AbstractFunctionDeclBits;
@@ -5504,15 +5512,13 @@ class EnumCaseDecl final : public Decl,
55045512
friend TrailingObjects;
55055513
SourceLoc CaseLoc;
55065514

5507-
/// The number of tail-allocated element pointers.
5508-
unsigned NumElements;
5509-
55105515
EnumCaseDecl(SourceLoc CaseLoc,
55115516
ArrayRef<EnumElementDecl *> Elements,
55125517
DeclContext *DC)
55135518
: Decl(DeclKind::EnumCase, DC),
5514-
CaseLoc(CaseLoc), NumElements(Elements.size())
5519+
CaseLoc(CaseLoc)
55155520
{
5521+
EnumCaseDeclBits.NumElements = Elements.size();
55165522
std::uninitialized_copy(Elements.begin(), Elements.end(),
55175523
getTrailingObjects<EnumElementDecl *>());
55185524
}
@@ -5524,7 +5530,8 @@ class EnumCaseDecl final : public Decl,
55245530

55255531
/// Get the list of elements declared in this case.
55265532
ArrayRef<EnumElementDecl *> getElements() const {
5527-
return {getTrailingObjects<EnumElementDecl *>(), NumElements};
5533+
return {getTrailingObjects<EnumElementDecl *>(),
5534+
EnumCaseDeclBits.NumElements};
55285535
}
55295536

55305537
SourceLoc getLoc() const {

0 commit comments

Comments
 (0)