[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:
Jordan Rose
2018-08-08 14:15:47 -07:00
committed by GitHub
parent f7edb4cbee
commit 9ebbf2fbaf
4 changed files with 36 additions and 60 deletions

View File

@@ -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 &param : *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>();