mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Serialization] Improve extensions of nested types with the same name (#7397)
Previously looking up an extension would result in all extensions for types with the same name (nested or not) being deserialized; this could even bring in base types that had not been deserialized yet. Add in a string to distinguish an extension's base type; in the top-level case this is just a module name, but for nested types it's a full mangled name. This is a little heavier than I'd like it to be, since it means we mangle names and then throw them away, and since it means there's a whole bunch of extra string data in the module just for uniquely identifying a declaration. But it's correct, and does less work than before, and fixes a circularity issue with a nested type A.B.A that apparently used to work. https://bugs.swift.org/browse/SR-3915
This commit is contained in:
@@ -54,7 +54,7 @@ const uint16_t VERSION_MAJOR = 0;
|
||||
/// in source control, you should also update the comment to briefly
|
||||
/// 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.
|
||||
const uint16_t VERSION_MINOR = 314; // Last change: change synthetic substitution serialization
|
||||
const uint16_t VERSION_MINOR = 315; // Last change: uniquely identify extensions
|
||||
|
||||
using DeclID = PointerEmbeddedInt<unsigned, 31>;
|
||||
using DeclIDField = BCFixed<31>;
|
||||
@@ -1476,6 +1476,12 @@ namespace index_block {
|
||||
BCBlob // actual names
|
||||
>;
|
||||
|
||||
using ExtensionTableLayout = BCRecordLayout<
|
||||
EXTENSIONS, // record ID
|
||||
BCVBR<16>, // table offset within the blob (see below)
|
||||
BCBlob // map from identifier strings to decl kinds / decl IDs
|
||||
>;
|
||||
|
||||
using ObjCMethodTableLayout = BCRecordLayout<
|
||||
OBJC_METHODS, // record ID
|
||||
BCVBR<16>, // table offset within the blob (see below)
|
||||
|
||||
Reference in New Issue
Block a user