[Serialization] Rename "alias name type" to "builtin alias type".

We still use the old layout for NameAliasType for builtin types, so
rename the Layout struct and corresponding code to describe its new
(more restricted) purpose.
This commit is contained in:
Doug Gregor
2018-03-25 21:01:38 -07:00
parent c43f96a855
commit 0524741f6c
4 changed files with 13 additions and 13 deletions

View File

@@ -78,7 +78,7 @@
// These IDs must \em not be renumbered or reordered without incrementing
// VERSION_MAJOR in ModuleFormat.h. Names, however, may change.
FIRST_TYPE(NAME_ALIAS, 1)
FIRST_TYPE(BUILTIN_ALIAS, 1)
TYPE(GENERIC_TYPE_PARAM)
TYPE(DEPENDENT_MEMBER)
TYPE(NOMINAL)

View File

@@ -641,8 +641,8 @@ namespace decls_block {
#include "swift/Serialization/DeclTypeRecordNodes.def"
};
using NameAliasTypeLayout = BCRecordLayout<
NAME_ALIAS_TYPE,
using BuiltinAliasTypeLayout = BCRecordLayout<
BUILTIN_ALIAS_TYPE,
DeclIDField, // typealias decl
TypeIDField // canonical type (a fallback)
>;

View File

@@ -4145,11 +4145,11 @@ Expected<Type> ModuleFile::getTypeChecked(TypeID TID) {
s->getFrontendCounters().NumTypesDeserialized++;
switch (recordID) {
case decls_block::NAME_ALIAS_TYPE: {
case decls_block::BUILTIN_ALIAS_TYPE: {
DeclID underlyingID;
TypeID canonicalTypeID;
decls_block::NameAliasTypeLayout::readRecord(scratch, underlyingID,
canonicalTypeID);
decls_block::BuiltinAliasTypeLayout::readRecord(scratch, underlyingID,
canonicalTypeID);
auto aliasOrError = getDeclChecked(underlyingID);
if (!aliasOrError)
return aliasOrError.takeError();

View File

@@ -3597,12 +3597,12 @@ void Serializer::writeType(Type ty) {
TypeAliasDecl *typeAlias =
findTypeAliasForBuiltin(M->getASTContext(), ty);
unsigned abbrCode = DeclTypeAbbrCodes[NameAliasTypeLayout::Code];
NameAliasTypeLayout::emitRecord(Out, ScratchRecord, abbrCode,
addDeclRef(typeAlias,
/*forceSerialization*/false,
/*allowTypeAliasXRef*/true),
TypeID());
unsigned abbrCode = DeclTypeAbbrCodes[BuiltinAliasTypeLayout::Code];
BuiltinAliasTypeLayout::emitRecord(Out, ScratchRecord, abbrCode,
addDeclRef(typeAlias,
/*forceSerialization*/false,
/*allowTypeAliasXRef*/true),
TypeID());
break;
}
case TypeKind::BoundNameAlias: {
@@ -3977,7 +3977,7 @@ void Serializer::writeType(Type ty) {
void Serializer::writeAllDeclsAndTypes() {
BCBlockRAII restoreBlock(Out, DECLS_AND_TYPES_BLOCK_ID, 8);
using namespace decls_block;
registerDeclTypeAbbr<NameAliasTypeLayout>();
registerDeclTypeAbbr<BuiltinAliasTypeLayout>();
registerDeclTypeAbbr<BoundNameAliasTypeLayout>();
registerDeclTypeAbbr<GenericTypeParamDeclLayout>();
registerDeclTypeAbbr<AssociatedTypeDeclLayout>();