[serialization] Serialize builtin types and typealiases.

Just a starting point -- builtin types are serialized by name, and the
IdentifierType necessary to /refer/ to a typealias is completely skipped.
This should be enough to start working on deserialization, however.

Swift SVN r5320
This commit is contained in:
Jordan Rose
2013-05-25 01:34:51 +00:00
parent b81adff06f
commit fc1cbf0aaf
4 changed files with 279 additions and 12 deletions

View File

@@ -115,6 +115,10 @@ namespace input_block {
using DeclID = uint32_t;
using DeclIDField = BCFixed<32>;
// These two types must be the same because they are stored in the same way.
using TypeID = DeclID;
using TypeIDField = DeclIDField;
using BitOffset = uint32_t;
using BitOffsetField = BCFixed<32>;
@@ -126,8 +130,9 @@ namespace decls_block {
// VERSION_MAJOR.
enum {
BUILTIN_TYPE = 1,
NAME_ALIAS_TYPE,
TYPEALIAS_DECL = 100,
TYPE_ALIAS_DECL = 100,
NAME_HACK = 200
};
@@ -137,11 +142,17 @@ namespace decls_block {
BCBlob // name of the builtin type
>;
using NameAliasTypeLayout = BCRecordLayout<
NAME_ALIAS_TYPE,
DeclIDField // typealias decl
>;
using TypeAliasLayout = BCRecordLayout<
TYPEALIAS_DECL,
DeclIDField, // underlying type
TYPE_ALIAS_DECL,
TypeIDField, // underlying type
BCFixed<1>, // generic flag
BCArray<DeclIDField> // inherited types
BCFixed<1>, // implicit flag
BCArray<TypeIDField> // inherited types
>;
/// Names will eventually be uniqued in an identifier table, but for now we