Skip to content

Commit 3901fa8

Browse files
authored
Merge pull request #15577 from CodaFi/defunct-defaults
[NFC] Serialize the resilience expansion of EnumElementDecl's default arguments
2 parents 4c47bd1 + 187f6c1 commit 3901fa8

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

include/swift/Serialization/ModuleFormat.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ const uint16_t VERSION_MAJOR = 0;
5656
/// it just ensures a conflict if two people change the module format.
5757
/// Don't worry about adhering to the 80-column limit for this line.
5858

59-
const uint16_t VERSION_MINOR = 405; // Last change: EnumElementDecl has a ParameterList
59+
const uint16_t VERSION_MINOR = 406; // Last change: EnumElementDecl resilience expansion
6060

6161
using DeclIDField = BCFixed<31>;
6262

@@ -1091,6 +1091,7 @@ namespace decls_block {
10911091
EnumElementRawValueKindField, // raw value kind
10921092
BCFixed<1>, // negative raw value?
10931093
IdentifierIDField, // raw value
1094+
BCFixed<1>, // default argument resilience expansion
10941095
BCVBR<5>, // number of parameter name components
10951096
BCArray<IdentifierIDField> // name components,
10961097

lib/Serialization/Deserialization.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3680,6 +3680,7 @@ ModuleFile::getDeclCheckedImpl(DeclID DID, Optional<DeclContext *> ForcedContext
36803680
bool isImplicit; bool hasPayload; bool isNegative;
36813681
unsigned rawValueKindID;
36823682
IdentifierID blobData;
3683+
uint8_t rawResilienceExpansion;
36833684
unsigned numArgNames;
36843685
ArrayRef<uint64_t> argNameAndDependencyIDs;
36853686

@@ -3688,6 +3689,7 @@ ModuleFile::getDeclCheckedImpl(DeclID DID, Optional<DeclContext *> ForcedContext
36883689
isImplicit, hasPayload,
36893690
rawValueKindID, isNegative,
36903691
blobData,
3692+
rawResilienceExpansion,
36913693
numArgNames,
36923694
argNameAndDependencyIDs);
36933695

@@ -3748,6 +3750,13 @@ ModuleFile::getDeclCheckedImpl(DeclID DID, Optional<DeclContext *> ForcedContext
37483750
elem->setAccess(std::max(cast<EnumDecl>(DC)->getFormalAccess(),
37493751
AccessLevel::Internal));
37503752

3753+
if (auto resilienceExpansion = getActualResilienceExpansion(
3754+
rawResilienceExpansion)) {
3755+
elem->setDefaultArgumentResilienceExpansion(*resilienceExpansion);
3756+
} else {
3757+
error();
3758+
return nullptr;
3759+
}
37513760
break;
37523761
}
37533762

lib/Serialization/Serialization.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3315,6 +3315,9 @@ void Serializer::writeDecl(const Decl *D) {
33153315
Negative = ILE->isNegative();
33163316
}
33173317

3318+
uint8_t rawResilienceExpansion =
3319+
getRawStableResilienceExpansion(
3320+
elem->getDefaultArgumentResilienceExpansion());
33183321
unsigned abbrCode = DeclTypeAbbrCodes[EnumElementLayout::Code];
33193322
EnumElementLayout::emitRecord(Out, ScratchRecord, abbrCode,
33203323
contextID,
@@ -3324,6 +3327,7 @@ void Serializer::writeDecl(const Decl *D) {
33243327
(unsigned)RawValueKind,
33253328
Negative,
33263329
addDeclBaseNameRef(RawValueText),
3330+
rawResilienceExpansion,
33273331
elem->getFullName().getArgumentNames().size()+1,
33283332
nameComponentsAndDependencies);
33293333
if (auto *PL = elem->getParameterList())

0 commit comments

Comments
 (0)