[Serialization] Preserve source order in serialization (#18361)

We previously shied away from this in order to not /accidentally/
depend on it, but it becomes interesting again with textual
interfaces, which can certainly be read by humans. The cross-file
order is the order of input files, which is at least controllable by
users.
This commit is contained in:
Jordan Rose
2018-07-31 13:15:07 -07:00
committed by GitHub
parent 3439333f79
commit 2dfa303975
12 changed files with 229 additions and 238 deletions

View File

@@ -55,7 +55,7 @@ const uint16_t 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 VERSION_MINOR = 429; // Last change: coroutine accessors
const uint16_t VERSION_MINOR = 430; // Last change: ordered top-level decls
using DeclIDField = BCFixed<31>;
@@ -1635,6 +1635,8 @@ namespace index_block {
NESTED_TYPE_DECLS,
DECL_MEMBER_NAMES,
ORDERED_TOP_LEVEL_DECLS,
GENERIC_SIGNATURE_OFFSETS,
SUBSTITUTION_MAP_OFFSETS,
LastRecordKind = SUBSTITUTION_MAP_OFFSETS,
@@ -1689,6 +1691,11 @@ namespace index_block {
ENTRY_POINT,
DeclIDField // the ID of the main class; 0 if there was a main source file
>;
using OrderedDeclsLayout = BCGenericRecordLayout<
RecordIDField, // record ID
BCArray<DeclIDField> // list of decls by ID
>;
}
/// \sa DECL_MEMBER_TABLES_BLOCK_ID