[Serialization] Preserve private discriminators through serialization.

Part of rdar://problem/17632175

Swift SVN r21611
This commit is contained in:
Jordan Rose
2014-08-30 17:27:02 +00:00
parent fcfd44c756
commit 1b51b60e72
8 changed files with 94 additions and 12 deletions

View File

@@ -160,6 +160,8 @@ TRAILING_INFO(GENERIC_PARAM)
TRAILING_INFO(GENERIC_REQUIREMENT)
TRAILING_INFO(LAST_GENERIC_REQUIREMENT)
OTHER(DISCRIMINATOR, 249)
OTHER(NO_CONFORMANCE, 250)
OTHER(NORMAL_PROTOCOL_CONFORMANCE, 251)
OTHER(SPECIALIZED_PROTOCOL_CONFORMANCE, 252)

View File

@@ -250,6 +250,8 @@ private:
std::unique_ptr<SerializedDeclTable> ClassMembersByName;
std::unique_ptr<SerializedDeclTable> OperatorMethodDecls;
llvm::DenseMap<const ValueDecl *, Identifier> PrivateDiscriminatorsByValue;
TinyPtrVector<Decl *> ImportDecls;
using DeclIDVector = SmallVector<serialization::DeclID, 4>;

View File

@@ -40,7 +40,7 @@ const uint16_t VERSION_MAJOR = 0;
/// Serialized module format minor version number.
///
/// When the format changes IN ANY WAY, this number should be incremented.
const uint16_t VERSION_MINOR = 131;
const uint16_t VERSION_MINOR = 132;
using DeclID = Fixnum<31>;
using DeclIDField = BCFixed<31>;
@@ -947,6 +947,13 @@ namespace decls_block {
BCFixed<1> // dummy
>;
/// Specifies the discriminator string for a private declaration. This
/// identifies the declaration's original source file in some opaque way.
using DiscriminatorLayout = BCRecordLayout<
DISCRIMINATOR,
IdentifierIDField // discriminator string, as an identifier
>;
/// A placeholder for lack of conformance information. Conformances are
/// indexed, so simply omitting one would be incorrect.
using NoConformanceLayout = BCRecordLayout<