mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
AST: Remove some unnecessary SubstitutionList copies
ASTContext::getSpecializedConformance() already copies the substitutions, so remove some AllocateCopy() calls. Also, add a new overload taking a SubstitutionMap instead. This allows removing some gatherAllSubstitutions() calls, which have an allocation inside them. Finally, remove the now-unused ModuleDecl parameter from ProtocolConformance::subst() and make it public.
This commit is contained in:
@@ -802,12 +802,10 @@ ModuleDecl::lookupConformance(Type type, ProtocolDecl *protocol,
|
||||
if (!explicitConformanceType->isEqual(type)) {
|
||||
// Gather the substitutions we need to map the generic conformance to
|
||||
// the specialized conformance.
|
||||
auto substitutions = type->gatherAllSubstitutions(this, resolver,
|
||||
explicitConformanceDC);
|
||||
auto subMap = type->getContextSubstitutionMap(this, explicitConformanceDC);
|
||||
|
||||
// Create the specialized conformance entry.
|
||||
auto result = ctx.getSpecializedConformance(type, conformance,
|
||||
substitutions);
|
||||
auto result = ctx.getSpecializedConformance(type, conformance, subMap);
|
||||
return ProtocolConformanceRef(result);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user