mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Serialization] Remove PARAMETERLIST_ELT node (#18570)
Way back in 6afe77d597 Chris removed the 'Parameter' type that tracked
extra information about parameters, collapsing it into ParamDecl and
making ParameterList "an overblown array of ParamDecl*'s". Do the same
thing for Serialization: push the few fields tracked in
PARAMETERLIST_ELT records down into PARAM_DECL, and then simplify the
PARAMETERLIST record to directly reference its parameters.
No functionality change.
This commit is contained in:
@@ -1218,21 +1218,12 @@ static uint8_t getRawStableResilienceExpansion(swift::ResilienceExpansion e) {
|
||||
void Serializer::writeParameterList(const ParameterList *PL) {
|
||||
using namespace decls_block;
|
||||
|
||||
unsigned abbrCode = DeclTypeAbbrCodes[ParameterListLayout::Code];
|
||||
ParameterListLayout::emitRecord(Out, ScratchRecord, abbrCode,
|
||||
PL->size());
|
||||
SmallVector<DeclID, 8> paramIDs;
|
||||
for (const ParamDecl *param : *PL)
|
||||
paramIDs.push_back(addDeclRef(param));
|
||||
|
||||
abbrCode = DeclTypeAbbrCodes[ParameterListEltLayout::Code];
|
||||
for (auto ¶m : *PL) {
|
||||
// FIXME: Default argument expressions?
|
||||
|
||||
auto defaultArg =
|
||||
getRawStableDefaultArgumentKind(param->getDefaultArgumentKind());
|
||||
ParameterListEltLayout::emitRecord(Out, ScratchRecord, abbrCode,
|
||||
addDeclRef(param),
|
||||
param->isVariadic(),
|
||||
defaultArg);
|
||||
}
|
||||
unsigned abbrCode = DeclTypeAbbrCodes[ParameterListLayout::Code];
|
||||
ParameterListLayout::emitRecord(Out, ScratchRecord, abbrCode, paramIDs);
|
||||
}
|
||||
|
||||
|
||||
@@ -3179,11 +3170,13 @@ void Serializer::writeDecl(const Decl *D) {
|
||||
|
||||
unsigned abbrCode = DeclTypeAbbrCodes[ParamLayout::Code];
|
||||
ParamLayout::emitRecord(Out, ScratchRecord, abbrCode,
|
||||
addDeclBaseNameRef(param->getArgumentName()),
|
||||
addDeclBaseNameRef(param->getName()),
|
||||
contextID,
|
||||
getRawStableVarDeclSpecifier(param->getSpecifier()),
|
||||
addTypeRef(interfaceType));
|
||||
addDeclBaseNameRef(param->getArgumentName()),
|
||||
addDeclBaseNameRef(param->getName()),
|
||||
contextID,
|
||||
getRawStableVarDeclSpecifier(param->getSpecifier()),
|
||||
addTypeRef(interfaceType),
|
||||
param->isVariadic(),
|
||||
getRawStableDefaultArgumentKind(param->getDefaultArgumentKind()));
|
||||
|
||||
if (interfaceType->hasError()) {
|
||||
param->getDeclContext()->dumpContext();
|
||||
@@ -4046,7 +4039,6 @@ void Serializer::writeAllDeclsAndTypes() {
|
||||
registerDeclTypeAbbr<DestructorLayout>();
|
||||
|
||||
registerDeclTypeAbbr<ParameterListLayout>();
|
||||
registerDeclTypeAbbr<ParameterListEltLayout>();
|
||||
|
||||
registerDeclTypeAbbr<ParenPatternLayout>();
|
||||
registerDeclTypeAbbr<TuplePatternLayout>();
|
||||
|
||||
Reference in New Issue
Block a user