mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
SILGen: Emit default witness tables for all non-@objc protocols
SILGen will now be able to look up the default implementation corresponding to a requirement while emitting conformances, and reference the default witness thunk instead of emitting duplicate thunks for each conforming type. IRGen continues to only emit resilient defaults if the protocol itself is resilient; otherwise, it just ignores the default witness table.
This commit is contained in:
@@ -189,12 +189,14 @@ SILModule::lookUpDefaultWitnessTable(const ProtocolDecl *Protocol) {
|
||||
// protocol descriptor metadata for the protocol.
|
||||
|
||||
auto found = DefaultWitnessTableMap.find(Protocol);
|
||||
if (found == DefaultWitnessTableMap.end()) {
|
||||
return nullptr;
|
||||
}
|
||||
assert(found != DefaultWitnessTableMap.end() &&
|
||||
"Missing default witness table for protocol");
|
||||
|
||||
SILDefaultWitnessTable *wtable = found->second;
|
||||
|
||||
|
||||
return found->second;
|
||||
// Just return the declaration.
|
||||
return wtable;
|
||||
}
|
||||
|
||||
SILDefaultWitnessTable *
|
||||
|
||||
Reference in New Issue
Block a user