mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Summon the eldritch horror "EagerDeserializationDecls" from the bowels of history.
Adding explicit constructors to Clang-imported structs in the previous commits exposes a latent phase ordering issue between the Clang importer and SIL deserialization. Deserializing the standard library SIL ends up pulling in additional Clang decls which never get type-checked before we attempt to emit their code. Work around this by bringing back the "EagerDeserializedDecls" block in the serialization format, and adding any cross-referenced decls that get referenced in SILSerializeAll mode to it, so that we ensure they're available before SILGen. We also have to type-check external decls after doing so, since when only importing a module, we wouldn't do any type-checking at all otherwise. Swift SVN r23728
This commit is contained in:
@@ -49,6 +49,8 @@ class Serializer {
|
||||
const SourceFile *SF = nullptr;
|
||||
|
||||
public:
|
||||
const SerializationOptions &Options;
|
||||
|
||||
/// Stores a declaration or a type to be written to the AST file.
|
||||
///
|
||||
/// Convenience wrapper around a PointerUnion.
|
||||
@@ -142,8 +144,8 @@ private:
|
||||
/// IdentifierID.
|
||||
std::vector<CharOffset> IdentifierOffsets;
|
||||
|
||||
/// The decls that adopt compiler-known protocols.
|
||||
SmallVector<DeclID, 2> KnownProtocolAdopters[NumKnownProtocols];
|
||||
/// Decls to be eagerly deserialized.
|
||||
SmallVector<DeclID, 2> EagerDeserializationDecls;
|
||||
|
||||
/// The last assigned DeclID for decls from this module.
|
||||
DeclID LastDeclID = 0;
|
||||
@@ -264,7 +266,8 @@ private:
|
||||
void writeToStream(raw_ostream &os);
|
||||
|
||||
template <size_t N>
|
||||
Serializer(const unsigned char (&signature)[N], ModuleOrSourceFile DC);
|
||||
Serializer(const unsigned char (&signature)[N], ModuleOrSourceFile DC,
|
||||
const SerializationOptions &Options);
|
||||
|
||||
public:
|
||||
/// Serialize a module to the given stream.
|
||||
|
||||
Reference in New Issue
Block a user