[serialization] Add support for destructors.

With this commit, we can now serialize all of stdlib_core!
(Deserializing still has a few issues.)

Swift SVN r6188
This commit is contained in:
Jordan Rose
2013-07-11 23:35:34 +00:00
parent e0301b6037
commit c699b84cfa
3 changed files with 55 additions and 3 deletions

View File

@@ -1053,6 +1053,29 @@ Decl *ModuleFile::getDecl(DeclID DID, Optional<DeclContext *> ForcedContext) {
break;
}
case decls_block::DESTRUCTOR_DECL: {
DeclID parentID;
bool isImplicit;
TypeID signatureID;
DeclID implicitThisID;
decls_block::DestructorLayout::readRecord(scratch, parentID, isImplicit,
signatureID, implicitThisID);
auto thisDecl = cast<VarDecl>(getDecl(implicitThisID, nullptr));
DeclContext *parent = getDeclContext(parentID);
auto dtor = new (ctx) DestructorDecl(ctx.getIdentifier("destructor"),
SourceLoc(), thisDecl, parent);
declOrOffset = dtor;
thisDecl->setDeclContext(dtor);
dtor->setType(getType(signatureID));
if (isImplicit)
dtor->setImplicit();
break;
}
case decls_block::XREF: {
uint8_t kind;
TypeID expectedTypeID;