[Serialization] Handle XREFs to private types (#14352)

We can encounter these when the compiler modifies an inlinable
function to break apart a struct and the struct uses a private
type for one of its fields. It's questionable whether we /should/
handle this, but meanwhile this /is/ a non-intrusive fix that
preserves the performance of non-resilient libraries.

(That is, it appears this worked in Swift 4.0, though perhaps
not all of the same optimizations kicked in.)

https://bugs.swift.org/browse/SR-6874
This commit is contained in:
Jordan Rose
2018-02-07 16:42:16 -08:00
committed by GitHub
parent 573ebc5920
commit af67204b51
7 changed files with 156 additions and 17 deletions

View File

@@ -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 = 397; // No resilience expansion in SILDeclRef
const uint16_t VERSION_MINOR = 398; // Private discriminators for type xrefs
using DeclIDField = BCFixed<31>;
@@ -1288,6 +1288,7 @@ namespace decls_block {
using XRefTypePathPieceLayout = BCRecordLayout<
XREF_TYPE_PATH_PIECE,
IdentifierIDField, // name
IdentifierIDField, // private discriminator
BCFixed<1> // restrict to protocol extension
>;