Serialize Fingerprints in Swift Modules

This commit is contained in:
Robert Widmann
2020-11-17 16:23:07 -08:00
parent beeefbc804
commit 9f79fd5df1
12 changed files with 189 additions and 7 deletions

View File

@@ -56,7 +56,7 @@ const uint16_t SWIFTMODULE_VERSION_MAJOR = 0;
/// describe what change you made. The content of this comment isn't important;
/// it just ensures a conflict if two people change the module format.
/// Don't worry about adhering to the 80-column limit for this line.
const uint16_t SWIFTMODULE_VERSION_MINOR = 586; // allow errors in modules
const uint16_t SWIFTMODULE_VERSION_MINOR = 587; // fingerprints in modules
/// A standard hash seed used for all string hashes in a serialized module.
///
@@ -2010,6 +2010,7 @@ namespace index_block {
PRECEDENCE_GROUPS,
NESTED_TYPE_DECLS,
DECL_MEMBER_NAMES,
DECL_FINGERPRINTS,
ORDERED_TOP_LEVEL_DECLS,
@@ -2017,7 +2018,7 @@ namespace index_block {
CLANG_TYPE_OFFSETS,
LastRecordKind = CLANG_TYPE_OFFSETS,
};
constexpr const unsigned RecordIDFieldWidth = 5;
static_assert(LastRecordKind < (1 << RecordIDFieldWidth),
"not enough bits for all record kinds");
@@ -2078,6 +2079,12 @@ namespace index_block {
RecordIDField, // record ID
BCArray<DeclIDField> // list of decls by ID
>;
using DeclFingerprintsLayout = BCRecordLayout<
DECL_FINGERPRINTS, // record ID
BCVBR<16>, // table offset within the blob (see below)
BCBlob // map from member DeclIDs to strings
>;
}
/// \sa DECL_MEMBER_TABLES_BLOCK_ID