Add ReferenceStorageType.

The idea for now is that this is a SIL-only type used for
representing the storage of a weak or unowned reference.
Having it be its own type is pretty vital for reasonable
behavior in SIL and IR-generation, and it's likely that
this will surface into runtime metadata as well (hence
the mangling).

I've implemented a bunch of things that technically I don't
think are necessary if this stays out of the typechecker,
but it's easier to implement half-a-dozen "recurse into
the child type" methods now that it would be to find them
all later if we change our minds.

Swift SVN r6091
This commit is contained in:
John McCall
2013-07-09 08:37:40 +00:00
parent 3ea0fbf377
commit 18a9290cbe
19 changed files with 214 additions and 2 deletions

View File

@@ -1080,6 +1080,16 @@ bool Serializer::writeType(Type ty) {
return true;
}
case TypeKind::ReferenceStorage: {
auto refTy = cast<ReferenceStorageType>(ty.getPointer());
unsigned abbrCode = DeclTypeAbbrCodes[ReferenceStorageTypeLayout::Code];
ReferenceStorageTypeLayout::emitRecord(Out, ScratchRecord, abbrCode,
unsigned(refTy->getOwnership()),
addTypeRef(refTy->getReferentType()));
return true;
}
case TypeKind::Tuple: {
auto tupleTy = cast<TupleType>(ty.getPointer());