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:
@@ -235,34 +235,14 @@ ParameterList *ModuleFile::readParameterList() {
|
||||
unsigned recordID = DeclTypeCursor.readRecord(entry.ID, scratch);
|
||||
assert(recordID == PARAMETERLIST);
|
||||
(void) recordID;
|
||||
unsigned numParams;
|
||||
decls_block::ParameterListLayout::readRecord(scratch, numParams);
|
||||
|
||||
SmallVector<ParamDecl*, 8> params;
|
||||
for (unsigned i = 0; i != numParams; ++i) {
|
||||
scratch.clear();
|
||||
auto entry = DeclTypeCursor.advance(AF_DontPopBlockAtEnd);
|
||||
unsigned recordID = DeclTypeCursor.readRecord(entry.ID, scratch);
|
||||
assert(recordID == PARAMETERLIST_ELT);
|
||||
(void) recordID;
|
||||
|
||||
DeclID paramID;
|
||||
bool isVariadic;
|
||||
uint8_t rawDefaultArg;
|
||||
decls_block::ParameterListEltLayout::readRecord(scratch, paramID,
|
||||
isVariadic, rawDefaultArg);
|
||||
|
||||
ArrayRef<uint64_t> rawMemberIDs;
|
||||
decls_block::ParameterListLayout::readRecord(scratch, rawMemberIDs);
|
||||
|
||||
auto decl = cast<ParamDecl>(getDecl(paramID));
|
||||
decl->setVariadic(isVariadic);
|
||||
SmallVector<ParamDecl *, 8> params;
|
||||
for (DeclID paramID : rawMemberIDs)
|
||||
params.push_back(cast<ParamDecl>(getDecl(paramID)));
|
||||
|
||||
// Decode the default argument kind.
|
||||
// FIXME: Default argument expression, if available.
|
||||
if (auto defaultArg = getActualDefaultArgKind(rawDefaultArg))
|
||||
decl->setDefaultArgumentKind(*defaultArg);
|
||||
params.push_back(decl);
|
||||
}
|
||||
|
||||
return ParameterList::create(getContext(), params);
|
||||
}
|
||||
|
||||
@@ -3037,10 +3017,13 @@ ModuleFile::getDeclCheckedImpl(DeclID DID, Optional<DeclContext *> ForcedContext
|
||||
DeclContextID contextID;
|
||||
unsigned rawSpecifier;
|
||||
TypeID interfaceTypeID;
|
||||
bool isVariadic;
|
||||
uint8_t rawDefaultArg;
|
||||
|
||||
decls_block::ParamLayout::readRecord(scratch, argNameID, paramNameID,
|
||||
contextID, rawSpecifier,
|
||||
interfaceTypeID);
|
||||
interfaceTypeID, isVariadic,
|
||||
rawDefaultArg);
|
||||
|
||||
auto DC = ForcedContext ? *ForcedContext : getDeclContext(contextID);
|
||||
if (declOrOffset.isComplete())
|
||||
@@ -3070,6 +3053,12 @@ ModuleFile::getDeclCheckedImpl(DeclID DID, Optional<DeclContext *> ForcedContext
|
||||
}
|
||||
|
||||
param->setInterfaceType(paramTy->getInOutObjectType());
|
||||
param->setVariadic(isVariadic);
|
||||
|
||||
// Decode the default argument kind.
|
||||
// FIXME: Default argument expression, if available.
|
||||
if (auto defaultArg = getActualDefaultArgKind(rawDefaultArg))
|
||||
param->setDefaultArgumentKind(*defaultArg);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user