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:
@@ -312,6 +312,10 @@ private:
|
||||
using SerializedDeclTable =
|
||||
llvm::OnDiskIterableChainedHashTable<DeclTableInfo>;
|
||||
|
||||
class ExtensionTableInfo;
|
||||
using SerializedExtensionTable =
|
||||
llvm::OnDiskIterableChainedHashTable<ExtensionTableInfo>;
|
||||
|
||||
class LocalDeclTableInfo;
|
||||
using SerializedLocalDeclTable =
|
||||
llvm::OnDiskIterableChainedHashTable<LocalDeclTableInfo>;
|
||||
@@ -323,9 +327,9 @@ private:
|
||||
std::unique_ptr<SerializedDeclTable> TopLevelDecls;
|
||||
std::unique_ptr<SerializedDeclTable> OperatorDecls;
|
||||
std::unique_ptr<SerializedDeclTable> PrecedenceGroupDecls;
|
||||
std::unique_ptr<SerializedDeclTable> ExtensionDecls;
|
||||
std::unique_ptr<SerializedDeclTable> ClassMembersByName;
|
||||
std::unique_ptr<SerializedDeclTable> OperatorMethodDecls;
|
||||
std::unique_ptr<SerializedExtensionTable> ExtensionDecls;
|
||||
std::unique_ptr<SerializedLocalDeclTable> LocalTypeDecls;
|
||||
std::unique_ptr<SerializedNestedTypeDeclsTable> NestedTypeDecls;
|
||||
|
||||
@@ -446,6 +450,11 @@ private:
|
||||
std::unique_ptr<ModuleFile::SerializedObjCMethodTable>
|
||||
readObjCMethodTable(ArrayRef<uint64_t> fields, StringRef blobData);
|
||||
|
||||
/// Read an on-disk local decl hash table stored in
|
||||
/// index_block::ExtensionTableLayout format.
|
||||
std::unique_ptr<SerializedExtensionTable>
|
||||
readExtensionTable(ArrayRef<uint64_t> fields, StringRef blobData);
|
||||
|
||||
/// Read an on-disk local decl hash table stored in
|
||||
/// index_block::NestedTypeDeclsLayout format.
|
||||
std::unique_ptr<SerializedNestedTypeDeclsTable>
|
||||
|
||||
Reference in New Issue
Block a user